Skip to main content

writable_words_in_block

Function writable_words_in_block 

Source
const fn writable_words_in_block(block: u8) -> &'static [u8]
Expand description

Set of word offsets (within a 32-byte config-zone block) that the chip’s Write command accepts in 4-byte mode.

Used only when can_write_block_in_one_transfer returns false. For blocks 1 and 3 this helper returns an empty slice; those blocks should be written with a single 32-byte transfer instead.

  • Block 0 : words 4..=7 are writable (chip-side bytes 16..32). Words 0..=3 (bytes 0..16) are the read-only factory area: serial number, RevNum, Reserved. Any write attempt is rejected by the chip with ParseError 0x03.
  • Block 2 : words 0..=4 and 6..=7 are writable. Word 5 (bytes 84..88) covers UserExtra, Selector, LockValue, and LockConfig. These are modified only via the dedicated UpdateExtra and Lock commands; the Write command rejects them. CryptoAuthLib’s calib_write_bytes_zone skips word 5 of block 2 explicitly with !(zone == ATCA_ZONE_CONFIG && cur_block == 2u && cur_word == 5u).

The slice is returned in ascending order of word offset; callers iterate in that order to match the wire sequence used by the reference library and pinned down by the corresponding integration tests.