Skip to main content

Module packet

Module packet 

Source
Expand description

Encoding and decoding of ATECC608B command and response frames.

§Command frame layout (sent host to chip)

+---------+--------+---------+---------+-----------+---------+
|  Count  | Opcode | Param1  | Param2  |   Data... |  CRC16  |
|  (1 B)  | (1 B)  |  (1 B)  | (2 B,LE)|  (0..155) | (2 B,LE)|
+---------+--------+---------+---------+-----------+---------+

 ^                                                  ^
 |                                                  |
 +-- Count includes itself, the CRC, and ---------- +
     everything in between.

The byte sent before this frame on I2C is the “word address” crate::opcodes::WORD_ADDRESS_COMMAND (0x03). It is not part of the frame proper and is not covered by the CRC.

§Response frame layout (sent chip to host)

+---------+----------------+---------+
|  Count  |    Payload     |  CRC16  |
|  (1 B)  |   (Count-3 B)  | (2 B,LE)|
+---------+----------------+---------+

When the chip reports an error, the response is exactly 4 bytes: 04 <status> <crc_lo> <crc_hi>. The 1-byte status is one of the values mapped by crate::error::ChipError::from_status_byte.

Enums§

PacketBuildError 🔒
Errors that can arise while serializing a command frame.
PacketParseError 🔒
Errors that can arise while parsing a response frame.
ResponseFrame 🔒
A parsed and CRC-verified response frame.

Functions§

build_command_frame 🔒
Build a command frame into out and return the number of bytes written.
parse_response_frame 🔒
Parse a response frame.