adafruit / Adafruit_QSPI

MIT License
7 stars 6 forks source link

fatfs_format example not working on M4 feather #5

Closed Macrosii closed 5 years ago

Macrosii commented 5 years ago

The Library Adafruit_QSPI has an example "fatfs_format which is supposed to format the internal flash as a FAT file system , but fails as below. The qspi_flash_test.ino example works fine so I know the board and Flash are ok.

Thanks for any Help.

Arduino IDE 1.8.8 Latest Adafruit SAMD boards as of 27FEB19 Adafruit_QSPI library 27FEB19 Adafruit_SPIFlash 27FEB19 JEDIC ID is reported as 0xC84015

Error Type OK (all caps) and press enter to continue. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Partitioning flash with 1 primary partition... Error, f_fdisk failed with error code: 1

ladyada commented 5 years ago

try the circuitpython FS? we dont use FAT so much actually :)

Macrosii commented 5 years ago

Thank you. Yes the circuitpython FS example works and you can access the file from Arduino. Thanks

MrBryonMiller commented 5 years ago

@Macrosii I opened identical issue here https://github.com/adafruit/Adafruit_SPIFlash/issues/10 I did it there because this used to work but stopped working with a commit to the AdaFruit_SPIFlash repo. I may be able to help track down why these two libraries are no longer compatible but in the meantime I believe you can make this work by using version 1.0.8 of that repo.

ladyada commented 5 years ago

ok for now the workaround is to use SPIFlash repo which will work with bitbang'd SPI

MrBryonMiller commented 5 years ago

A little more investigating : As I said, version 1.0.8 of SPI_Flash repo works but version 1.1.0 does not. I went through every change (there weren't that many) and found one that breaks it. Without the change for writeBuffer the two repos work together. The interface changed from virtual uint32_t writeBuffer (uint32_t address, uint8_t *buffer, uint32_t len); to uint32_t writeBuffer (uint32_t address, const uint8_t *buffer, uint32_t len);

and the definition changed from uint32_t Adafruit_SPIFlash::writeBuffer(uint32_t address, uint8_t *buffer, uint32_t len) to uint32_t Adafruit_SPIFlash::writeBuffer(uint32_t address, const uint8_t *buffer, uint32_t len)

I'm afraid I don't know enough about C/C++ to understand why this change was made or even what it means let alone any way to fix this repo to make them compatible.

ladyada commented 5 years ago

hmm dya want to try removing that const manually, and re-trying the demos? :)

MrBryonMiller commented 5 years ago

hmm dya want to try removing that const manually, and re-trying the demos? :)

yep, that's pretty much what I did. Using the fatfs_format example I found that I had to do two things - I had to remove the const (in both the .h & the .cpp) AND I had to reinsert the virtual (in the .h). Neither thing by itself would work.

ladyada commented 5 years ago

yeah please revert that and do another commit!

MrBryonMiller commented 5 years ago

PR submitted to the SPI repo

ladyada commented 5 years ago

s'done @Macrosii try now?

Macrosii commented 5 years ago

Yes tested on the M4 feather. Thanks