Skip to content

Commit 1f42eee

Browse files
authored
Merge pull request #145 from beegee-tokyo/RAK3112
Fix RP2040 assert issue, Add RAK3112 support
2 parents 9e6717f + f6c470b commit 1f42eee

File tree

5 files changed

+54
-1
lines changed

5 files changed

+54
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ Arduino library for LoRa communication with Semtech SX126x chips. It is based on
66

77
# V2.0.30 Fix RP2040 assert issue
88
- Set timer priority correct, thanks to _**@EdisonAgudelo**_
9+
- Add RAK3112 support
910

1011
# V2.0.29 Add read the Syncword function
1112
- Add radio function to read the radio syncword uint16_t syncword = Radio.GetSyncWord(void);

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
9090
[Code releases](CHANGELOG.md)
9191
- 2025-01-16 Fix RP2040 assert issue
9292
- Set timer priority correct, thanks to _**@EdisonAgudelo**_
93+
- Add RAK3112 support
9394
- 2025-01-05 Add function to read the Syncword
9495
- Add radio function to read the radio syncword uint16_t syncword = Radio.GetSyncWord(void);
9596
- 2025-01-01 Add custom Syncword and Low DataRate optimization

library.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
"espressif32",
2222
"nordicnrf52",
2323
"espressif8266",
24-
"nordicnrf52",
2524
"mbed_rp2040",
2625
"rp2040"
2726
],

src/boards/mcu/board.cpp

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -374,6 +374,54 @@ uint32_t lora_rak13300_init(void)
374374
return 1;
375375
}
376376

377+
uint32_t lora_rak3112_init(void)
378+
{
379+
_hwConfig.CHIP_TYPE = SX1262; // Chip type, SX1261 or SX1262
380+
_hwConfig.PIN_LORA_RESET = 8; // LORA RESET
381+
_hwConfig.PIN_LORA_NSS = 7; // LORA SPI CS
382+
_hwConfig.PIN_LORA_SCLK = 5; // LORA SPI CLK
383+
_hwConfig.PIN_LORA_MISO = 3; // LORA SPI MISO
384+
_hwConfig.PIN_LORA_DIO_1 = 33; // LORA DIO_1
385+
_hwConfig.PIN_LORA_BUSY = 34; // LORA SPI BUSY
386+
_hwConfig.PIN_LORA_MOSI = 6; // LORA SPI MOSI
387+
_hwConfig.RADIO_TXEN = -1; // LORA ANTENNA TX ENABLE (e.g. eByte E22 module)
388+
_hwConfig.RADIO_RXEN = 4; // LORA ANTENNA RX ENABLE (e.g. eByte E22 module)
389+
_hwConfig.USE_DIO2_ANT_SWITCH = true; // LORA DIO2 controls antenna
390+
_hwConfig.USE_DIO3_TCXO = true; // LORA DIO3 controls oscillator voltage (e.g. eByte E22 module)
391+
_hwConfig.USE_DIO3_ANT_SWITCH = false; // LORA DIO3 controls antenna (e.g. Insight SIP ISP4520 module)
392+
_hwConfig.USE_RXEN_ANT_PWR = true; // RXEN is used as power for antenna switch
393+
394+
TimerConfig();
395+
396+
SX126xIoInit();
397+
398+
// After power on the sync word should be 2414. 4434 could be possible on a restart
399+
// If we got something else, something is wrong.
400+
uint16_t readSyncWord = 0;
401+
SX126xReadRegisters(REG_LR_SYNCWORD, (uint8_t *)&readSyncWord, 2);
402+
403+
LOG_LIB("BRD", "SyncWord = %04X", readSyncWord);
404+
405+
// There could be a custom syncword, better test for 0xFFFF
406+
// if ((readSyncWord == 0x2414) || (readSyncWord == 0x4434))
407+
if (readSyncWord != 0xFFFF)
408+
{
409+
#if defined NRF52_SERIES || defined ESP32 || defined ARDUINO_ARCH_RP2040 || defined ARDUINO_RAKWIRELESS_RAK11300
410+
if (start_lora_task())
411+
{
412+
return 0;
413+
}
414+
else
415+
{
416+
return 1;
417+
}
418+
#else
419+
return 0;
420+
#endif
421+
}
422+
return 1;
423+
}
424+
377425
#if defined NRF52_SERIES || defined ESP32 || defined ARDUINO_RAKWIRELESS_RAK11300
378426
void _lora_task(void *pvParameters)
379427
{

src/boards/mcu/board.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,10 @@ uint32_t lora_rak4630_init(void);
112112
*/
113113
uint32_t lora_rak11300_init(void);
114114

115+
/**@brief Initializes the RAK3112 board peripherals.
116+
*/
117+
uint32_t lora_rak3112_init(void);
118+
115119
/**@brief Initializes the RAK13300 board peripherals.
116120
*/
117121
uint32_t lora_rak13300_init(void);

0 commit comments

Comments
 (0)