Voting resources, early voting, and poll worker information - VOTE. ... Adafruit is open and shipping.
0

ITSYBITSY M4 EXPRESS SPI Flash uses
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

ITSYBITSY M4 EXPRESS SPI Flash uses

by stevebennett on Tue Jul 28, 2020 11:09 am

Is there an overview of what the onboard SPI flash can be used for when running CircuitPython and any example code? Why was the chip included on this board?

stevebennett
 
Posts: 5
Joined: Tue Jul 28, 2020 10:53 am

Re: ITSYBITSY M4 EXPRESS SPI Flash uses

by adafruit_support_carter on Tue Jul 28, 2020 4:23 pm

See here:
https://learn.adafruit.com/circuitpytho ... on-storage

The SPI flash is used as a file storage system for user code and other assets, like image files. This frees up the memory on the processor for the CircuitPython firmware.

adafruit_support_carter
 
Posts: 16820
Joined: Tue Nov 29, 2016 2:45 pm

Re: ITSYBITSY M4 EXPRESS SPI Flash uses

by stevebennett on Wed Jul 29, 2020 4:25 am

Thanks for the info but how can I put code (CircuitPython) on the flash, I can only see a tiny 2Mb CIRCUITPY drive from my PC, it would be great to put the CP libraries onto flash as they pretty much fill the CIRCUITPY drive if all are loaded on? I've searched widely but can't find an overview of how to use the Flash with CP although there is a lot of info about using it with Aurduino code.

stevebennett
 
Posts: 5
Joined: Tue Jul 28, 2020 10:53 am

Re: ITSYBITSY M4 EXPRESS SPI Flash uses

by jerryn on Wed Jul 29, 2020 8:02 am

That " tiny" 2Mbyte file system is the SPI Flash chip. Are you loading the entire "bundle" to your /lib folder? That takes up a lot of unnecessary space. You can load the only the libraries you actually need.

from the guide
ATSAMD51G19A 32-bit Cortex M4 core running at 120 MHz
Hardware DSP and floating point support
512 KB flash, 192 KB RAM
2 MB SPI FLASH chip for storing files and CircuitPython code storage.

jerryn
 
Posts: 1291
Joined: Sat Sep 14, 2013 9:05 am

Re: ITSYBITSY M4 EXPRESS SPI Flash uses

by stevebennett on Wed Jul 29, 2020 10:10 am

Thank you, now I understand. So if I want to save data between power cycles I could use the NVM CPU Flash; how can this be accessed via CircuitPython, for read/write/erase?

stevebennett
 
Posts: 5
Joined: Tue Jul 28, 2020 10:53 am

Re: ITSYBITSY M4 EXPRESS SPI Flash uses

by adafruit_support_carter on Wed Jul 29, 2020 10:54 am


adafruit_support_carter
 
Posts: 16820
Joined: Tue Nov 29, 2016 2:45 pm

Re: ITSYBITSY M4 EXPRESS SPI Flash uses

by stevebennett on Wed Jul 29, 2020 11:46 am

Thank you. The following is (presumably) writing something to somewhere in CPU NVM, any explanation welcome, and how to read it back?
import microcontroller
microcontroller.nvm[0:3] = b"\xcc\x10\x00"

stevebennett
 
Posts: 5
Joined: Tue Jul 28, 2020 10:53 am

Re: ITSYBITSY M4 EXPRESS SPI Flash uses

by adafruit_support_carter on Wed Jul 29, 2020 12:58 pm

Code: Select all | TOGGLE FULL SIZE
value = microcontroller.nvm[0:3]

That will return a bytearray. The struct module can be useful for packing/unpacking specific variable types in/out of bytearrays.

The use of nvm here might be a good example:
https://github.com/adafruit/Adafruit_Le ... timeter.py

adafruit_support_carter
 
Posts: 16820
Joined: Tue Nov 29, 2016 2:45 pm

Re: ITSYBITSY M4 EXPRESS SPI Flash uses

by stevebennett on Wed Jul 29, 2020 1:08 pm

Very helpful, thank you.

stevebennett
 
Posts: 5
Joined: Tue Jul 28, 2020 10:53 am

Please be positive and constructive with your questions and comments.