-
Notifications
You must be signed in to change notification settings - Fork 35
Description
Hi Peter,
I am trying to use your driver for a university project, which will involve writing some data to a FLASH memory and then extracting it via the Pi Pico. The flash that I am using is W25Q32JVSSIQ and it passes all the tests well, except for the fstest(), for which I had to manually create a directory with the Pi in order for it to pass.
I installed flash_spi.py and bdevice_py on my pico and modified the code to fit my communication connections:
from machine import UART, Pin, SPI
import time, os
from flash_spi import FLASH
cspins = (Pin(1, Pin.OUT, value=1),)
flash = FLASH(SPI(0, baudrate=50_000_000, sck=Pin(2), mosi=Pin(3), miso=Pin(0)), cspins, size=4096)
Format the filesystem
os.VfsLfs2.mkfs(flash) # Omit this to mount an existing filesystem
os.mount(flash,'/fl_ext')
Everything works well, but from this point on I do not know how exactly to use this file system. I try to open and close a file in the flash:
Open File
file = open('fl_ext/DataRaw.dat', 'w')
###################################
Write the NMEA data into FLASH memory until memory is full
rxData = bytearray()
while time.ticks_ms() < 60 * 1000:
if uart1.any():
byte = uart1.read(1)
if byte == b'\n':
file.write(rxData.decode('UTF-8'))
rxData = bytearray() # Reset rxData variable
else:
rxData += byte
file.close()
But once I close it, the file system is lost, so I cannot extract the data that I have saved. Any tips?
Yordan