Using SPI Flash with CircuitPython for Logging - itsybitsy M4

Please tell us which board you are using.
For CircuitPython issues, ask in the Adafruit CircuitPython forum.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
LuckyPenny
 
Posts: 6
Joined: Fri Nov 04, 2016 3:40 am

Using SPI Flash with CircuitPython for Logging - itsybitsy M4

Post by LuckyPenny »

Hello,

I have an application where I need to use the itsybitsy M4 SPI Flash (2MB) with CircuitPython to log and read data back.

I cannot find any circuitPython examples on how to initialize the SPI flash and use it to write to a file which receives a data log append to the file every hour. Then, periodically (weekly, monthly, or longer) read the data from the SPI Flash and forward it to a host server.

Is there anyway someone can provide me the circuitpython code to initialize, write to a file, and read the file back. The file can just have some text like "Hello-data log" and read it back.

I have searched all over for an example but can not find a reference to this type of data store. No need to access the data from the Arduino side - just circuitpython.

I am using the latest bootloader and circuitpython (8.x.x).

Thank you very much in advance.
Gary

User avatar
dastels
 
Posts: 15655
Joined: Tue Oct 20, 2015 3:22 pm

Re: Using SPI Flash with CircuitPython for Logging - itsybitsy M4

Post by dastels »

You can create and write to a file on the flash filesystem without worrying about the details of the physical SPI flash. See https://learn.adafruit.com/circuitpytho ... on-storage.

Dave

User avatar
LuckyPenny
 
Posts: 6
Joined: Fri Nov 04, 2016 3:40 am

Re: Using SPI Flash with CircuitPython for Logging - itsybitsy M4

Post by LuckyPenny »

Thank you for the quick response - Dave,

Does it automatically use the SPI Flash as an extension of the board flash?

Can I just read/write to the SPI Flash as a separate resource without worrying about access from the USB connected computer?

User avatar
LuckyPenny
 
Posts: 6
Joined: Fri Nov 04, 2016 3:40 am

Re: Using SPI Flash with CircuitPython for Logging - itsybitsy M4

Post by LuckyPenny »

My desire is to use the SPI Flash as a separate and independent resource for logging and not use the internal flash of the device for storage. I have already used the link above to handle the mutual exclusion of only the CircuitPy using the storage OR the USB connected computer using the storage. I need to find out if the SPI Flash is really an independent resource like and SD card or other external storage.

Is this possible?

User avatar
dastels
 
Posts: 15655
Joined: Tue Oct 20, 2015 3:22 pm

Re: Using SPI Flash with CircuitPython for Logging - itsybitsy M4

Post by dastels »

Unsure, but it is used as storage for the flash drive. I suspect you would need to make a custom build of CircuitPython that doesn't use the SPI flash as filesystem space.

Dave

Locked
Please be positive and constructive with your questions and comments.

Return to “Itsy Bitsy Boards”