dspic33FJ flash programming issues
I have struggled with use the debugger to develop a bootloader for the dspic33FJGS606 using MPLAB X IDE V4.01 with the XC16 compiler. I have used dspic33FJs for years but never used TBLPAG and NVMCON registers to perform in circuit programming.
I started with the the flash program code provided by Microchip in a zip file Boand modified the communication front end and parser to allow deployment within my high level system (not PC based) - all of that works nicely.
What I can't resolve is use of the debugger to verify the programming is correct.
When the first page of target code is erased the debugger halts preventing the follow on programming step.
I understand the it is required to erase first then program.
The erase options are limited to pages (512 instructions or in address steps of 0x400.) so the address for the target load is 0xC00 and a page boundry.
The boot loader is located at 0x400 to allow the vector table to be erased and programmed. the ending address of the debug code is 0x952
The code in the memory.s is unchanged and the C calls to it retain the same data transfer.
The debugger halts after the first page erase (no breakpoints are set, no interrupts are coded) - the program memory of the bootstrap is still good and I can resume the debugger.
I don't see any resource conflicts with the debugger and find nothing in the forum that discusses the issue.
Help is very much appreciated - I have been at this for weeks.
code is attached