ESP32 TheThingsNetwork.h Causing Crashes

kevin192291
Posts: 1
Joined: Sun Jul 12, 2020 9:37 pm

ESP32 TheThingsNetwork.h Causing Crashes

Postby kevin192291 » Sun Jul 12, 2020 9:47 pm

Hi All,
I have been having a massive headache trying to get TheThingsNetwork.h (https://github.com/TheThingsNetwork/arduino-device-lib) working on the ESP32, I really want to use the ESP32 for my project.
When I attempt to get this up and running on my esp32, it will crash, and reboot, I have attempted to use the ESP Exception Decoder, but it isn't working, or I am not entering the correct info.
I have found another library (https://github.com/jpmeijers/RN2483-Arduino-Library) that does at very least get a boot, but has a restriction of 11 bytes that may be sent :(

Here is the most simple example I have tried:
  1. #include <TheThingsNetwork.h>
  2.  
  3. #define loraSerial Serial2
  4. #define debugSerial Serial
  5.  
  6. // Replace REPLACE_ME with TTN_FP_EU868 or TTN_FP_US915
  7. #define freqPlan TTN_FP_US915
  8.  
  9. TheThingsNetwork ttn(loraSerial, debugSerial, freqPlan);
  10.  
  11. void setup()
  12. {
  13.   loraSerial.begin(57600);
  14.   debugSerial.begin(9600);
  15. }
  16.  
  17. void loop()
  18. {
  19.   debugSerial.println("Device Information");
  20.   debugSerial.println();
  21.   ttn.showStatus();
  22.   debugSerial.println();
  23.   debugSerial.println("Use the EUI to register the device for OTAA");
  24.   debugSerial.println("-------------------------------------------");
  25.   debugSerial.println();
  26.  
  27.   delay(10000);
  28. }
The TTN library works great with ATMEL chips, I have tried it on a few different ones, Just not on the ESP line...
Any help at all would be greatly appreciated, and if you have a way to get this up and working, I can throw you a few
bucks over paypal or something.

Thanks,
-Kevin

PeterR
Posts: 621
Joined: Mon Jun 04, 2018 2:47 pm

Re: ESP32 TheThingsNetwork.h Causing Crashes

Postby PeterR » Mon Jul 13, 2020 11:19 pm

I'm not an arduino expert but in IDF 9/10 weird issues are typically down to stack or rouge pointers.
You say that backtrace does not work. A quick sanity check is to add (char *)0 = 1 in/after initialisation. If you get a reasonable backtrace then that adds weight to stack corruption.
Something to think about is that variables are not automatically 0 initialised in ESP. I have had a few 'working' arduino libraries which fail because of initialisation or lack off. ESP are correct btw. EDIT: Just less forgiving!
The fact that you do not get a reasonable backtrace suggests too small a stack. Rouge pointer is also possible, see above.
Past that my suggestion would be to add printf/sleep & so isolate the fault. Removing the connection (cable/wifi) would help show if initialisation or frame processing.
& I also believe that IDF CAN should be fixed.

Who is online

Users browsing this forum: burtrum and 115 guests