This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

XC161 Program/Data PSRAM

With the V2 core Infineon has introduced the PSRAM on the XC16x derivatives. Does anybody have any good pointers to further documentation on how best to use this memory for in system flash reprogramming ?

What I am naively envisaging is having a C-callable function as part of my standard code (stored and executed from on-chip FLASH) which when called would copy some form of bootloader code into the PSRAM, transfer control to there, then load the new target binary say from external RAM (or serial port), reprogram the flash and then restart execution from flash !?

I guess this is feasible or am I missing something vital ? Any tips, examples or hints gratefully received.

Thanks,
J.

PS: Keil v5.0 / XC161CJ

  • Your idea sounds feasible to me.

    This is how I handle software updates. I use the first sector of FLASH for boot code. The purpose of boot is to allow application software to be reprogrammed via CAN or RS232. Application code resides in the remaining sectors of FLASH. Having a dedicated boot sector that never gets erased allows us to recover from a condition where power is lost during an update. It sounds like your scheme would be vulnerable to this but if you do not see this as a concern, you can certainly erase the entire FLASH and re-program it while running from RAM.

    A good place to start would be to use one of the example projects from C:\Keil\C166\Flash and tailored it to fit your requirements.

    Using my scheme, the only function I had to copy to RAM is Check() in FlashDev.c. That was easy once I read through application note 138. Your scheme would require you to copy the entire file to RAM along with code to retreive your update, but that shouldn't be an issue as long as it is small enough to fit in program RAM.

    Here's a link to app note 138 in case you have not seen it.
    http://www.keil.com/appnotes/docs/apnt_138.asp

    Hope this helps,
    -Walt