Incorrect PICO_FLASH_SPI_CLKDIV for WaveShare RP2040-Zero #1304

Closed
opened 2023-03-10 17:33:56 -06:00 by ArkBrj · 6 comments
ArkBrj commented 2023-03-10 17:33:56 -06:00 (Migrated from github.com)

src\boards\include\boards\waveshare_rp2040_zero.h sets PICO_FLASH_SPI_CLKDIV to 2.
However, according to the board schematics (https://www.waveshare.com/w/upload/4/4c/RP2040_Zero.pdf), this board uses Winbond W25Q16JVUXIQ chip. According to the chip's datasheet (https://www.winbond.com/resource-files/w25q16jv%20spi%20revh%2004082019%20plus.pdf), its max Clock frequency for Read Data instruction (03h) is 50 MHz (Section 10.6 AC Electrical Characteristics). PICO_FLASH_SPI_CLKDIV of 2 sets the clock to around 60 MHz exceeding the spec.
In my experiments with various binaries I see that the code always works right after flashing it, but does not work after restarting the board. This includes the officially released binary for picoprobe.
For home-built projects Debug binaries sometimes work even after reset but Release do not. Sometimes even Debug binaries do not work after reset.
CircuitPython works fine because it uses PICO_FLASH_SPI_CLKDIV of 4 (confirmed by disassembling the binary).
I think PICO_FLASH_SPI_CLKDIV should be set to 4 in SDK for this board.

src\boards\include\boards\waveshare_rp2040_zero.h sets PICO_FLASH_SPI_CLKDIV to 2. However, according to the board schematics (https://www.waveshare.com/w/upload/4/4c/RP2040_Zero.pdf), this board uses Winbond W25Q16JVUXIQ chip. According to the chip's datasheet (https://www.winbond.com/resource-files/w25q16jv%20spi%20revh%2004082019%20plus.pdf), its max Clock frequency for Read Data instruction (03h) is 50 MHz (Section 10.6 AC Electrical Characteristics). PICO_FLASH_SPI_CLKDIV of 2 sets the clock to around 60 MHz exceeding the spec. In my experiments with various binaries I see that the code always works right after flashing it, but does not work after restarting the board. This includes the officially released binary for picoprobe. For home-built projects Debug binaries sometimes work even after reset but Release do not. Sometimes even Debug binaries do not work after reset. CircuitPython works fine because it uses PICO_FLASH_SPI_CLKDIV of 4 (confirmed by disassembling the binary). I think PICO_FLASH_SPI_CLKDIV should be set to 4 in SDK for this board.
AlynxZhou commented 2023-06-11 02:52:42 -05:00 (Migrated from github.com)

I meet this problem too with 2 of 3 RP2040-Zeros I bought, a interesting thing is I found setting PICO_XOSC_STARTUP_DELAY_MULTIPLIER to 64 also fixes this bug, I think it makes program waits longer before startup.

But your words are more reasonable, and I tried your suggestion, it does fix the bug, so I submit a PR according to this issue. Thanks!

I meet this problem too with 2 of 3 RP2040-Zeros I bought, a interesting thing is I found setting `PICO_XOSC_STARTUP_DELAY_MULTIPLIER` to `64` also fixes this bug, I think it makes program waits longer before startup. But your words are more reasonable, and I tried your suggestion, it does fix the bug, so I submit a PR according to this issue. Thanks!
lurch commented 2023-06-11 13:40:02 -05:00 (Migrated from github.com)

In case it's useful, see the related discussion in #401

In case it's useful, see the related discussion in #401
AlynxZhou commented 2023-06-11 13:55:10 -05:00 (Migrated from github.com)

In case it's useful, see the related discussion in #401

Thanks!

My test shows that only change PICO_FLASH_SPI_CLKDIV to 4 is enough, there is no need to change both PICO_FLASH_SPI_CLKDIV and PICO_XOSC_STARTUP_DELAY_MULTIPLIER.

> In case it's useful, see the related discussion in #401 Thanks! My test shows that only change `PICO_FLASH_SPI_CLKDIV` to 4 is enough, there is no need to change both `PICO_FLASH_SPI_CLKDIV` and `PICO_XOSC_STARTUP_DELAY_MULTIPLIER`.
kilograham commented 2023-12-15 07:38:40 -06:00 (Migrated from github.com)

merged into develop

merged into develop
zwenergy commented 2025-04-09 01:45:33 -05:00 (Migrated from github.com)

Sorry to bring this old thing back up, but I just stumbled over this. As far as I can see the Flash chip used by the RP2040-Zero board is the same chip used by the regular Pi Pico board (both use the W25Q16JVUXIQ?). So this shouldn't be a direct issue of the Flash chip?

Please correct me if I'm wrong!

Sorry to bring this old thing back up, but I just stumbled over this. As far as I can see the Flash chip used by the RP2040-Zero board is the same chip used by the regular Pi Pico board (both use the W25Q16JVUXIQ?). So this shouldn't be a direct issue of the Flash chip? Please correct me if I'm wrong!
Taranus commented 2025-07-04 03:52:11 -05:00 (Migrated from github.com)

I agree with zwenergy. In the schematics, both the RP2040-Zero and the official Pico indicate the same reference W25Q16JVUXIQ.
And the marking on the actual chips also states the same (1Pyww). 1P430 on my zero, and 1P113 on my Pico.

I agree with [zwenergy](https://github.com/zwenergy). In the schematics, both the RP2040-Zero and the official Pico indicate the same reference W25Q16JVUXIQ. And the marking on the actual chips also states the same (1Pyww). 1P430 on my zero, and 1P113 on my Pico.
Sign in to join this conversation.
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
gh-raspberrypi/pico-sdk#1304
No description provided.