QT PY: 2Kb SPI Flash Access

CircuitPython on hardware including Adafruit's boards, and CircuitPython libraries using Blinka on host computers.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
Lansteys
 
Posts: 9
Joined: Sun Mar 03, 2019 9:22 pm

QT PY: 2Kb SPI Flash Access

Post by Lansteys »

Hi All,

I feel like I’m missing something obvious here, but I can’t seem to find any info on saving-to/reading-from the optional GD25Q16 - 2MB SPI Flash chip on a Adafruit QT Py - SAMD21 Dev Board using Circuit Python.

Project is basically a data logger with the need for data to be saved in non-volatile memory.
I hope someone can point me to an example or let me know if it’s something simple I’ve missed!

- Thanks

User avatar
Franklin97355
 
Posts: 23910
Joined: Mon Apr 21, 2008 2:33 pm

Re: QT PY: 2Kb SPI Flash Access

Post by Franklin97355 »


User avatar
Lansteys
 
Posts: 9
Joined: Sun Mar 03, 2019 9:22 pm

Re: QT PY: 2Kb SPI Flash Access

Post by Lansteys »

Thanks for that!

I’m just working through it now - though I can’t seem to identify the CS pin for the Flash chip…?
Seems to be pin 11, PA08 but I’m stuck on figuring out how to put that in this line:

Code: Select all

cs = digitalio.DigitalInOut(board.SD_CS)
‘board.SD_CS’ isn’t valid and I’m not sure what I need to replace this with. I haven’t found what PA08 is in ‘board’. Any clues?
Any help would be greatly appreciated!

User avatar
Lansteys
 
Posts: 9
Joined: Sun Mar 03, 2019 9:22 pm

Re: QT PY: 2Kb SPI Flash Access

Post by Lansteys »

Ok, minor update:

Code: Select all

cs = digitalio.DigitalInOut(microcontroller.pin.PA08)
Returns: “ValueError: PA08 in use”

I’ll keep trying to figure it out…

User avatar
tannewt
 
Posts: 3304
Joined: Thu Oct 06, 2016 8:48 pm

Re: QT PY: 2Kb SPI Flash Access

Post by tannewt »

After you've soldered the optional flash onto the QT Py you'll want to switch to the Haxpress board build of CircuitPython. It'll use the SPI for the filesystem and then you can follow this guide for datalogging: https://learn.adafruit.com/cpu-temperat ... uit-python

Flash info is here: https://learn.adafruit.com/adafruit-qt- ... 3073285-12

User avatar
Lansteys
 
Posts: 9
Joined: Sun Mar 03, 2019 9:22 pm

Re: QT PY: 2Kb SPI Flash Access

Post by Lansteys »

Hey, thanks for your reply!

Yes, have the Haxpress version installed. From memory the drive shows up with the full memory on my PC.
So if I understand correctly, there is no way to specifically save data to the Flash chip? Or is it that I can only save data to the Flash chip? (this would be OK)

I believe the Flash chip is rated for far more read/write cycles than the microcontrollers flash memory so it would be preferable to always use this.

User avatar
tannewt
 
Posts: 3304
Joined: Thu Oct 06, 2016 8:48 pm

Re: QT PY: 2Kb SPI Flash Access

Post by tannewt »

The haxpress version of CircuitPython will write to the external flash only. The non-haxpress version will write to the internal flash. There isn't a version that will do both.

I haven't heard of anyone wearing out their flash with CircuitPython.

User avatar
Lansteys
 
Posts: 9
Joined: Sun Mar 03, 2019 9:22 pm

Re: QT PY: 2Kb SPI Flash Access

Post by Lansteys »

Thanks again!

Yes, probably worried over nothing on that account, but that also answers my question - I don’t need to do anything special to utilise the external flash chip as long as the haxpress version of CP is installed.

Exactly what I needed to know - thanks!

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

Return to “Adafruit CircuitPython”