Skip to content

Adafruit Feather RP2040 fixes #279

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

Conversation

sandeepmistry
Copy link

The following changes are based on information from the Adafruit forum: https://forums.adafruit.com/viewtopic.php?f=57&t=176745&p=860819&hilit=rp2040#p860819

The pre-built CircuitPython .uf2 was working on my board, but none of the pico-examples were without the following SDK changes.

  1. The board has 8 MB of flash according to the product page: https://www.adafruit.com/product/4884

  2. CircultPython sets PICO_FLASH_SPI_CLKDIV to 4: https://github.com/adafruit/circuitpython/blob/main/ports/raspberrypi/Makefile#L237

  3. CircultPython uses boot2_generic_03h.S for boot2: https://github.com/adafruit/circuitpython/blob/main/ports/raspberrypi/Makefile#L236

There's probably a better have a board specific PICO_DEFAULT_BOOT_STAGE2_FILE value instead of editing src/rp2_common/boot_stage2/CMakeLists.txt - but I wanted to get the discussion going :)

@hathach
Copy link
Contributor

hathach commented Mar 23, 2021

I encounter the issue with PICO_DEFAULT_BOOT_STAGE2_FILE as well, but not sure how to fix it. sdk probably need to have a way for board to specify its bootstage2. Currently it is done at application CMakeLists.txt

@lurch
Copy link
Contributor

lurch commented Mar 24, 2021

See #275 😉
Also, it's (apparently) possible to have a board-specific cmake file in addition to / instead of a board-specific header file.

@kilograham
Copy link
Contributor

Yup, for PICO_BOARD=foo you can create a foo.cmake in boards/ or in another path set via PICO_BOARD_CMAKE_DIRS an that will be used to configure the build (including adding the board header to PICO_CONFIG_HEADER_FILES)... not too bad really, but the issue @lurch linked above will mean that you can just do it via your board header which is much easier

@sandeepmistry
Copy link
Author

@lurch @kilograham thanks for the link to #275 (and apologies for not taking a look at the issue list prior to opening this PR).

Would you prefer I drop commit 57e51b4 from this pull request? Alternatively, as an interim solution, would it make sense for the default in src/rp2_common/boot_stage2/CMakeLists.txt to be boot2_generic_03h.S as this seems to be the plan in #275.

@brentru
Copy link

brentru commented Mar 24, 2021

@sandeepmistry Thanks for the PR, I was able to get blink/ from the examples working properly.

@tannewt
Copy link
Contributor

tannewt commented Mar 24, 2021

Thanks for opening this PR! I was just about to look at this myself.

  1. CircultPython uses boot2_generic_03h.S for boot2: https://github.com/adafruit/circuitpython/blob/main/ports/raspberrypi/Makefile#L236

I just changed this. We now use our own templated C stage2 code that pulls flash info from our nvm.toml repo. This separates out the init code from specific flash skus. (It also uses 0xe7 quad word read which is 2 dummy cycles instead of 0xeb's four cycles.)

One reason the boot2_w25q080.S stage2 doesn't work because GigaDevice flash on the feather doesn't support two byte status register writes with the 0x01 command. Instead it supports 0x31 which writes the second status register byte directly. The Winbond chips support this too and it seems to be the trend. (0x01 on the winbond says it's backwards compatible to support two byte writes.)

I'd expect the 2 divisor to work with the quad setup after QE has been set. (The datasheet says commands work up to 80mhz.) However, it seems to be unreliable and the 4 divisor is a much safer bet.

@kilograham
Copy link
Contributor

@lurch @kilograham thanks for the link to #275 (and apologies for not taking a look at the issue list prior to opening this PR).

Would you prefer I drop commit 57e51b4 from this pull request? Alternatively, as an interim solution, would it make sense for the default in src/rp2_common/boot_stage2/CMakeLists.txt to be boot2_generic_03h.S as this seems to be the plan in #275.

I've move #275 into our next bug fix release, so nothing going to happen b4 then - yes please remove 57e4 tho (and rebase to develop-1.1.1)

@sandeepmistry sandeepmistry force-pushed the adafruit_feather_rp2040-fixes branch from 57e51b4 to 3b24055 Compare March 25, 2021 13:17
@sandeepmistry sandeepmistry changed the base branch from master to develop-1.1.1 March 25, 2021 13:17
@sandeepmistry
Copy link
Author

I've move #275 into our next bug fix release, so nothing going to happen b4 then - yes please remove 57e4 tho (and rebase to develop-1.1.1)

@kilograham done, please let me know if anything needs to be changed in this PR.

@hathach
Copy link
Contributor

hathach commented Mar 25, 2021

See #275
Also, it's (apparently) possible to have a board-specific cmake file in addition to / instead of a board-specific header file.

Thanks @lurch That is great to know that we can add board-specific cmake file. while waiting for #275 should I add cmake for Feather rp2040 to dictate the boot stage2, or just wait for it since header only is nicer I guess.

@kilograham
Copy link
Contributor

subsumed by #293

@kilograham kilograham closed this Mar 31, 2021
@kilograham
Copy link
Contributor

note 1.1.1 has been released which should fix feather issues

aswild added a commit to aswild/pico-sdk that referenced this pull request Apr 17, 2022
The GD25Q64C flash on the Feather board doesn't support two-byte writes
to the status register with the 01h command, instead it needs a 31h
command to write the 2nd status register byte. Besides that, it's
totally compatible with the Pico's W25Q080 flash.

Add a new PICO_FLASH_SUPPORTS_WRITE_STATUS2 config option that changes
the boot2 code to use 31h to write the status command. With this the
Feather is able to run in fast QSPI mode rather than 4x slower single
SPI mode (this difference is measurable in test code).

Also double the SPI clock speed, using a clock divider of 2 rather than
4. The Feather seems to work fine with a divider of 2 in my testing.

Much thanks to [1] for identifying what needs to change.

[1] raspberrypi#279 (comment)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants