Wrong read from settings_storage flash in nRF52840 and nRF Connect SDK 2.4.1

Hi,

I have an example based on v2.4.1\nrf\samples\bluetooth\peripheral_lbs

This is my prj.conf

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# Flash
CONFIG_FLASH=y
CONFIG_FLASH_MAP=y
CONFIG_FLASH_PAGE_LAYOUT=y
CONFIG_MPU_ALLOW_FLASH_WRITE=y
# Bluetooth
CONFIG_BT=y
CONFIG_BT_PERIPHERAL=y
CONFIG_BT_DEVICE_NAME="Intonavi"
# FOTA
CONFIG_BOOTLOADER_MCUBOOT=y
CONFIG_NCS_SAMPLE_MCUMGR_BT_OTA_DFU=y
CONFIG_SECURE_BOOT=y
CONFIG_SB_SIGNING_KEY_FILE="d:/NordicSemiconductor/apps/ble_ota2/priv-ecdsa.pem"
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

this is my pm_static.yml, this is copy from file: build/partitions.yml

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
EMPTY_0:
address: 0x15200
end_address: 0x16000
placement:
before:
- s1_pad
region: flash_primary
size: 0xe00
EMPTY_1:
address: 0x22200
end_address: 0x23000
placement:
before:
- mcuboot_pad
region: flash_primary
size: 0xe00
EMPTY_2:
address: 0xf5000
end_address: 0xf6000
placement:
after:
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

I init parametres for settings_storage of flash

Fullscreen
1
2
#define DATA_PARTITION_OFFSET FIXED_PARTITION_OFFSET (settings_storage)
#define DATA_PARTITION_DEVICE FIXED_PARTITION_DEVICE (settings_storage)
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Now i do the following:

Build, Flash, with flash_erease, flash_write and flash_read. This is my console log

Flash is ready
Test 1: Flash erase page at 0xf6000
Flash erase succeeded!
Attempted to write 12c at 0xf6000
Data read: 12c | 300, at 0xf6000
Attempted to write 64 at 0xf6004
Data read: 64 | 100, at 0xf6004
Attempted to write 1 at 0xf6008
Data read: 1 | 1, at 0xf6008
Attempted to write 2 at 0xf600c
Data read: 2 | 2, at 0xf600c

Next step. Comment flash_erease and flash_write, only flash_read is active. Build and Flash device. This is my console log

Flash is ready
Data read: b8397b06 | -1204192506, at 0xf6000
Data read: 689acd9a | 1754975642, at 0xf6004
Data read: 615433a5 | 1632908197, at 0xf6008
Data read: 4293d3ff | 1116984319, at 0xf600c

Why values are different?

When I use storage_partition and hard address 0xf8000 everyfing is ok, after write all next reads have corrected values.