Problems with UART - BG95M3

Hi,

We are trying to perform read/write operations on the UART of the BG95-M3, and the strategy we are following is as follows:
We are using UART 0 → Tx = Pin 23. Rx = Pin 22.

baudrate, databits, parity, stopbits, flowctl = 115200, 8, 0, 1, 0

uart0 = UART(UART.UART0, baudrate, databits, parity, stopbits, flowctl)
  • We open the UART with the function uart0.init(baudrate, databits, parity, stopbits, flowctl).
  • We add the callback to the UART.
  • We perform read/write operations.
  • We close the UART with uart0.close().

This process is done every minute, although the time is configurable, ranging from a few seconds to several minutes.

The issue occurs when, after a considerable amount of time (2-3 hours), the initialization line throws the following error:
UART(0) init fail.

I am testing without closing the UART using the uart0.close() instruction, i.e., we keep it open the whole time, and it has been running for a full day without crashing. However, the consumption is much higher, around 12 mA, so we would prefer to use the strategy of opening/closing the UART when needed, with a consumption of around 3/4 mA.

Why is this problem happening?

Is there any limitation on the number of times we can initialize/close the UART process, or could it be related to how Quecpython handles resource release when executing uart0.close()?

Hi,

The modem may not enter deep sleep when the UART is open; if the fast power-on/power-off coincides with the sleep transition when closed, EBUSY / UART(0) init failure may occur.

Can you try increasing the power-on/power-off frequency to ≥ 5–10 seconds?

Empty the RX buffer before shutting down.
Add a 50–100 ms delay before shutting down/sleeping.
It would be beneficial to apply a retry/backoff during startup.

Hi,

I will try the suggestions.
Thank you very much for the quick response.

BR