Skip to content

rp2040: Use nvs fail. the prompt is written successfully, but cannot be read #95729

@zhang-wenchao

Description

@zhang-wenchao

Describe the bug

Use nvs demo, the prompt is written successfully, but cannot be read

Add overlay

samples/nvs/boards add pico overlay

rpi_pico.overlay

&flash0 {
	partitions {
		compatible = "fixed-partitions";
		#address-cells = <1>;
		#size-cells = <1>;

		code_partition: partition@100 {
			label = "code";
			reg = <0x100 (DT_SIZE_M(1) - 0x100)>;
			read-only;
		};

		storage_partition: partition@100000 {
			label = "storage";
			reg = <0x100000  DT_SIZE_M(1)>;
		};
	};
};

Erase flash

 /usr/local/bin/openocd -f interface/cmsis-dap.cfg -f target/rp2040.cfg -c "init; reset init; flash erase_sector 0 0 last; reset; exit"

Build and flash

west build -b rpi_pico samples/subsys/nvs -- -DRPI_PICO_DEBUG_ADAPTER=cmsis-dap -DOPENOCD=/usr/local/bin/openocd -DOPENOCD_DEFAULT_PATH=/usr/local/share/openocd/scripts && west flash

Trace Log

*** Booting Zephyr OS build v4.2.0-2084-g0fe091bc4691 ***
[00:00:00.003,000] <dbg> fs_nvs: nvs_recover_last_ate: Recovering last ate from sector 0
[00:00:00.016,000] <dbg> fs_nvs: nvs_add_gc_done_ate: Adding gc done ate at ff0
[00:00:00.044,000] <inf> fs_nvs: 3 Sectors of 4096 bytes
[00:00:00.048,000] <inf> fs_nvs: alloc wra: 0, fe8
[00:00:00.053,000] <inf> fs_nvs: data wra: 0, 0
No address found, adding 192.168.1.1 at id 1
No key found, adding it at id 2
No Reboot counter found, adding it at id 3
Id: 4 not found, adding it
Longarray not found, adding it as id 5
Reboot counter history: 
 Error, no Reboot counter
Rebooting in ...5...4...3...2...1
*** Booting Zephyr OS build v4.2.0-2084-g0fe091bc4691 ***
[00:00:00.003,000] <dbg> fs_nvs: nvs_recover_last_ate: Recovering last ate from sector 0
[00:00:00.016,000] <dbg> fs_nvs: nvs_add_gc_done_ate: Adding gc done ate at ff0
[00:00:00.048,000] <inf> fs_nvs: 3 Sectors of 4096 bytes
[00:00:00.051,000] <inf> fs_nvs: alloc wra: 0, fe8
[00:00:00.056,000] <inf> fs_nvs: data wra: 0, 0
No address found, adding 192.168.1.1 at id 1
No key found, adding it at id 2
No Reboot counter found, adding it at id 3
Id: 4 not found, adding it
Longarray not found, adding it as id 5
Reboot counter history: 
 Error, no Reboot counter
Rebooting in ...5...4...3...2...1
*** Booting Zephyr OS build v4.2.0-2084-g0fe091bc4691 ***
[00:00:00.003,000] <dbg> fs_nvs: nvs_recover_last_ate: Recovering last ate from sector 0
[00:00:00.016,000] <dbg> fs_nvs: nvs_add_gc_done_ate: Adding gc done ate at ff0
[00:00:00.047,000] <inf> fs_nvs: 3 Sectors of 4096 bytes
[00:00:00.050,000] <inf> fs_nvs: alloc wra: 0, fe8
[00:00:00.055,000] <inf> fs_nvs: data wra: 0, 0
No address found, adding 192.168.1.1 at id 1
No key found, adding it at id 2
No Reboot counter found, adding it at id 3
Id: 4 not found, adding it
Longarray not found, adding it as id 5
Reboot counter history: 
 Error, no Reboot counter
Rebooting in ...5...4...3...2...1
*** Booting Zephyr OS build v4.2.0-2084-g0fe091bc4691 ***
[00:00:00.003,000] <dbg> fs_nvs: nvs_recover_last_ate: Recovering last ate from sector 0
[00:00:00.016,000] <dbg> fs_nvs: nvs_add_gc_done_ate: Adding gc done ate at ff0
[00:00:00.046,000] <inf> fs_nvs: 3 Sectors of 4096 bytes
[00:00:00.049,000] <inf> fs_nvs: alloc wra: 0, fe8
[00:00:00.055,000] <inf> fs_nvs: data wra: 0, 0
No address found, adding 192.168.1.1 at id 1
No key found, adding it at id 2
No Reboot counter found, adding it at id 3
Id: 4 not found, adding it
Longarray not found, adding it as id 5
Reboot counter history: 
 Error, no Reboot counter
