Modem Configuration - chandrawi/LoRaRF-Arduino GitHub Wiki
Before transmit or receive operation you can configure transmit power and receive gain or matching frequency, modulation parameter, packet parameter, and synchronize word with other LoRa device you want communicate.
Modem type must be configured before any other modem configuration. After modem type configuration done all previous modem configuration lost. So you need to reconfigure after changing modem type. To change modem type call setModem()
method with following options:
- LORA_MODEM
- FSK_MODEM
// set modem type to LoRa
LoRa.setModem(LORA_MODEM);
By default after begin()
modem type configured to LORA_MODEM
.
// set transmit power to +22 dBm for SX1262
LoRa.setTxPower(22, SX126X_TX_POWER_SX1262);
// set transmit power to +20 dBm for SX127x series using boost pin
LoRa.setTxPower(20, SX127X_TX_POWER_PA_BOOST);
// set receive gain to power saving
LoRa.setRxGain(LORA_RX_GAIN_POWER_SAVING);
// set receive gain to boosted and AGC on for SX127x series
LoRa.setRxGain(LORA_RX_GAIN_BOOSTED, true);
// Set frequency to 915 Mhz
LoRa.setFrequency(915000000);
// set spreading factor 8, bandwidth 125 kHz, coding rate 4/5, and low data rate optimization off
LoRa.setLoRaModulation(8, 125000, 5, false);
// set explicit header mode, preamble length 12, payload length 15, CRC on and no invert IQ operation
LoRa.setLoRaPacket(LORA_HEADER_EXPLICIT, 12, 15, true, false);
// Set syncronize word for public network (0x3444)
LoRa.setSyncWord(0x3444);