Radio¶
To interface with the radio present on the Botoks platform (ZL70550) we developed a rudimentary driver. This library is capable of executing calibration, transmitting and receiving packets.
First the driver needs to be initialized using zl70550_init()
next the
common registers have to be restored using zl70550_restore_state()
and
the operating frequency has to be set zl70550_set_frequency()
.
With the registers in the correct state now calibration can be executed
zl70550_calibrate()
.
Calibration is only executed once on the first boot, afterwards it applies the
previously determined calibration. This calibration is stored in FRAM.
After calibration the radio is fully operational and can transmit
zl70550_packet_transmit()
or receive zl70550_packet_receive()
.
-
void
zl70550_init
()¶ Initialize ZL70550
Initializes the GPIO and SPI to communicate with the ZL70550. Afterwards the ZL70550 is reset.
-
void
zl70550_restore_state
()¶ Restore the ZL70550’s registers to a know state
Initializes the common registers required for operation. Operating frequency still has to be configured separately. Needs to be executed after zl70550_init() but before the device is used.
-
void
zl70550_set_frequency
()¶ Set operation frequency
Sets the operating frequency to 869.7 Mhz. Needs to be executed after zl70550_init() but before the device is used.
-
void
zl70550_packet_receive
(uint8_t *rx_buffer, bool forever)¶ Receive packet
Function that can be used to receive a packet to a provided
rx_buffer
. Additionally it can operate in a perpetual loop with theforever
flag. Hamming encoding is enabled.- Parameters
rx_buffer
: Output: Buffer in which the data will be stored.forever
: Flag to signal a perpetual receive loop.
-
void
zl70550_packet_transmit
(uint8_t *data, uint16_t length)¶ Transmit a packet
Transmits the data contained in the
data
parameter with lengthlength
. CSMA is disabled and Hamming encoding is enabled.- Parameters
data
: Data to transmitlength
: Length of thedata
to transmit
-
void
zl70550_calibrate
()¶ ZL70550 Calibration Calibration routine
Execute the required calibration routine on the ZL70550. It calibrates the following:
Current reference
RCO
VCO amplitude
VCO frequency
Peak detector;
Antenna output
LNA
RC filter
FSK frequency deviation