Rebooting in ...5...4...3...2...1
*** Booting Zephyr OS build v4.2.0-2084-g0fe091bc4691 ***
[00:00:00.003,000] <dbg> fs_nvs: nvs_recover_last_ate: Recovering last ate from sector 0
[00:00:00.016,000] <dbg> fs_nvs: nvs_add_gc_done_ate: Adding gc done ate at ff0
[00:00:00.046,000] <inf> fs_nvs: 3 Sectors of 4096 bytes
[00:00:00.049,000] <inf> fs_nvs: alloc wra: 0, fe8
[00:00:00.054,000] <inf> fs_nvs: data wra: 0, 0
No address found, adding 192.168.1.1 at id 1
No key found, adding it at id 2
No Reboot counter found, adding it at id 3
Id: 4 not found, adding it
Longarray not found, adding it as id 5
Reboot counter history: 
 Error, no Reboot counter
Rebooting in ...5...4...3...2...1
*** Booting Zephyr OS build v4.2.0-2084-g0fe091bc4691 ***
[00:00:00.003,000] <dbg> fs_nvs: nvs_recover_last_ate: Recovering last ate from sector 0
[00:00:00.016,000] <dbg> fs_nvs: nvs_add_gc_done_ate: Adding gc done ate at ff0
[00:00:00.045,000] <inf> fs_nvs: 3 Sectors of 4096 bytes
[00:00:00.049,000] <inf> fs_nvs: alloc wra: 0, fe8
[00:00:00.054,000] <inf> fs_nvs: data wra: 0, 0
No address found, adding 192.168.1.1 at id 1
No key found, adding it at id 2
No Reboot counter found, adding it at id 3
Id: 4 not found, adding it
Longarray not found, adding it as id 5
Reboot counter history: 
 Error, no Reboot counter
Rebooting in ...5...4...3...2...1
*** Booting Zephyr OS build v4.2.0-2084-g0fe091bc4691 ***
[00:00:00.003,000] <dbg> fs_nvs: nvs_recover_last_ate: Recovering last ate from sector 0
[00:00:00.016,000] <dbg> fs_nvs: nvs_add_gc_done_ate: Adding gc done ate at ff0
[00:00:00.045,000] <inf> fs_nvs: 3 Sectors of 4096 bytes
[00:00:00.048,000] <inf> fs_nvs: alloc wra: 0, fe8
[00:00:00.053,000] <inf> fs_nvs: data wra: 0, 0
No address found, adding 192.168.1.1 at id 1
No key found, adding it at id 2
No Reboot counter found, adding it at id 3
Id: 4 not found, adding it
Longarray not found, adding it as id 5
Reboot counter history: 
 Error, no Reboot counter
Rebooting in ...5...4...3...2...1
*** Booting Zephyr OS build v4.2.0-2084-g0fe091bc4691 ***
[00:00:00.003,000] <dbg> fs_nvs: nvs_recover_last_ate: Recovering last ate from sector 0
[00:00:00.016,000] <dbg> fs_nvs: nvs_add_gc_done_ate: Adding gc done ate at ff0
[00:00:00.044,000] <inf> fs_nvs: 3 Sectors of 4096 bytes
[00:00:00.048,000] <inf> fs_nvs: alloc wra: 0, fe8
[00:00:00.053,000] <inf> fs_nvs: data wra: 0, 0
No address found, adding 192.168.1.1 at id 1
No key found, adding it at id 2
No Reboot counter found, adding it at id 3
Id: 4 not found, adding it
Longarray not found, adding it as id 5
Reboot counter history: 
 Error, no Reboot counter
Rebooting in ...5...4...3...2...1
*** Booting Zephyr OS build v4.2.0-2084-g0fe091bc4691 ***
[00:00:00.003,000] <dbg> fs_nvs: nvs_recover_last_ate: Recovering last ate from sector 0
[00:00:00.016,000] <dbg> fs_nvs: nvs_add_gc_done_ate: Adding gc done ate at ff0
[00:00:00.044,000] <inf> fs_nvs: 3 Sectors of 4096 bytes
[00:00:00.047,000] <inf> fs_nvs: alloc wra: 0, fe8
[00:00:00.052,000] <inf> fs_nvs: data wra: 0, 0
No address found, adding 192.168.1.1 at id 1
No key found, adding it at id 2
No Reboot counter found, adding it at id 3
Id: 4 not found, adding it
Longarray not found, adding it as id 5
Reboot counter history: 
 Error, no Reboot counter
Rebooting in ...5...4...3...2...1

Metadata

Metadata

Assignees

Labels

RegressionSomething, which was working, does not anymorearea: FlashbugThe issue is a bug, or the PR is fixing a bugplatform: Raspberry Pi PicoRaspberry Pi Pico (RPi Pico)priority: lowLow impact/importance bug

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions