Texas Instruments CC2650DK Benutzerhandbuch

Seite von 1570
:Sender
:Receiver
Send size of packet
Send byte 1
Send byte N
Wait for nonzero data,
read size
Get checksum
Get packet data
Calc packet checksum,
Signal result
Await ACK
Send ACK
Send packet checksum
Bootloader Interfaces
8.2.1 Packet Handling
The bootloader uses well-defined packets to ensure reliable communications with the external
communicating program. All communications—with the exception of the UART auto-baud (see
UART Transport)—use these well-defined packets. The packets are always
acknowledged or not acknowledged by the communicating devices with defined ACK/NACK bytes.
The packets use the same format for receiving and sending packets. This format includes the method to
acknowledge successful or unsuccessful reception of a packet.
While the actual signaling on the serial ports is different, the packet format remains the same for
supported UART and SSI interfaces.
Packet send and packet receive must adhere to the simple protocol shown in
.
Figure 8-1. Sequence Diagram for Send and Receive Protocol
To successfully send a packet, the following steps must be performed:
1. Send the size of the packet that will be sent to the device. The size is always the size of the data + 2
with truncation to 8 bits.
2. Send the checksum of the data buffer to ensure proper transmission of the command. The checksum
algorithm is a sum of the data bytes.
3. Send the actual data bytes.
4. Wait for a single-byte acknowledgment from the device that the data was properly received or that a
transmission error was detected.
To successfully receive a packet, the following steps must be performed:
1. Wait for nonzero data to be returned from the device. This is important as the device may send zero
bytes between a sent and a received data packet. The first nonzero byte received will be the size of
the packet that is being received.
2. Read the next byte, which is the checksum for the packet.
3. Read the data bytes from the device. During the data phase, packet size minus 2 bytes will be sent.
For example, if the packet size was 3, then there is only 1 byte of data to be received.
4. Calculate the checksum of the data bytes and verify it matches the checksum received in the packet.
5. Send an acknowledge or not-acknowledge to the device to indicate the successful or unsuccessful
reception of the packet.
Acknowledge (ACK) bytes are sent out whenever a packet is successfully received and verified by the
receiver. A not-acknowledge (NAK) byte is sent out whenever a sent packet is detected to have an error,
usually as a result of a checksum error or just malformed data in the packet, which allows the sender to
re-transmit the previous packet.
673
SWCU117A – February 2015 – Revised March 2015
Bootloader
Copyright © 2015, Texas Instruments Incorporated