Mbed cellular QIRD (read from tcpip connection) missing data

Hey. I’m trying to run a MQTT cliend with Quectel EC25 modem, using AT TCP/IP commands.
Since mbed does not support AT commands for EC25, I had do port the stack from BG96 modem. (which uses the same commands)

After few minutes of running, meaning, MQTT succesfully connects, and always at the same spot, I get some weird read error from the low level of the driver:

[INFO][CELL]: AT RX (18): <cr><ln>+QIRD: 0<cr><ln><cr><ln>OK<cr><ln>
[INFO][CELL]: AT TX ( 8): AT+QIRD=
[INFO][CELL]: AT TX ( 1): 0
[INFO][CELL]: AT TX ( 1): ,
[INFO][CELL]: AT TX ( 1): 1
[INFO][CELL]: AT TX ( 1): <cr>
[INFO][CELL]: AT RX (18): <cr><ln>+QIRD: 0<cr><ln><cr><ln>OK<cr><ln>
[INFO][CELL]: AT TX ( 8): AT+QIRD=
[INFO][CELL]: AT TX ( 1): 0
[INFO][CELL]: AT TX ( 1): ,
[INFO][CELL]: AT TX ( 1): 1
[INFO][CELL]: AT TX ( 1): <cr>
[INFO][CELL]: AT RX (18): <cr><ln>+QIRD: 0<cr><ln><cr><ln>OK<cr><ln>
[INFO][CELL]: AT TX ( 8): AT+QIRD=
[INFO][CELL]: AT TX ( 1): 0
[INFO][CELL]: AT TX ( 1): ,
[INFO][CELL]: AT TX ( 1): 1
[INFO][CELL]: AT TX ( 1): <cr>
[INFO][CELL]: AT RX (13): <cr><ln>+QIRD<cr><ln>OK<cr><ln>
[ERR ][CELL]: Socket 0 recv error -1

Looking closely at this, I spotted that for some reason, the last +QIRD response is missing characters, which I’m guessing causes the error.

Sometimes it fails like so:

[INFO][CELL]: AT TX ( 8): AT+QIRD=
[INFO][CELL]: AT TX ( 1): 0
[INFO][CELL]: AT TX ( 1): ,
[INFO][CELL]: AT TX ( 1): 1
[INFO][CELL]: AT TX ( 1): <cr>
[INFO][CELL]: AT RX (13): <cr><ln>+QIR<ln><cr><ln>OK<cr><ln>

I’m running buffered serial with 115200 baud rate and flowcontrol (this baud rate is set as default on the modem)

Any insight would be greatly appreciated

If this is an STM32 processor, it may be this bug: STM32 processors cannot receive UART at even moderate baudrates while asleep · Issue #205 · mbed-ce/mbed-os · GitHub

The only known fix, I’m afraid, is to completely disable sleep on your processor.