Forum Replies Created
-
AuthorPosts
-
10 December 2024 at 18:40 in reply to: E220-900T22D: Can’t communicate with higher UART Baud rate/Air data rate #31934
Using any of the following constructors causes both boards to go in kernel panic as the getConfiguration() returns a null pointer.
Here’s the receiver code:#define E220_22
#define FREQUENCY_868
#define ENABLE_RSSI
<div>
<div>#include <Arduino.h>
</div>
<div>#include <LoRa_E220.h>
</div>
</div>
byte RX_PIN = 16;
byte TX_PIN = 17;
byte AUX_PIN = 18; // not used
byte M0_PIN = 19; // not used
byte M1_PIN = 21; // not used
void printParameters(struct Configuration configuration);
// byte txE220pin, byte rxE220pin, HardwareSerial* serial, byte auxPin, byte m0Pin, byte m1Pin, UART_BPS_RATE bpsRate, uint32_t serialConfig = SERIAL_8N1
LoRa_E220 e220ttl(&Serial2, AUX_PIN, M0_PIN, M1_PIN, UART_BPS_RATE_115200); // RX AUX M0 M1
// LoRa_E220 e220ttl(&Serial2, 22, 4, 18, 21, 19, UART_BPS_RATE_9600); // esp32 RX <-- e220 TX, esp32 TX --> e220 RX AUX M0 M1
void setup()
{
Serial2.begin(115200);
Serial.begin(115200);
delay(500);
digitalWrite(M0_PIN, LOW);
digitalWrite(M1_PIN, LOW);
// Startup all pins and UART
bool res = e220ttl.begin();
//Serial.println("Begin: " + String(res));
ResponseStructContainer c;
c = e220ttl.getConfiguration();
//Error is happening here
Serial.println("Error happens here");
// It's important get configuration pointer before all other operation
Configuration configuration = *(Configuration *)c.data;
Serial.println("And I can't get here");
Serial.println(c.status.getResponseDescription());
Serial.println(c.status.code);
// printParameters(configuration);
configuration.ADDL = 0x05;
configuration.ADDH = 0x00;
configuration.CHAN = 23;
configuration.SPED.uartBaudRate = UART_BPS_115200;
configuration.SPED.airDataRate = AIR_DATA_RATE_111_625;
configuration.SPED.uartParity = MODE_00_8N1;
configuration.OPTION.subPacketSetting = SPS_200_00;
configuration.OPTION.RSSIAmbientNoise = RSSI_AMBIENT_NOISE_DISABLED;
configuration.OPTION.transmissionPower = POWER_22;
configuration.TRANSMISSION_MODE.enableRSSI = RSSI_ENABLED;
configuration.TRANSMISSION_MODE.fixedTransmission = FT_FIXED_TRANSMISSION;
configuration.TRANSMISSION_MODE.enableLBT = LBT_DISABLED;
configuration.TRANSMISSION_MODE.WORPeriod = WOR_2000_011;
// Set configuration changed and set to not hold the configuration
ResponseStatus rs = e220ttl.setConfiguration(configuration, WRITE_CFG_PWR_DWN_SAVE);
Serial.println(rs.getResponseDescription());
Serial.println(rs.code);
c.close();
c = e220ttl.getConfiguration();
// It's important get configuration pointer before all other operation
configuration = *(Configuration *)c.data;
Serial.println(c.status.getResponseDescription());
Serial.println(c.status.code);
//printParameters(configuration);
c.close();
//Serial.println("Start receiving!");
}
void loop()
{
// If something available
if (e220ttl.available())
{
// Serial.println("Message received!");
// read the String message
#ifdef ENABLE_RSSI
ResponseContainer rc = e220ttl.receiveMessageRSSI();
#else
ResponseContainer rc = e220ttl.receiveMessage();
#endif
// Is something goes wrong print error
if (rc.status.code != 1)
{
Serial.println(rc.status.getResponseDescription());
}
else
{
// Print the data received
// Serial.println(rc.status.getResponseDescription());
Serial.println(rc.data);
#ifdef ENABLE_RSSI
Serial.print("RSSI: ");
Serial.println(rc.rssi, DEC);
#endif
}
}
}
void printParameters(struct Configuration configuration)
{
Serial.println("----------------------------------------");
Serial.print(F("HEAD : "));
Serial.print(configuration.COMMAND, HEX);
Serial.print(" ");
Serial.print(configuration.STARTING_ADDRESS, HEX);
Serial.print(" ");
Serial.println(configuration.LENGHT, HEX);
Serial.println(F(" "));
Serial.print(F("AddH : "));
Serial.println(configuration.ADDH, HEX);
Serial.print(F("AddL : "));
Serial.println(configuration.ADDL, HEX);
Serial.println(F(" "));
Serial.print(F("Chan : "));
Serial.print(configuration.CHAN, DEC);
Serial.print(" -> ");
Serial.println(configuration.getChannelDescription());
Serial.println(F(" "));
Serial.print(F("SpeedParityBit : "));
Serial.print(configuration.SPED.uartParity, BIN);
Serial.print(" -> ");
Serial.println(configuration.SPED.getUARTParityDescription());
Serial.print(F("SpeedUARTDatte : "));
Serial.print(configuration.SPED.uartBaudRate, BIN);
Serial.print(" -> ");
Serial.println(configuration.SPED.getUARTBaudRateDescription());
Serial.print(F("SpeedAirDataRate : "));
Serial.print(configuration.SPED.airDataRate, BIN);
Serial.print(" -> ");
Serial.println(configuration.SPED.getAirDataRateDescription());
Serial.println(F(" "));
Serial.print(F("OptionSubPacketSett: "));
Serial.print(configuration.OPTION.subPacketSetting, BIN);
Serial.print(" -> ");
Serial.println(configuration.OPTION.getSubPacketSetting());
Serial.print(F("OptionTranPower : "));
Serial.print(configuration.OPTION.transmissionPower, BIN);
Serial.print(" -> ");
Serial.println(configuration.OPTION.getTransmissionPowerDescription());
Serial.print(F("OptionRSSIAmbientNo: "));
Serial.print(configuration.OPTION.RSSIAmbientNoise, BIN);
Serial.print(" -> ");
Serial.println(configuration.OPTION.getRSSIAmbientNoiseEnable());
Serial.println(F(" "));
Serial.print(F("TransModeWORPeriod : "));
Serial.print(configuration.TRANSMISSION_MODE.WORPeriod, BIN);
Serial.print(" -> ");
Serial.println(configuration.TRANSMISSION_MODE.getWORPeriodByParamsDescription());
Serial.print(F("TransModeEnableLBT : "));
Serial.print(configuration.TRANSMISSION_MODE.enableLBT, BIN);
Serial.print(" -> ");
Serial.println(configuration.TRANSMISSION_MODE.getLBTEnableByteDescription());
Serial.print(F("TransModeEnableRSSI: "));
Serial.print(configuration.TRANSMISSION_MODE.enableRSSI, BIN);
Serial.print(" -> ");
Serial.println(configuration.TRANSMISSION_MODE.getRSSIEnableByteDescription());
Serial.print(F("TransModeFixedTrans: "));
Serial.print(configuration.TRANSMISSION_MODE.fixedTransmission, BIN);
Serial.print(" -> ");
Serial.println(configuration.TRANSMISSION_MODE.getFixedTransmissionDescription());
Serial.println("----------------------------------------");
}
And here’s the output on the Serial Monitor (with DEBUG_PRINT enabled):
ets Jul 29 2019 12:21:46
rst:0xc (SW_CPU_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0030,len:1184
load:0x40078000,len:13232
load:0x40080400,len:3028
entry 0x400805e4
RX MIC ---> -1
TX MIC ---> -1
AUX ---> 18
M0 ---> 19
M1 ---> 21
Init AUX pin!
Init M0 pin!
Init M1 pin!
Begin ex
Begin Hardware Serial
Begin
MODE NORMAL!
AUX HIGH!
Complete!
Error happens here
Guru Meditation Error: Core 1 panic'ed (LoadProhibited). Exception was unhandled.
Core 1 register dump:
PC : 0x40085e13 PS : 0x00060830 A0 : 0x800d173d A1 : 0x3ffb2220
A2 : 0x3ffb2251 A3 : 0x00000000 A4 : 0x0000000b A5 : 0x3ffb2251
A6 : 0x00000001 A7 : 0x0800001c A8 : 0x800d2da0 A9 : 0x3ffb21f0
A10 : 0x00000002 A11 : 0x3f400276 A12 : 0x00000078 A13 : 0xffffffff
A14 : 0xffffffff A15 : 0x3ffbdbac SAR : 0x0000000a EXCCAUSE: 0x0000001c
EXCVADDR: 0x00000000 LBEG : 0x40086431 LEND : 0x40086441 LCOUNT : 0xffffffff
Backtrace: 0x40085e10:0x3ffb2220 0x400d173a:0x3ffb2230 0x400d47da:0x3ffb2290
And it’s basically the same on the receiver.
I was able to use only 9600 as BPS rate, still being able to use different Air Data Rate values. -
AuthorPosts