0

unable to read/write the builtin SPI Flash
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

unable to read/write the builtin SPI Flash

by SirSydom on Sat Feb 16, 2019 4:22 pm

Hi fellow makers,

I got my ItsyBitsy M0 Express recently (it's my first SAMD21 based "Arduino" Board.

Where I got a lot of things figured out now, I don't get the SPI Flash working.
I dont want to use the circuitpython stuff.

So i tried the Arduino examples from Adafruit_SPIFlash lib, like mentioned in the user manual of the board.

With an unmodified circuitpython_backupFiles i get:

Code: Select all | TOGGLE FULL SIZE
21:12:14.723 -> Adafruit Express CircuitPython Flash Repair
21:12:14.723 -> Flash chip JEDEC ID: 0xFFFFFF
21:12:15.719 -> readBuffer failed!
21:12:15.719 -> f_mount failed with error code: 13
21:12:15.719 -> Failed to mount filesystem!
21:12:15.719 -> Was CircuitPython loaded on the board first to create the filesystem?


With fatfs_format i get:

Code: Select all | TOGGLE FULL SIZE
21:13:50.751 -> Adafruit SPI Flash FatFs Format Example
21:13:50.751 -> Flash chip JEDEC ID: 0xFFFFFF
21:13:50.751 -> !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
21:13:50.751 -> This sketch will ERASE ALL DATA on the flash chip and format it with a new filesystem!
21:13:50.751 -> Type OK (all caps) and press enter to continue.
21:13:50.751 -> !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
21:13:57.691 -> Partitioning flash with 1 primary partition...
21:13:58.691 -> Couldn't read sector before performing write!
21:13:58.691 -> Error, f_fdisk failed with error code: 1


when i double press reset button, I can access the flash on my PC over USB.

What's wrong here??

SirSydom
 
Posts: 5
Joined: Sat Feb 16, 2019 4:00 pm

Re: unable to read/write the builtin SPI Flash

by adafruit_support_mike on Sun Feb 17, 2019 4:35 am

What you see on the desktop isn't a FAT filesystem on the SPI Flash chip.

The UF2 bootloader uses the USB Mass Storage protocol to talk to the computer, but it isn't a real filesystem. The bootloader hijacks USB commands to read or write files and puts the information where it wants.

If you want to use the Adafruit_SPIFlash library, start with the fatfs_format example to create the filesystem.

adafruit_support_mike
 
Posts: 57106
Joined: Thu Feb 11, 2010 2:51 pm

Re: unable to read/write the builtin SPI Flash

by SirSydom on Sun Feb 17, 2019 5:57 am

adafruit_support_mike wrote:If you want to use the Adafruit_SPIFlash library, start with the fatfs_format example to create the filesystem.


As you can see in my previous post, I did try the fatfs_format example.
And as you can see, it doesn't work.

Looks like no one ever tried it it for that specific board before writing it down in in the manual.

SirSydom
 
Posts: 5
Joined: Sat Feb 16, 2019 4:00 pm

Re: unable to read/write the builtin SPI Flash

by cstratton on Thu Feb 21, 2019 2:55 pm

21:13:50.751 -> Flash chip JEDEC ID: 0xFFFFFF


Would seem to indicate that basic SPI communication with the flash chip is not working, either because the code is not aware of the hardware details of the board on which it is being used (SPI bus, chip select, SPI mode, etc) or because something is physically wrong.

Alas the downside of that tiny package means that the flash signals can't exactly be probed (apart from the chip select, which should be on R2 pullup if you can find that). Probably worth making sure the code is using the appropriate hardware details for the board itself. Or to test the hardware, perhaps try CircuitPython at least temporarily.

cstratton
 
Posts: 294
Joined: Wed Sep 29, 2010 3:52 pm

Please be positive and constructive with your questions and comments.