Issue: After a few hours running the RAK811 appears to get stuck giving ‘ERROR 5’ …
Setup: RAK811 RP2040 via UART
Server: P2P
Details: After a few hours running the RAK811 appears to get stuck giving ‘ERROR 5’ in response to say at+send=lorap2p:\r\n. The Error Code Table isn’t particularly illuminating: “There is an error when sending through UART”
Any suggestions on what might cause this error (so I can maybe tighten up my coding) and how to recover from it?
Thanks
I left the data out the post - sorry. It’s typically around 100 bytes (a bit long - but I haven’t coded the compression yet). The odd thing is it works for a few hours, then gets stuck in this Error 5 state. Then sending anything - even 4 bytes - just returns ERROR 5. I’m hoping for a steer about what generates this type of error so I can try a few variations.
Ok - I think I fixed this. It was a design/coding fault on my part (not a RAK811 issue) but I’ll post a brief explanation in case it helps someone else.
The application (on a RP2040) has an interrupt service routine (ISR) that includes a clock read. Either the clock read was slowing the ISR down, or it was, maybe, latching (or doing something odd) to the timer.
If the ISR was triggered at the same time as communicating via the UART, the link was getting messed up enough for the RAK811 to start generating the ERROR 5 responses.
The ISR was running on a separate core to the communications with the RAK811, which suggests to me it was the routine to read the hardware timer that was the issue.
Anyway, I cleaned up the ISR to read the HW registers directly and the ERROR 5 problem stops.
Incidentally, I shortened the message to 20 bytes and this reduced the frequency of the error (presumably because the comms window was shorter and the chances of the interrupt happening were lower).
I also tried slowing down the UART (9600 baud). That made the issue worse (more frequent). Presumably because the comms window was longer.
Thanks for the suggestions - they helped me pinpoint what was going on.
That’s good news @pularolando . I wish you all the best and success of your project!
Btw, for your new products, try to consider using RAK4270. It has lower power consumption, has IPEX connector option built-in and uses the sx1262 chipset.