Search code examples
arduinolorawanseeeduino

Run a program on XIAO SAMD21 + LoRa-E5 via serial with external power supply


I need to send data through LoRaWAN and I'm using the excellent LoRa-E5 module for this:

https://wiki.seeedstudio.com/LoRa_E5_mini/

I can send data to my public network by typing a couple of AT commands in the Arduino IDE software.

Hopefully, there are better ways to pilot the LoRa module. In the manual, it says I can use for example the XIAO SAMD21:

https://wiki.seeedstudio.com/Seeeduino-XIAO/

So I followed the manual and connect them through serial TX/RX pins. I plug the XIAO to my computer, I upload the program, and it's working fine and transmit data to my public network. The problem is this: if I plug it to another power source (battery, USB-C other than the PC...) it doesn't do anything and the blue light, showing an RX/TX communications, is never flashing. Also, if I close the Arduino IDE software and plug the XIAO to my PC, the program doesn't start and no data is sent.

I thought this module was not able to run without the Arduino program opened. I thought it couldn't work like any ESP32 for example in which you upload a program and it can run with any external power? But when I upload a simple program where I just blink the led, it will blink if the XIAO is plugged either on my PC or on an external plug.

What am I missing? Why the XIAO / LoRa-E5 can't start when it is plugged with an external power supply?

The program I'm using is based on Sylvain Montagny's library:

https://github.com/SylvainMontagny/LoRaE5

Thanks for your time and lights once again.

Laurent


Solution

  • In case it can serve someone, my mistake was in the code. I had:

    void setup() {
      LoRa_Serial.begin(9600);
      USB_Serial.begin(9600);
      while (!USB_Serial);
      USB_Serial.println("#######################################");
    
    ...
    

    The solution was to comment the lines containing "USB_Serial" ... since I was not connected anymore with the USB cable!