Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
SX1232 Class Reference
FSK radio transceiver for 800/900MHz. More...
#include <sx1232.h>
Public Member Functions | |
| SX1232 (PinName mosi, PinName miso, PinName sclk, PinName cs, PinName rst, PinName dio_0) | |
| Create SX1232 instance. | |
| void | set_rx_dcc_bw_hz (uint32_t dccValue, uint32_t bw_hz) |
| set receiver bandwidth | |
| uint32_t | get_rx_bw_hz (uint8_t addr) |
| get receiver bandwidth | |
| void | set_frf_MHz (float MHz) |
| set center operating frequency | |
| float | get_frf_MHz (void) |
| get center operating frequency | |
| void | set_bitrate (uint32_t bps) |
| set over-the-air bitrate | |
| uint32_t | get_bitrate (void) |
| get over-the-air bitrte | |
| void | set_tx_fdev_hz (uint32_t hz) |
| set transmitted frequency deviation | |
| uint32_t | get_tx_fdev_hz (void) |
| get transmitted frequency deviation | |
| void | enable_afc (char enable) |
| enable AFC with preamble detector | |
| void | set_RegPayloadLength (uint16_t len) |
| write payload length | |
| uint16_t | get_PayloadLength (void) |
| read payload length | |
| void | start_tx (uint8_t len) |
| transmit a packet | |
| void | start_rx (void) |
| start receive mode | |
| int | read_fifo (void) |
| Called by main program when indicated by service_action variable, to pull recevied packet from radio FIFO. | |
| void | hw_reset (void) |
| reset radio using pin | |
| void | init (void) |
| initialise SX1232 class to radio | |
| uint8_t | read_reg (uint8_t addr) |
| read register from radio | |
| void | write_reg (uint8_t addr, uint8_t data) |
| write register to radio | |
Data Fields | |
| volatile service_action_e | service_action |
| set from ISR to indicate an action to be performed from main loop | |
| uint8_t | tx_buf [64] |
| RF transmit packet buffer. | |
| uint8_t | rx_buf [64] |
| RF receive packet buffer. | |
| RegOpMode_t | RegOpMode |
| operating mode | |
| RegDioMapping1_t | RegDioMapping1 |
| pin assignments | |
| RegDioMapping2_t | RegDioMapping2 |
| pin assignments | |
| RegPktConfig1_t | RegPktConfig1 |
| packet format configuration | |
| RegPktConfig2_t | RegPktConfig2 |
| packet mode control and payload length MSB | |
| uint8_t | RegPayloadLength |
| payload length LSByte | |
| RegFifoThreshold_t | RegFifoThreshold |
| TxStartCondition. | |
| RegSyncConfig_t | RegSyncConfig |
| AutoRestartRx configuration and start-of-frame control. | |
| RegPreambleDetect_t | RegPreambleDetect |
| receiver preamble detector control | |
| uint8_t | RegPreambleMsb |
| TX preamble length. | |
| uint8_t | RegPreambleLsb |
| TX preamble length. | |
| RegPaConfig_t | RegPaConfig |
| transmitter power configuration | |
| RegRxConfig_t | RegRxConfig |
| AFC/AGC configuration. | |
| RegTimerResol_t | RegTimerResol |
| sequencer timing | |
| uint8_t | RegRssiThresh |
| receiver: trigger level for RSSI interrupt | |
| RegSeqConfig1_t | RegSeqConfig1 |
| sequencer control | |
| RegSeqConfig2_t | RegSeqConfig2 |
| sequencer control | |
| RegAfcFei_t | RegAfcFei |
| AFC clearing control and manual AFC trigger. | |
Detailed Description
FSK radio transceiver for 800/900MHz.
Compared with ADF7023 in Xbee PRO 900: Receiver bandwidth configurable to narrower operation, for performance at lower bitrates. Transmit power option to +20dBm. Superior blocking immunity in receiver. http://www.semtech.com/apps/product.php?pn=sx1232
Definition at line 351 of file sx1232.h.
Constructor & Destructor Documentation
| SX1232 | ( | PinName | mosi, |
| PinName | miso, | ||
| PinName | sclk, | ||
| PinName | cs, | ||
| PinName | rst, | ||
| PinName | dio_0 | ||
| ) |
Create SX1232 instance.
- Parameters:
-
mosi SPI master-out pin miso SPI master-in pin sclk SPI clock pin cs SPI chip-select pin rst radio hardware reset pin dio_0 interrupt pin from radio
Definition at line 19 of file sx1232.cpp.
Member Function Documentation
| void enable_afc | ( | char | enable ) |
enable AFC with preamble detector
- Note:
- AFC generally used when crystal tolerance is worse than receiver bandwidth. Narrower bandwidths require better ppm on crystal, without AFC.
- this enables with RxTrigger on preamble detect without RSSI threshold.
- other option is to also use RSSI threshold, but requires calibration from ambient RSSI on vacant channel.
Definition at line 305 of file sx1232.cpp.
| uint32_t get_bitrate | ( | void | ) |
| float get_frf_MHz | ( | void | ) |
get center operating frequency
- Returns:
- operating frequency in MHz
Definition at line 138 of file sx1232.cpp.
| uint16_t get_PayloadLength | ( | void | ) |
read payload length
Definition at line 283 of file sx1232.cpp.
| uint32_t get_rx_bw_hz | ( | uint8_t | addr ) |
get receiver bandwidth
- Returns:
- the receiver bandwidth in Hz
Definition at line 262 of file sx1232.cpp.
| uint32_t get_tx_fdev_hz | ( | void | ) |
get transmitted frequency deviation
- Returns:
- transmitter frequency deviation in Hz
Definition at line 184 of file sx1232.cpp.
| void hw_reset | ( | void | ) |
reset radio using pin
Definition at line 74 of file sx1232.cpp.
| void init | ( | void | ) |
initialise SX1232 class to radio
- Note:
- this is called from class instantiation, but must also be manually called after hardware reset
Definition at line 36 of file sx1232.cpp.
| int read_fifo | ( | void | ) |
Called by main program when indicated by service_action variable, to pull recevied packet from radio FIFO.
- Returns:
- count of bytes received
- Note:
- received packet in rx_buf[]
Definition at line 86 of file sx1232.cpp.
| uint8_t read_reg | ( | uint8_t | addr ) |
read register from radio
- Parameters:
-
addr register address
- Returns:
- the value read from the register
Definition at line 355 of file sx1232.cpp.
| void set_bitrate | ( | uint32_t | bps ) |
set over-the-air bitrate
- Parameters:
-
bps bits per second
- Note:
- TX frequency deviation must be set according to desired modulation index
- you cannot change bitrate while in receive mode
Definition at line 153 of file sx1232.cpp.
| void set_frf_MHz | ( | float | MHz ) |
set center operating frequency
- Parameters:
-
MHz operating frequency in MHz
Definition at line 195 of file sx1232.cpp.
| void set_RegPayloadLength | ( | uint16_t | len ) |
write payload length
- Note:
- PayloadLength is maximum 255 in variable-length packet format, or fixed-length maximum of 2047 bytes.
- if PacketFormat is fixed-length, then PayloadLength of 0 enables unlimited length mode.
- In variable length mode, this sets maximum allowed received packet length.
- Parameters:
-
len PayloadLength
Definition at line 297 of file sx1232.cpp.
| void set_rx_dcc_bw_hz | ( | uint32_t | dccValue, |
| uint32_t | bw_hz | ||
| ) |
set receiver bandwidth
- Note:
- Value is selected to frequency deviation and bit-rate (occupied bandwidth)
- Narrower bandwidths may require AFC, depending on reference crystal accuracy
- RX start-up time is slower at narrower bandwidths
- you cannot change bandwith while in receive mode
- usable range is 2.6KHz to 250KHz
Definition at line 235 of file sx1232.cpp.
| void set_tx_fdev_hz | ( | uint32_t | hz ) |
set transmitted frequency deviation
- Parameters:
-
hz frequency deviation in Hz
- Note:
- occupied bandwith is primarily determined by fdev; set receiver bandwidth appropriately
- usable range is 600Hz to 200KHz
Definition at line 174 of file sx1232.cpp.
| void start_rx | ( | void | ) |
start receive mode
- Note:
- the variable service_action needs to be monitored to indicate read_fifo() needs to be called to pull packet from FIFO.
Definition at line 441 of file sx1232.cpp.
| void start_tx | ( | uint8_t | len ) |
transmit a packet
- Parameters:
-
len size of packet, variable-length format only. unused in fixed-length format.
- Note:
- Limited to 64 bytes. Lengths greater than 64 require flow control (radio FIFO size)
Definition at line 413 of file sx1232.cpp.
| void write_reg | ( | uint8_t | addr, |
| uint8_t | data | ||
| ) |
write register to radio
- Parameters:
-
addr register address data byte to write
Definition at line 372 of file sx1232.cpp.
Field Documentation
| RegAfcFei_t RegAfcFei |
| RegDioMapping1_t RegDioMapping1 |
| RegDioMapping2_t RegDioMapping2 |
| RegFifoThreshold_t RegFifoThreshold |
| RegPaConfig_t RegPaConfig |
| uint8_t RegPayloadLength |
| RegPktConfig1_t RegPktConfig1 |
| RegPktConfig2_t RegPktConfig2 |
| RegPreambleDetect_t RegPreambleDetect |
| uint8_t RegPreambleLsb |
| uint8_t RegPreambleMsb |
| uint8_t RegRssiThresh |
| RegRxConfig_t RegRxConfig |
| RegSeqConfig1_t RegSeqConfig1 |
| RegSeqConfig2_t RegSeqConfig2 |
| RegSyncConfig_t RegSyncConfig |
| RegTimerResol_t RegTimerResol |
| volatile service_action_e service_action |
Generated on Thu Jul 21 2022 17:07:21 by
1.7.2