[nrf fromtree] bluetooth: mesh: fix BLOB IO flash write alignment for…#4057
Merged
Conversation
… 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)
omkar3141
approved these changes
May 11, 2026
ludvigsj
approved these changes
May 12, 2026
shanthanordic
approved these changes
May 12, 2026
|
approved for scope, |
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>
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
… 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)