Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

STM32L051C8 gets stuck at LoRa.endPacket() using RA-02 module #702

Open
agozie opened this issue Aug 30, 2024 · 1 comment
Open

STM32L051C8 gets stuck at LoRa.endPacket() using RA-02 module #702

agozie opened this issue Aug 30, 2024 · 1 comment

Comments

@agozie
Copy link

agozie commented Aug 30, 2024

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 <Arduino.h>
#include <SPI.h>
#include <LoRa.h>
#include <HardwareSerial.h>

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);

}
`

@agozie agozie changed the title STM32L051C8 gets stuck at LoRa.endPacket() STM32L051C8 gets stuck at LoRa.endPacket() using RA-02 Aug 30, 2024
@agozie agozie changed the title STM32L051C8 gets stuck at LoRa.endPacket() using RA-02 STM32L051C8 gets stuck at LoRa.endPacket() using RA-02 module Aug 30, 2024
@davidlehrian
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants