Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Problems in Release [solved]
#1
Hi,
I'm trying to make your bootloader work on my hardware but I'm having a very strange issue (IMHO).
The bootloader runs and works perfectly if I compile it in debug mode (The little green arrow and pink square toolbar button in mplabx, the one right before the program counter indicator) but if I compile it in release it isn't working.
It compiles and program the mcu, but when I try to load a hex file trough the ds30Loader gui i get write verification errors as soon as it tries to write something.
This is the gui output:
Code:
Initiating write...
      Creating port: High-Speed USB Serial Port (COM13)
      Opening port High-Speed USB Serial Port (COM13)@19200
      Searching for bl .
      Found PIC24HJ256GP610 fw ver. 4.0.3
      Bootloader placement/size: 1/1
      Waiting for the boot loader to be ready...ok
      Hex file successfully parsed in 0ms
      Writing flash....
            Erasing page 0 @ 0x0000...ok
            Writing row 0 @ 0x0000...verification error, try 1, verification error, try 2, write failed
            Write flash failed
      Closing port
      Tx 601 bytes / Rx 8 bytes / 0,6s
      Write failed

I disabled any write code protection through the linker configuration gui and through the configuration bits in the code.
I attach my settings.inc file.

I'm using a PIC24HJ256GP610 on a custom board running at 40MHz with a 8 MHz crystal just like the explorer16 demo board.

Does anyone have an idea about what's happening?
Thank you!


Attached Files
.txt   settings.txt (Size: 9.41 KB / Downloads: 11)
Reply
#2
Hi,
Please try to do a complete device erase before you write the boot loader to the chip.
Which voltage do you use?
Are there decoupling capacitors on all supply pins?
Do you have a good power supply?
Reply
#3
Hi,
thank you for your reply, I tried to completely erase the device before flashing the bootloadr but the result is exactly the same.

I'm pretty sure that the power supply of the board is ok, infact the board is already used in many machines and never had a problem.

I'm attaching the power supply and cpu part of the schematic for you to check.

Thank you very much for your kindness.


Attached Files
.pdf   PLC1.pdf (Size: 13.05 KB / Downloads: 13)
.pdf   PLC2.pdf (Size: 23.37 KB / Downloads: 8)
Reply
#4
I solved my problems. It was caused by a modification that I did:
Since I was trying to debug the boot loader I was experiencing a reset every time a rcall was executed.
I noticed that the SPLIM reg was set at 0x084E while the W15 was at 0x0920 so the stack error trap was triggered but unhandled and the device resetted.
To avoid this I manually defined the __SP_init constant to 0x0800 and so it worked in debug but it wasn't working in release mode.
Removing my definition was the solution: it started working flawlessly.
I found the solution in MPLAB LINK30 manual in section 9.5.4.7 MPLAB ICD 2 DEBUGGER MEMORY where is says that for ICD2 ther will be 0x50 bytes reserved starting from 0x800. I guess that since I'm using ICD3 it requires 0x120 bytes insetead.

Thank you very much for your help.
Reply
#5
Great! Thanks for the update.
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)