A N 6 9 2
40
Rev 0.4
5.2.5. Bidirectional Variable Length Packet Based Communication
This example project uses the radio both in receive and transmit mode in order to establish a two-way link between
two demo boards. At startup, the radio is initialized according to the settings in
radio_config.h
file. The Packet
Handler in the radio is configured to receive variable length packets from the transmitter. The following table shows
the packet structure used in this example project.
The LENGTH field contains the information on how many byte the PAYLOAD size is. Following the PAYLOAD field,
there is a CRC field calculated over the LENGTH and PAYLOAD field to ensure error-free packet reception. The
radio is configured to produce interrupt signal the packet is successfully received or transmitted. This is done by
custom interrupt property setting in
radio_config.h
Once the radio and the MCU peripherals and IOs are initialized, a start RX command is issued to the radio.
The Human Machine Interface handler functions are scheduled in the 1 ms tasks.
The radio is in continuous RX state until a packet has been received or a button pressed event occurs.
If a button is pressed, a specific message is loaded to the radio’s TX FIFO and the radio changes its state to TX.
Depending on which button has been pressed, the PAYLOAD length will vary. After the transmission has been
done, the radio switches back to RX state and waits for acknowledge message from the other board. A certain LED
on the board blinks according to the pressed button.
When a packet is received while the radio is in RX state, the PAYLOAD field will be analyzed. If it contains a valid
message, the board sends back an acknowledge message and blinks its appropriate LED according to the button
pressed. If an acknowledge message was received by the transmitter node, it beeps its buzzer and blinks all LEDs
on the board. The
bRadio_Check_TX_RX()
function is used to check the radio interrupt status and read which
interrupt occurred.
The
DemoApp_Pollhandler()
is located outside the scheduled tasks in order to be able to respond quickly to the
radio interrupts. It checks if the radio has any pending interrupt.
A state machine has been implemented to handle the interrupts.
The type of the message received is determined from the LENGTH field information. When sending a variable
length packet, the length of the PAYLOAD must be written to the TX FIFO first, then the message to be sent. When
a packet received interrupt is pending, the
bRadio_Check_TX_RX()
function has already loaded the message
content in the
variableRadioPacket
array.
The validity of the packet has already been verified by the Packet Handler as the CRC verification enabled so it
guarantees the payload is error-free.
Preamble
Sync Word
Length
Payload
CRC
32–40 bit
16 bit
8 bit
N bit
16 bit
Summary of Contents for Si4455 Series
Page 8: ...AN692 8 Rev 0 4 Figure 6 Device Configuration Options ...
Page 22: ...AN692 22 Rev 0 4 Figure 21 Supply Current versus Time Diagram from Shutdown to RX State ...
Page 23: ...AN692 Rev 0 4 23 4 4 Radio Chip Waking Up Figure 22 Radio Wake Up Process ...
Page 35: ...AN692 Rev 0 4 35 Figure 32 Transmission Flowchart ...
Page 39: ...AN692 Rev 0 4 39 Figure 33 Reception Flowchart ...
Page 41: ...AN692 Rev 0 4 41 Figure 34 Bidirectional Variable Packet Example Project Flowchart ...
Page 47: ...AN692 Rev 0 4 47 Figure 41 Long Packet Transmission Flowchart ...
Page 48: ...AN692 48 Rev 0 4 Figure 42 Long Packet RX Flowchart ...