AnsweredAssumed Answered

Using the GPAGE register from within a C program

Question asked by John Dammeyer on Sep 22, 2014
Latest reply on Oct 1, 2014 by ZhangJennie

I've got a number of dsPIC modules connected via CAN bus to a 9S12XDP512.  A PC, through an FTDI 245 USB connection talks to the 9S12.  I want to be able to update both the 9S12 code and the dsPIC module code.

First I'd save the new code into 9S12 banked FLASH.  Then transfer the data over the CAN bus to one of the dsPIC devices where it can be initially stored in an external EEROM.  A reprogram command sent to the dsPIC modules will run their bootloader to read the new code from the EEROM and program the dsPIC Flash Memory. 

In the same manner I'd like to be able to upgrade the 9S12.  First put the code (<64K) into banked FLASH memory in the 9S12.  Then launch a bootloader that programs the unbanked code space with the image in FLASH.

One other feature I need is that the code sent from the PC into FLASH is encrypted.  The bootloader programmer code would be responsible for decrypting it either in the 9S12 or inside the dsPIC after it reads a block from EEROM.

The plan was to use the GPAGE register to point to one of the 16K flash pages in the 9S12 and just use 4 pages to serve as the code storage.  However, I can't find any app notes for using the GPAGE from a C program so I can transfer for performing the FLASH programming.  Even an app note specifically for the S12XFTX512K4V2 Flash seems to be non-existent.

So I'm looking for help/guidance/consulting to get this done.

Any suggestions are welcome.