I am unable to send or receive through a STM32L051C8T7 board.. No failure in setup, but it freezes on LoRa.endPacket();, hSerial.print("4"); is never called in the code below. It also freezes when LoRa.read() is called to receive data. Is STM32L051C8 not supported? Or am I doing something wrong.
`#include
include
include
include
HardwareSerial hSerial(PA10, PA9);
define LORA_SCK PA5
define LORA_MISO PA6
define LORA_MOSI PA7
define LORA_CS PA4
define LORA_RST PB11
int counter = 0;
void setup() {
delay(500);
hSerial.begin(115200);
// while (!hSerial);
delay(500);
I had a similar problem with an ESP32 module and it turned out to be a grounding issue. Make sure ALL ground pins on your STM32 board are attached to ground as well as ALL ground pins on your LoRa module.
I am unable to send or receive through a STM32L051C8T7 board.. No failure in setup, but it freezes on
LoRa.endPacket();
,hSerial.print("4");
is never called in the code below. It also freezes whenLoRa.read()
is called to receive data. Is STM32L051C8 not supported? Or am I doing something wrong.`#include
include
include
include
HardwareSerial hSerial(PA10, PA9);
define LORA_SCK PA5
define LORA_MISO PA6
define LORA_MOSI PA7
define LORA_CS PA4
define LORA_RST PB11
int counter = 0;
void setup() { delay(500); hSerial.begin(115200); // while (!hSerial); delay(500);
hSerial.println("LoRa Receiver");
delay(500);
LoRa.setPins(LORA_CS, LORA_RST); SPI.setMISO(LORA_MISO); SPI.setMOSI(LORA_MOSI); SPI.setSCLK(LORA_SCK); SPI.setSSEL(LORA_CS);
SPI.begin();
if (!LoRa.begin(433E6)) { hSerial.println("Starting LoRa failed!"); while (1) ; }
delay(500); hSerial.println("LoRa Receiver Setup Done"); delay(500); }
void loop() {
hSerial.print("Sending packet: "); hSerial.println(counter);
// send packet LoRa.beginPacket(); hSerial.print("1"); LoRa.print("hello "); hSerial.print("2"); LoRa.print(counter); hSerial.print("3"); LoRa.endPacket(); hSerial.print("4");
counter++;
delay(1000);
} `