Increase non-volatile memory storage

jhendrix

Active member
I would like to increase the non-volatile storage available on a teensy 4.0
I would like to accomplish 2 requirements if possible.

1st is to increase the size of the EEPROM storage. It looks like it should be possible to have up to 60k of EE storage. I do not need to worry about wear leveling. I'm storing setup data and some user data, but they should rarely (if ever) need to be changed. (I would be surprised if it needed more than a dozen writes during its lifetime).

The 2nd thing I would like to do (this is still up in the air), is write large chunks of data to the flash (in the 100's of K range). This data is also expected to be written at most a couple of times during the lifetime of the product. I would probably use x-modem or something similar to get that data into the teensy. I would want this data directly readable from flash memory, so I don't know if LittleFS would work (unless there is a way to provide the flash memory pointer directly to my program, and the memory would have to be sequential). I've seen a few posts talking about writing to flash, but I think they were doing self (OTA) programming.

Any info on either of these would be appreciated
Thanks
 
I would like to increase the non-volatile storage available on a teensy 4.0
I would like to accomplish 2 requirements if possible.

1st is to increase the size of the EEPROM storage. It looks like it should be possible to have up to 60k of EE storage. I do not need to worry about wear leveling. I'm storing setup data and some user data, but they should rarely (if ever) need to be changed. (I would be surprised if it needed more than a dozen writes during its lifetime).

The 2nd thing I would like to do (this is still up in the air), is write large chunks of data to the flash (in the 100's of K range). This data is also expected to be written at most a couple of times during the lifetime of the product. I would probably use x-modem or something similar to get that data into the teensy. I would want this data directly readable from flash memory, so I don't know if LittleFS would work (unless there is a way to provide the flash memory pointer directly to my program, and the memory would have to be sequential). I've seen a few posts talking about writing to flash, but I think they were doing self (OTA) programming.

Any info on either of these would be appreciated
Thanks

The functions in cores\Teensy4\eeprom.c can be used to "manually" erase/write anywhere in the main flash. The advantage of using EEPROM and LittleFS, though, is that when you do a firmware update, those sections are preserved, whereas something you wrote below those (to a lower address) could be erased.
 
The functions in cores\Teensy4\eeprom.c can be used to "manually" erase/write anywhere in the main flash. The advantage of using EEPROM and LittleFS, though, is that when you do a firmware update, those sections are preserved, whereas something you wrote below those (to a lower address) could be erased.

Thanks for the info. So it looks like everything is protected above 0x601F0000 during a reprogram. Is there a way (via fuse bits) to extend that memory range to a lower address? Right now my code (and bitmap data) is only about 300k, so I have more than 1 1/2 megs of unused flash memory I could use to store data the end user can upload.
 
No, there aren't any fuses or other settings to control the amount of flash erased.

But the entire flash isn't necessarily erased. The bootloader erases either the amount of memory needed (based on the size of your program), or a minimum amount if the prior program was small. In normal mode, the minimum is 512K. In secure mode (Lockable Teensy only) the minimum is 1024K.

So if you simply store data in that flash from 0x60100000 to 0x601EFFFF, and if your code doesn't use more than the first 1M of the flash, you should do fine. Or if you'll never use secure mode, you could start at 0x60080000. Just be careful to keep your program's total size under 512K.
 
Back
Top