adafruit / Adafruit_SPIFlash

Arduino library for external (Q)SPI flash device
MIT License
161 stars 86 forks source link

Can't change SPI clock frequency #124

Closed tipo1000 closed 10 months ago

tipo1000 commented 2 years ago

Operating System

Windows 10

IDE version

1.8.13

Board

Modified Adafruit Itsybitsy M0 express (SAMD21)

BSP version

Didn't find this...

SPIFlash Library version

3.11.0

Sketch as attached file if not stock example

SPI.beginTransaction(SPISettings(1000000, MSBFIRST, SPI_MODE0));  //This doesn't do anything
if (!flash.begin()) {
  Serial.println("Error, failed to initialize flash chip!");
  while(1) yield();
}
SPI.setClockDivider(4); //Tried different dividers but code just hangs...
if (!flash.begin()) {
  Serial.println("Error, failed to initialize flash chip!");
  while(1) yield();
}

What happened ?

I have modified Adafruit Itsybitsy M0 express (SAMD21) board. I removed FLASH chip on board and wired two 8MB FLASH chips via MUX.

Trying with example sketch "SdFat_format" formatting fails (SPI clock freq seems to be 12MHz) but checking chip ID works ( SPI clock freq seems to be 4MHz when this is done).

Adafruit SPI Flash FatFs Format Example
Flash chip JEDEC ID: 0xEF4017
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
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.
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Creating and formatting FAT filesystem (this takes ~60 seconds)...
Error, f_mount failed with error code: 13

Checking signals with oscilloscope there's some "roundness" in signals due to added capacitance, but it would work if I can change the clock freq to 4MHz or lower. How can I do this? I tried what I found in internet but those doesn't work.

Thanks, Tipo

How to reproduce ?

What should go here....

Debug Log as attached txt file

No response

Screenshots

No response

hathach commented 10 months ago

Modified Adafruit Itsybitsy M0 express (SAMD21)

board is not supported, unfortuately, since we don't have any way to reproduce this on a similar modified hardware.