Hardware Abstraction Layer, permitting any LoRa application to use any LoRa radio chip
Dependents: alarm_slave alarm_master lora_p2p lorawan1v1 ... more
radio chip selection
Radio chip driver is not included, allowing choice of radio device.
If you're using SX1272 or SX1276, then import sx127x driver into your program.
if you're using SX1261 or SX1262, then import sx126x driver into your program.
if you're using SX1280, then import sx1280 driver into your program.
if you're using LR1110, then import LR1110 driver into your program.
If you're using NAmote72 or Murata discovery, then you must import only sx127x driver.
If you're using Type1SJ select target DISCO_L072CZ_LRWAN1
and import sx126x driver into your program.
Pin assigned to arduino LoRa radio shield form-factor
- SX1272 shield.
- SX1276 shield.
- SX126x kit with color touch screen, or sx126x radio-only shield.
- Exceptions with their own pin assignments: NAMote-72 and Murata discovery board.
- TODO: pin assign XDOT.
Diff: radio_sx126x.cpp
- Revision:
- 18:78c5e644d37a
- Parent:
- 17:5f34cbe2ac53
- Child:
- 20:75635d50262e
--- a/radio_sx126x.cpp Mon Jun 01 15:59:56 2020 -0700 +++ b/radio_sx126x.cpp Fri Jun 12 11:27:45 2020 -0700 @@ -12,6 +12,17 @@ bool Radio::paOff; #ifdef TARGET_FF_ARDUINO +#ifdef TARGET_DISCO_L072CZ_LRWAN1 + /* murata type1SJ */ + SPIu spi(PB_15, PB_14, PB_13); // mosi, miso, sclk + //spi, nss, busy, dio1 + SX126x Radio::radio(spi, PB_12, PC_2, PB_0); + + DigitalOut antswPower(PA_15); + void Radio::chipModeChange() { } + const uint8_t chipType = CHIP_TYPE_SX1262; +#else + /* sx126x arduino shield */ SPIu spi(D11, D12, D13); // mosi, miso, sclk //spi, nss, busy, dio1 SX126x Radio::radio(spi, D7, D3, D5); @@ -41,6 +52,7 @@ rx_led = LED_ON; } } +#endif /* !TARGET_DISCO_L072CZ_LRWAN1 */ #endif /* TARGET_FF_ARDUINO */ const RadioEvents_t* RadioEvents; @@ -466,6 +478,15 @@ RadioEvents->TxDone_botHalf(); } +void to_big_endian24(uint32_t in, uint8_t *out) +{ + out[2] = in & 0xff; + in >>= 8; + out[1] = in & 0xff; + in >>= 8; + out[0] = in & 0xff; +} + void Radio::Init(const RadioEvents_t* e, unsigned spi_hz) { radio.txDone = txDoneBottom; @@ -479,6 +500,21 @@ spi.frequency(spi_hz); radio.SetDIO2AsRfSwitchCtrl(1); +#ifdef TARGET_DISCO_L072CZ_LRWAN1 + /* murata type1SJ */ + { + unsigned tcxoDelayTicks = 3200; + uint8_t buf[4]; + + radio.hw_reset(PB_1); + ThisThread::sleep_for(50); + + buf[0] = 1; // 1 = 1.7v + to_big_endian24(tcxoDelayTicks, buf+1); + + radio.xfer(OPCODE_SET_DIO3_AS_TCXO_CTRL, 4, 0, buf); + } +#endif } void Radio::service()