ESP32C3 does not compile with LORAE5 library

Hi, I am trying to do the E5MAT Lora GPS tracker. This uses the LoRaE5 library. (E5MAT: Location Tracker Using GPS and LoRa Technology - Hackster.io) . Transmiter works ok. In the receiver (ESP32C3) I am not able to compile. Several error messages similar to this are produced:
In member function ‘void LoRaE5Class::init()’:
c:\Users\gnola\Documents\Arduino\libraries\LoRaE5-main\LoRaE5.h:34:21: error: ‘Serial2’ was not declared in this scope.
Using an Doit ESP32 DEVKIT1 board instead of the ESP32C3 the receiver works as expected. Any ideas to put ESP32C3 working properly with LoraE5 library?.

im having the same issue. Was it solved please ?

Hi there, and welcome here.
What BSP are you using for this experiment?
are you using SoftSerial for com2?
HTH
GL :slight_smile: PJ
:v:

Hi,

I have the below setup:

Hi there,
That doesn’t tell me anything , but port5 is used in the Xiao connection.
WHICH board Support Package are you using I suspect that to be your issue.
Look in the boards tab and what version is being compiled? also on the compiler output you should see it in the first 3 lines. :v:
HTH
GL :slight_smile: PJ

I would suggest 2.1.7 see what that yields.

you need to use the seeed board packages… because it is specific to the XIAO just esp32 is not good enough

As you can see, there are lots comments that tell you Serial2 was not declared…
in the header:

#if defined(ESP32)
	#define SerialLoRa Serial2		//M5Stack ESP32 Camera Module Development Board
#else
	#define SerialLoRa Serial1		//For SAMD Variant and XIAO NRF
#endif

you could see how he coded.

However, for ESP32-C3, there is no Serial2 for it. as

we must ignore the Serial2 for XIAO ESP32C3

So using ESP32-C3, you can add this code to redefine the serial:

#undef SerialLoRa 
#define SerialLoRa Serial1

Remember D6 for TX, D7 for RX.
Using like this:

Serial1.begin(115200, SERIAL 8N1,D7,D6);

thanks for letting us know i have some people looking into this… it is a problem that esp32 does not handle serial coms like arduino and SAMD processors do

yep, the library could make it more adaptive;

such as, use the macros:

#if defined(__SAMD21G18A__) // XIAO SAMD21
#elif defined(ARDUINO_SEEED_XIAO_NRF52840_SENSE) || defined(ARDUINO_SEEED_XIAO_NRF52840)
#elif defined(ARDUINO_SEEED_XIAO_RP2040)
#elif defined(CONFIG_IDF_TARGET_ESP32S3) || defined(CONFIG_IDF_TARGET_ESP32C3)

I would like to use this repo for my project with LoRa-E5:

and btw, I create a python library for my rpi 4b :rofl:
but emmm, I failed to work with more complicated project:

Ok so I don’t have to touch lorae5.cpp and .h and just put #undef SerialLoRa
#define SerialLoRa Serial1

in the sketch?

And instead of serial I use serial1 in the sketch?

Hi there,
Go look at The W500 GPS threads The connections are similar, Using SOFT Serial,
also this one

May or may not shed some light on it.
HTH
GL :slight_smile: PJ
:v:

1 Like

Seed Studio ESP32-C3