Reprogrammability in the field over the Ethernet

LNPhil25

New member
My team is building a product using the Teensy 4.1 and we need to reprogram the Teensy out in the field (over the Ethernet). The Teensy HEX file is small and I have decoded and sent the new file over the Ethernet and stored in RAM (in RAM2), all I need to do now is run my load code out of FASTRUN (RAM1), turn off ALL interrupts and program the new code into executable FLASHMEM. I have done this several times with other processors, my question is, how do I get access to the ChipSelect, Clock and Data lines of the W25Q65JV Serial FLASH so I can do field reprogramming? I was assuming there must be some access because of the LittleFS library that writes to FLASH (which I am using to save other data). Is there a library that I can use? Any help pointing me in the right direction to control the pins to executable FLASH will be appreciated. Thanks in advance!
 
My team is building a product using the Teensy 4.1 and we need to reprogram the Teensy out in the field (over the Ethernet). The Teensy HEX file is small and I have decoded and sent the new file over the Ethernet and stored in RAM (in RAM2), all I need to do now is run my load code out of FASTRUN (RAM1), turn off ALL interrupts and program the new code into executable FLASHMEM. I have done this several times with other processors, my question is, how do I get access to the ChipSelect, Clock and Data lines of the W25Q65JV Serial FLASH so I can do field reprogramming? I was assuming there must be some access because of the LittleFS library that writes to FLASH (which I am using to save other data). Is there a library that I can use? Any help pointing me in the right direction to control the pins to executable FLASH will be appreciated. Thanks in advance!

You could use the method we've been calling "FlasherX", or at least use some of the code. It's called FlasherX because there were originally separate implementations for T3.x (Flasher3) and T4.x (Flasher4), and they were combined into FlasherX, which supports all Teensy LC,3,4, and Micromod. Here's a link to the particular thread/message that contains a link to the latest release on github.

https://forum.pjrc.com/threads/4316...sy-3-5-amp-3-6?p=297272&viewfull=1#post297272

The basic idea for Teensy3 was to buffer the new firmware to upper flash and then move it to lower flash. For Teensy4, which has more RAM, there is an option for buffering the new code in RAM if it's small enough, or in flash if it won't fit in RAM. The file named FlashTXX.c has a function named flash_move() that takes a pointer to a source buffer (which can be in RAM or flash) and a pointer to the destination (flash), and the size in bytes. This function will copy what is in the buffer to the flash, erasing sectors as it goes. The T4.x flash erase and write functions are in the Teensy4 core, in file eeprom.c. I suggest you start by running or at least reviewing the FlasherX sketch. It may be enough to add FlashTXX.c (and .h) to your project, but of course it's important that you have some error checking in the transfer of the HEX file to the target to be sure that what you write to flash is correct and complete.
 
I added some EXTMEM to hold the new code and then used the 'FlashTxx' code to put the code into Flash. Everything is working! Thanks for the input.
 
I added some EXTMEM to hold the new code and then used the 'FlashTxx' code to put the code into Flash. Everything is working! Thanks for the input.

Glad it helped. I don't think I ever tried buffering the new firmware in PSRAM for T4.1, so it's good to know that works. Tell us more about your product when you can.
 
Back
Top