More questions about Redboard Turbo external flash memory

Hi there, after digging for info on the 4mb external flash that comes with Redboard Turbo I found this thread, but I still have some newbie questions. Thanks in advance for your patience.

viewtopic.php?f=145&t=49805&p=203848&hi … ry#p203848

When the UF2 bootloader is active, is it exposing the internal 256kb memory or the external 4mb memory over Mass Storage? Or both?

Is it possible to load files onto the 4mb memory over USB mass storage?

Do I have to format the external memory with a filesystem like FAT in order to use it? Or it is possible to bake arrays of data into it similar to using PROGMEM on an arduino?

Thanks!

Hi letgoat.

When the UF2 bootloader is active, is it exposing the internal 256kb memory or the external 4mb memory over Mass Storage? Or both?

When bootloader is active, you’re only seeing the 4mb external memory via mass storage. The internal memory is not exposed via mass storage. The way this works is you copy your code into the external memory and then when the bootloader exits, the SAMD copies your code from external, to internal memory.

Is it possible to load files onto the 4mb memory over USB mass storage?

Yes, the 4mb memory becomes a USB disk on your computer once the bootloader is active.

Do I have to format the external memory with a filesystem like FAT in order to use it? Or it is possible to bake arrays of data into it similar to using PROGMEM on an arduino?

You don’t need to format the external memory, that’s taken care of by the SAMD21 on the board. You can not store data in the external memory via PROGMEM in the Arduino IDE.

Excellent, thanks for explaining that.

You don’t need to format the external memory, that’s taken care of by the SAMD21 on the board.

Ok, from reading the samd21 uf2 github page it seems like it’s formatting the external memory with a FAT file system. So does this mean if I store a bitmap or text file on the external flash memory that I can read it from an arduino sketch using something like the FatFS library?

does this mean if I store a bitmap or text file on the external flash memory that I can read it from an arduino sketch using something like the FatFS library?

Interesting questions, and situations that were not considered during development! The flash was originally used as a way to program the SAMD without needing a hardware programmer rather than a way to save data.

Possibly? I’m not really sure, we’ve never tried to do something like that. The bootloader wipes the contents of the external flash at some point, but I don’t know if it does that when the bootloader starts or finishes. If it’s doing it when the bootloader starts, you could potentially drop your own files into the flash and then retrieve them once the sketch starts running. You’re going to have to give it a try and see what happens. Just know that if you enable bootloader later, you’re going to lose all that data.

Microsoft wrote the UF2 bootloader and may have more information on how it manipulates the external flash. Sadly we don’t know exactly what’s going on under the hood, we just know how to use the bootloader to get code from point A to point B where it can be executed.

Let us know what you find out with your experiments, I’m sure you’re not the only person with the same questions.