Open arifainchtein opened 10 months ago
On 12/08/2023 6:33 pm, arifainchtein wrote:
Hello, I have a custom made board with Ra-02 and Esp32. I connect this board to a raspberry pi via usb. This board acts as a receiver of data from two other boards also with esp32 and Ra-02. These senders each send a struct to the receiver in either 10 sec interval for Sender 1 and 30 seconds interval for sender 2.
In the pi i run a program that sends Serial port messages asking for data. These request happen every 10 seconds or so. When a request for data arrives in the esp32 it serializes the s1 and s2 structs and sends them via the serial port.
The problem i am having is that if Lora receives a message while the serial port is active the esp 32 crashes. Otherwise it works perfectly. I have tried setting lora as transmission when receiving Serial commands (so as to make sure it does not receive) and then setting it to receive when the serial port transaction is happening but that did not seem to fix the issue.
I also tried setting NoInterrupts() and Interrupts() at the beginning and end of the serial transaction and that literally crash the esp32 and it rebooted itself. Is there a way to turn on and off the Lora radio so that i can insure that the radio is off when i am doing serial communications?
Do you have any suggestions as to why or how to fix this issue?
thanks
I have a couple of suggestions, both involve a re-design.
1) The ESP-32 has 2 cores, separate the LoRa, and RasPi tasks one to each core. The tasks can communicate in several ways, by global variables is the simplest.
2) Change to a polling system. At the moment you have 3 asynchronous events, and there is a high probability of a clash, instead use a system where the RasPi requests information, your board passes the request to the appropriate sensor, and passes the result back to the RasPi. This simplifies the code in your board as it become a simple serial - LoRa - serial converter. The RasPi would just need to specify the sensor that it wished to interrogate, and the number of bytes expected. It would also mean that, if the structure of the data was to change for some reason, there would be no changes needed to this board.
Hello, I have a custom made board with Ra-02 and Esp32. I connect this board to a raspberry pi via usb. This board acts as a receiver of data from two other boards also with esp32 and Ra-02. These senders each send a struct to the receiver in either 10 sec interval for Sender 1 and 30 seconds interval for sender 2.
In the pi i run a program that sends Serial port messages asking for data. These request happen every 10 seconds or so. When a request for data arrives in the esp32 it serializes the s1 and s2 structs and sends them via the serial port.
The problem i am having is that if Lora receives a message while the serial port is active the esp 32 crashes. Otherwise it works perfectly. I have tried setting lora as transmission when receiving Serial commands (so as to make sure it does not receive) and then setting it to receive when the serial port transaction is happening but that did not seem to fix the issue.
I also tried setting NoInterrupts() and Interrupts() at the beginning and end of the serial transaction and that literally crash the esp32 and it rebooted itself. Is there a way to turn on and off the Lora radio so that i can insure that the radio is off when i am doing serial communications?
here is the code that receives the lora message:
Do you have any suggestions as to why or how to fix this issue?
thanks