RAK3172 - UART1 Issues

Hi,

please, what is the secret to operate the UART1 in RAK_CUSTOM_MODE ?

Hardware: RAK3172
Latest firmware: RUI_4.2.1

UART2 works perfectly in Default mode.

For UART1 it is very unstable. Normally the reception works but transmission not, or sometimes works for some bytes and stops again.

Is there any restriction for the baudrate? Seems it is a bit more stable when in 9600bps, and very unstable in 115200bps.

I already tried the Serial1.flush() command and does not solve the issue.
Also tried some tips from the forum, like Begin and End the serial twice, also not working.

Any advice?

Thank you

Are you using low power mode? If yes, what low power mode level did you set.

Other than that, I used UART1 with our RS485 module to communicate with a soil sensor without problems.

Hi @beegee ,

yes, low power mode is set like this:
lpmlvl = 2
lpm = 1

But, isnt low power mode effective only when the system goes to sleep mode, after calling api.system.sleep.all?

Thanks

If you set the low power mode and level, it will always go to sleep if the MCU doesn’t have any other pending process.
When activating low power mode, there is no need for api.system.sleep.all.

And, if I do not set low power mode and level and call the api.system.sleep.all, the power consumption will be the same?

I will test this scenario to confirm the continuos operation of the UART1.

I can’t say, didn’t use api.system.sleep.all() since LPMLVL and LPM activation was introduced.

LPM level 2 will disable the UART1, you might still need to set the level to 0 (off) or 1 to get the UART1 to work.

Hi @beegee ,

I am still evaluating this topic. It is working now, I had to add a delay between the transmissions (write to serial port)…
Is there a best practice to help in the system robustness?
Should I use the Serial1.flush() after the transmission?

Thank you

Serial1.flush() might help as it is forcing to send any bytes left in the TX buffer.
9600 baud is quite slow. You might need to calculate the delay required to send all bytes of a transmission at that speed before sending the next packet.

1 Like