Skip to content

Send release power-down (0xAB) instruction, to revive flash, that might be in power-down state #2130

New issue

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

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

Already on GitHub? # to your account

Open
wants to merge 21 commits into
base: develop
Choose a base branch
from

Conversation

matsobdev
Copy link

It fixes #2111 of RP2350, by adding 0xAB instruction before communicating with flash device, ex. when restarting from flash by powman. Flash might be put in power-down state before and will only respond to 0xAB.

Send release power-down (0xAB) instruction, to revive flash, that might be in power-down state
Send release power-down (0xAB) instruction, to revive flash, that might be in power-down state
@lurch
Copy link
Contributor

lurch commented Dec 8, 2024

Should this be gated behind a #ifdef setting, since I guess this will only be needed by executables that have explicitly powered-down the flash?

@matsobdev
Copy link
Author

Sounds like a right direction. Is there a naming scheme to follow?

@lurch
Copy link
Contributor

lurch commented Dec 10, 2024

Sounds like a right direction. Is there a naming scheme to follow?

Naming scheme is generally PICO_SOME_THING - see section 5.1 of https://datasheets.raspberrypi.com/pico/raspberry-pi-pico-c-sdk.pdf for a big list of examples 🙂

Add `PICO_BOOT_STAGE2_FLASH_RELEASE_POWERDOWN` definition, to conditionally execute `0xAB` command
Add `PICO_BOOT_STAGE2_FLASH_RELEASE_POWERDOWN` definition, to conditionally execute `0xAB` command
Add `PICO_BOOT_STAGE2_FLASH_RELEASE_POWERDOWN` definition, to conditionally execute `0xAB` command
Conditionally (using `PICO_BOOT_STAGE2_FLASH_RELEASE_POWERDOWN`) send release power-down (0xAB) instruction, to revive flash, that might be in power-down state
Conditionally (using `PICO_BOOT_STAGE2_FLASH_RELEASE_POWERDOWN`) send release power-down (0xAB) instruction, to revive flash, that might be in power-down state
Conditionally (using `PICO_BOOT_STAGE2_FLASH_RELEASE_POWERDOWN`) send release power-down (0xAB) instruction, to revive flash, that might be in power-down state
Conditionally (using `PICO_BOOT_STAGE2_FLASH_RELEASE_POWERDOWN`) send release power-down (0xAB) instruction, to revive flash, that might be in power-down state
Add `PICO_BOOT_STAGE2_FLASH_RELEASE_POWERDOWN` definition, to conditionally execute `0xAB` command
@matsobdev
Copy link
Author

matsobdev commented Jan 22, 2025

I've updated it, extended to RP2040, but now it is not picking up PICO_BOOT_STAGE2_FLASH_RELEASE_POWERDOWN :D I'll work on it.

Fixing copy-paste glitch
Fixing copy-paste glitch
Review change of `PICO_BOOT_STAGE2_FLASH_RELEASE_POWERDOWN`
Review change of `PICO_BOOT_STAGE2_FLASH_RELEASE_POWERDOWN`
@matsobdev
Copy link
Author

matsobdev commented Jan 22, 2025

Now I know, why PICO_BOOT_STAGE2_FLASH_RELEASE_POWERDOWN was unreachable. Since there are two artefacts (if I wrap my head around it right way) built and boot stage 2 is the one of them, then it requires its own target_compile_definitions:

target_compile_definitions(bs2_default PRIVATE
	PICO_BOOT_STAGE2_FLASH_RELEASE_POWERDOWN=1
	)
target_compile_definitions(my_program PRIVATE
	PICO_EMBED_XIP_SETUP=1
	)

Maybe very beginning of chapter 5. of https://datasheets.raspberrypi.com/pico/raspberry-pi-pico-c-sdk.pdf requires then a word about bs2_default?

PS. boot2_at25sf128a and boot2_w25q080.S of RP2040 are now 252 bytes in size.

@lurch
Copy link
Contributor

lurch commented Jan 23, 2025

It doesn't have much documentation yet, but PICO_EMBED_XIP_SETUP is also mentioned in a few other issues and PRs.

@matsobdev
Copy link
Author

matsobdev commented Jan 23, 2025

Yes, PICO_EMBED_XIP_SETUP is a key to get boot stage 2 on RP2350, where it might benefit the most from that 10 uA, but I was thinking about:

target_compile_definitions(bs2_default PRIVATE
	PICO_BOOT_STAGE2_FLASH_RELEASE_POWERDOWN=1
	)

since PICO_BOOT_STAGE2_FLASH_RELEASE_POWERDOWN will be accessible only, when target(ing)_compile_definitions of bs2_default. Root my_program, for basicly user's code won't reach that and PICO_BOOT_STAGE2_FLASH_RELEASE_POWERDOWN is useless then.

@kilograham kilograham added this to the 2.2.0 milestone Jan 31, 2025
# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants