Closed
Description
Trying to use RADIOLIB_DEBUG_PROTOCOL
to get a understanding of why my device works better with some LNS than others.
When I enable RADIOLIB_DEBUG_PROTOCOL
in BuildOptUser.h
the console just print a garbled mess. Seems to begin imediatly the moment where the first debug is to be printed.
RADIOLIB_DEBUG_BASIC
is working as expected.
- LoRaWAN
- PlatformIO (in vscode)
- ST Nucleo WL55JC1
The program is as simple as I can make it.
#include <Arduino.h>
#include <RadioLib.h>
typedef uint64_t lorawan_eui_t;
typedef uint8_t lorawan_key_t[16];
uint64_t joinEUI = 0x0000000000000000;
uint64_t devEUI = 0xbaddecafcafedeed;
lorawan_key_t nwkKey = {
0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88,
0x88, 0x77, 0x66, 0x55, 0x44, 0x33, 0x22, 0x99
};
lorawan_key_t appKey = {
0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88,
0x88, 0x77, 0x66, 0x55, 0x44, 0x33, 0x22, 0x99
};
STM32WLx radio = new STM32WLx_Module();
const LoRaWANBand_t Region = EU868;
const uint8_t subBand = 0;
LoRaWANNode node(&radio, &Region, subBand);
static const uint32_t rfswitch_pins[] =
{PC3, PC4, PC5, RADIOLIB_NC, RADIOLIB_NC};
static const Module::RfSwitchMode_t rfswitch_table[] = {
{STM32WLx::MODE_IDLE, {LOW, LOW, LOW}},
{STM32WLx::MODE_RX, {HIGH, HIGH, LOW}},
{STM32WLx::MODE_TX_LP, {HIGH, HIGH, HIGH}},
{STM32WLx::MODE_TX_HP, {HIGH, LOW, HIGH}},
END_OF_MODE_TABLE,
};
void setup()
{
Serial.begin(115200);
radio.setRfSwitchTable(rfswitch_pins, rfswitch_table);
Serial.printf("radio.begin: %d\r\n", radio.begin());
Serial.printf("beginOTAA %d\r\n", node.beginOTAA(joinEUI, devEUI, nwkKey, appKey));
Serial.printf("activateOTAA %d\r\n", node.activateOTAA());
}
void loop()
{
static uint8_t i = 0;
uint8_t data[] = "ABC";
data[0] = i++; // make first byte increment for tracking on LNS
Serial.printf("sendReceive: %d\r\n", node.sendReceive(data, sizeof(data), 22));
delay(60 * 1000);
}