Hardware reset corrupts __uninitialized_ram() variable on Pico2 but not Pico #2203

Open
opened 2025-01-21 13:51:05 -06:00 by UKTailwind · 4 comments
UKTailwind commented 2025-01-21 13:51:05 -06:00 (Migrated from github.com)

I save information in a variable defined as follows:
uint64_t __uninitialized_ram(_persistent);

On the RP2040 Pico this survives both a H/W reset (switch) and a watchdog reset
On the RP2350 it is corrupted by a H/W reset but works as expected with a watchdog reset

sdk 2.1.0, GCC 13.3.1, VSCode on W11

I save information in a variable defined as follows: uint64_t __uninitialized_ram(_persistent); On the RP2040 Pico this survives both a H/W reset (switch) and a watchdog reset On the RP2350 it is corrupted by a H/W reset but works as expected with a watchdog reset sdk 2.1.0, GCC 13.3.1, VSCode on W11
lurch commented 2025-01-21 19:11:24 -06:00 (Migrated from github.com)

See the comments in this issue: https://github.com/raspberrypi/pico-sdk/issues/2043

See the comments in this issue: https://github.com/raspberrypi/pico-sdk/issues/2043
UKTailwind commented 2025-01-22 02:43:53 -06:00 (Migrated from github.com)

Sorry, but that didn't mean anything to me unless it simply confirms that the RP2350 overwrites RAM whereas the RP2040 doesn't.
On all the STM32 I've used this technique works without issue like the RP2040

Sorry, but that didn't mean anything to me unless it simply confirms that the RP2350 overwrites RAM whereas the RP2040 doesn't. On all the STM32 I've used this technique works without issue like the RP2040
lurch commented 2025-01-22 03:23:41 -06:00 (Migrated from github.com)

Sorry, but that didn't mean anything to me unless it simply confirms that the RP2350 overwrites RAM whereas the RP2040 doesn't.

Yes, exactly. "Ah, the problem is more fundamental than that: asserting the RUN pin powers down the memories, and they power back up when it's released." and "(The whole point of RUN is to be a global reset, and RAM being retained on RP2040 was just due to the lack of power gating on the RAMs.)".
So it's not so much "RP2350 overwrites RAM" but "RP2350 forgets the value of the RAM contents when you do a hardware reset".

> Sorry, but that didn't mean anything to me unless it simply confirms that the RP2350 overwrites RAM whereas the RP2040 doesn't. Yes, exactly. "Ah, the problem is more fundamental than that: asserting the RUN pin powers down the memories, and they power back up when it's released." and "(The whole point of RUN is to be a global reset, and RAM being retained on RP2040 was just due to the lack of power gating on the RAMs.)". So it's not so much "RP2350 overwrites RAM" but "RP2350 forgets the value of the RAM contents when you do a hardware reset".
UKTailwind commented 2025-01-22 03:31:09 -06:00 (Migrated from github.com)

asserting the RUN pin powers down the memories

I think that is a design mistake - certainly haven't seen it in other processors I've used STM32, PIC32 etc.

> asserting the RUN pin powers down the memories I think that is a design mistake - certainly haven't seen it in other processors I've used STM32, PIC32 etc.
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#2203
No description provided.