UART1 buffer preventing W32K mode

Hello, I’m working on the SL8080 FW 2.52.2.A5

I’m encountering problems entering W32K sleep mode and I’m 90% confident it has to do with data accumulating in the UART1 buffer. The data is a combination of unsolicited FW commands (+WIND, +CREG, etc) and my own application outputs from adl_atSendResponse().

While the serial cable is attached the device enters W32K sleep mode without issue because the UART1 buffer is able to clear. But with no serial cable attached the device is unable to enter sleep if any data has been sent to UART1 since removal of the cable. As soon as the cable is attached I see a small amount of data spit out onto my terminal and then the device enters sleep. Essentially I’m preventing the serial port from entering its own sleep state which is delaying the module sleep mode (at least how I see it - correct me if I’m wrong).

It is possible that I simply remove all outputs to UART1 in my application, but this is not ideal for debugging… I require visibility on the terminal side

Is there any way I can adjust the buffer settings on UART1 to not buffer data ?
Is there any way to clear the buffer of data before entering sleep mode?

I’ve been working with the FCM APIs to subscribe to UART1, and then using the adl_fcmFlushV24TxData function to flush port before issuing the W32K command virtually. I’m not even sure if this flush function is what I want to be using.

Here is a similar topic in regards to the SL6087 and UART2, which I found very helpful BTW:

Thanks in advance

Do you perhaps have a pull-up on the RTS line? If so, that may be preventing your application from going to sleep.

btw… a simple solution is to disable UART1 in normal runtime using AT+WMFM=0,0,1 and simply re-enable it when you want to debug (maybe on an input toggle).

Hope this helps

I’ve found AT+IFC=0,0 very helpful when working with W32K mode.
It needs to be sent to UART1, something like
adl_atCmdCreate(“AT+IFC=0,0”, ADL_AT_PORT_TYPE(ADL_PORT_UART1, FALSE), Res_OK_Handler, “*”, NULL);

In the end we have a GPIO connected to RTS&DTR via some funny network of diodes and resistors, so that we can create an edge on the DTR signal in case the module awakens by itself.
I think the AT+W32K=1,0 command now does the same, so you may do without it.

You can also use AT+IFC=0,2 (I’m never sure if it’s 0,2 or 2,0 and I’m also not sure why I prefer it :confused: ).

Don’t forget to set your UART viewer application to ignore flow control.

@milan_va thanks for the tip on AT+IFC. This is exactly what I was looking for. I didn’t realize the buffering I was seeing was related to the hardware flow control. Device is now entering sleep mode with flow control off