RAK811 - what causes ERROR 5 responses

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

What is the size of data you are sending? How many bytes? Can you try to optimize and lower the size and check if you’ll still have the errors?

This is asking it to send, but you are not giving it anything to send.

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.

100 bytes may well be exceeding various buffers as 100 bytes in any form of LoRa world is a biggish number of bytes.

Can you run a test sending 50 bytes to see if this causes issue?

Good idea Nick - thanks I’ll give that a whirl.

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.

1 Like

I got error 6, and tried to lessen the bytes it sent, and it works. Thanks for the support
team of Rakwireless you are all awesome.

1 Like

That’s good news @pularolando . I wish you all the best and success of your project! :handshake:

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.