Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Library assumes onboard flash is always used on Pi Pico, prevents external memory from being used correctly. #183

Open
Patzlyk opened this issue Jan 4, 2025 · 1 comment
Labels

Comments

@Patzlyk
Copy link

Patzlyk commented Jan 4, 2025

Operating System

Others

IDE version

PlatformIO 3.3.3, VSCode 1.96.2

Board

Raspberry Pi Pico W

BSP version

Arduino-pico 4.4.1

SPIFlash Library version

5.0.1

Sketch as attached file if not stock example

sketch.zip

What happened ?

On line 64 of "Adafruit_SPIFlashBase.cpp", there is check for the RP2040 platform. If true, the onboard flash is automatically configured and the flash detection sequence is skipped. If an external SPI flash is being used, this assumption prevents it from being correctly recognized.
Disabling this check allows the library to work with external flash chips.
JEDEC ID, size, numPages and sectorCount are affected by this. Writing, reading and erasing works in my case.

Note this probably also happens on ESP32, however I could not test it.

How to reproduce ?

  1. Connect an external SPI flash module to the Pi Pico (W25QQ32BV)
  2. Define CUSTOM_CS and CUSTOM_SPI in flash_config.h
  3. Initialize the library
  4. Try to read the JEDEC ID

The output should be wrong, unless the platform check on line 64 of "Adafruit_SPIFlashBase.cpp" is disabled.

Debug Log as attached txt file

No response

Screenshots

Wrong output:
image
Correct output:
image

@Patzlyk Patzlyk added the Bug label Jan 4, 2025
@e2forlife
Copy link

I ran into the same issue. as a work around I commented out the Pico internal memory and let the lib code fall through to the non-pico variant. Attached my "patched" version that appears to work, but I admit I haven't tested everything :)

in AdafruitSPIFlashBase.cpp add at line 64 #if 0
On line 91 add #endif

Adafruit_SPIFlashBase.zip

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants