Skip to content

[nrf fromtree] bluetooth: mesh: fix BLOB IO flash write alignment for…#4057

Merged
rlubos merged 1 commit into
nrfconnect:mainfrom
alxelax:fix_nrf54l_mesh_dfu
May 12, 2026
Merged

[nrf fromtree] bluetooth: mesh: fix BLOB IO flash write alignment for…#4057
rlubos merged 1 commit into
nrfconnect:mainfrom
alxelax:fix_nrf54l_mesh_dfu

Conversation

@alxelax
Copy link
Copy Markdown
Contributor

@alxelax alxelax commented May 11, 2026

… non-erase devices

The wr_chunk function had a fast path for devices without explicit erase (e.g. nRF54L RRAM) that wrote chunk data directly without aligning the offset or size to the flash write block size. On RRAM with write-block-size=16, this caused -EINVAL from the flash driver for every chunk write since chunk_size (161) and most chunk offsets are not 16-byte aligned.

The failed writes caused the BLOB server to never mark chunks as received, resulting in block_status_rsp always reporting all chunks missing. This led to infinite retransmission of block 0 and eventual DFU timeout.

Fix by using a read-modify-write approach for non-erase devices: read existing data at the aligned boundaries, overlay the chunk data, and write back the full aligned buffer. This satisfies the driver's alignment requirements while preserving neighboring bytes.

(cherry picked from commit a9ad258)

… non-erase devices

The wr_chunk function had a fast path for devices without explicit erase
(e.g. nRF54L RRAM) that wrote chunk data directly without aligning the
offset or size to the flash write block size. On RRAM with
write-block-size=16, this caused -EINVAL from the flash driver for every
chunk write since chunk_size (161) and most chunk offsets are not
16-byte aligned.

The failed writes caused the BLOB server to never mark chunks as
received, resulting in block_status_rsp always reporting all chunks
missing. This led to infinite retransmission of block 0 and eventual
DFU timeout.

Fix by using a read-modify-write approach for non-erase devices:
read existing data at the aligned boundaries, overlay the chunk data,
and write back the full aligned buffer. This satisfies the driver's
alignment requirements while preserving neighboring bytes.

Signed-off-by: Aleksandr Khromykh <aleksandr.khromykh@nordicsemi.no>
(cherry picked from commit a9ad258)
@shanthanordic
Copy link
Copy Markdown

approved for scope,

@rlubos rlubos merged commit a053083 into nrfconnect:main May 12, 2026
13 checks passed
NordicBuilder added a commit to NordicBuilder/sdk-nrf that referenced this pull request May 12, 2026
Automatically created by action-manifest-pr GH action from PR:
nrfconnect/sdk-zephyr#4057

Signed-off-by: Nordic Builder <pylon@nordicsemi.no>
rlubos pushed a commit to nrfconnect/sdk-nrf that referenced this pull request May 12, 2026
Automatically created by action-manifest-pr GH action from PR:
nrfconnect/sdk-zephyr#4057

Signed-off-by: Nordic Builder <pylon@nordicsemi.no>
@alxelax alxelax deleted the fix_nrf54l_mesh_dfu branch May 12, 2026 11:29
ahasztag pushed a commit to ahasztag/sdk-nrf that referenced this pull request May 12, 2026
Automatically created by action-manifest-pr GH action from PR:
nrfconnect/sdk-zephyr#4057

Signed-off-by: Nordic Builder <pylon@nordicsemi.no>
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.

5 participants