Closed ParameshChary closed 5 years ago
What board is this on?
MEGA2560
my first example erase flash worked well but fatfs format not working . please suggest corrections any mistakes... Interfacing winbond W25Q16BV SPI CHIP with ARDUINO MEGA2560. thanking you.
The MEGA is a 5V board and the W25Q16BV is 2.7-3.6V. How are you doing level-shifting?
There may be software issues too - we've only tested this library in limited environments (SPI flash chips on our boards). We haven't tested it with AVR boards, just M0 and M4.
I am having the same problem.
I'm using Model: ItsyBitsy M0 Express Board-ID: SAMD21G18A-ItsyBitsy-v0
When running fatfs_format, this is the serial console:
Adafruit SPI Flash FatFs Format Example
Flash chip JEDEC ID: 0xFFFFFFFF
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
This sketch will ERASE ALL DATA on the flash chip and format it with a new filesystem!
Type OK (all caps) and press enter to continue.
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Partitioning flash with 1 primary partition...
Couldn't read sector before performing write!
Error, f_fdisk failed with error code: 1
I thought it was odd that the JDEC ID is 0xFFFFFFFF . . .
if you get no JEDEC it means the wiring/pinout isnt right. no ETA on when we'll get to this, the repo is undergoing a rewrite
I solved it. Was trying to communicate with internal flash, and on the ItsyBitsy M0 Express, SPI_INTERFACES_COUNT equals 2, which is expected, so SS and SS1 should both be defined.
However, #if !defined(SS1)
in the fatfs_format.ino
example evaluates as TRUE, which means that the FLASH_SS and FLASH_SPI_PORT are incorrect when trying to communicate with the internal flash. In fact, I checked if if SS1 is defined by printing to the serial, and I did in fact get a value (39 to be specific).
So the error is with the #if !defined(SS1)
statement.
A temporary fix was just to comment the #if statement, but I want to make you guys aware that there's an error here.
I have the same on a feather express M0, would this be the way to fix the code?:
total novice here...
//#if !defined(SS1) // #define FLASH_SS SS // Flash chip SS pin. // #define FLASH_SPI_PORT SPI // What SPI port is Flash on? // #define NEOPIN 8 //#else
//#endif
I tried martianzero code and it appears to have fixed the issue I was having with a new Feather M0 Express board. I no longer get JDEC ID is 0xFFFFFFFF, it now has a real value. I am having the same type of problem with an ItsyBitsy M4 Express board. I will try the same workaround and report back.
The Feather M0 Express documentation says the NeoPixel is connected to pin #8 in Arduino; so, I think the following edit is also required:
//#if !defined(SS1)
// #define FLASH_SS SS // Flash chip SS pin.
// #define FLASH_SPI_PORT SPI // What SPI port is Flash on?
#define NEOPIN 8
//#else
#define FLASH_SS SS1 // Flash chip SS pin.
#define FLASH_SPI_PORT SPI1 // What SPI port is Flash on?
//#define NEOPIN 40
//#endif
These values work for the ItsyBitsy M0. You will get a valid JDEC ID.
I tried both rickpetersoniont's and lfg6000's versions on my ItsyBitsy M0 Express and both worked. I'm not sure the NEOPIN value is even used. The NeoPixel looks like it is pin 5 on the ItsyBitsy M0 express.
I don't get it working on my Itsy Bitsy M0 Express with the changes proposed by Ifg6000:
=>
21:52:46.345 -> Adafruit Express CircuitPython Flash Repair 21:52:46.345 -> Flash chip JEDEC ID: 0x0 21:52:46.345 -> Error, failed to initialize flash chip!
latest version has fixed the SS1 detection - not sure how it even worked before but it should now! please try it, and re-open if you still have an issue!
flash :W25Q16BV Serial Monitor OP:
Adafruit SPI Flash FatFs Format Example Flash chip JEDEC ID: 0xEF Partitioning flash with 1 primary partition... Couldn't write updated sector! Error, f_fdisk failed with error code: 1
I am getting this error in fatfs format example.