FreeRTOS / FreeRTOS-Cellular-Interface

FreeRTOS Cellular Interface implementation of the 3GPP TS v27.007 standard.
MIT License
85 stars 59 forks source link

_Cellular_AtcmdDataSend never catches the "> " message #109

Closed gmodcake closed 2 years ago

gmodcake commented 2 years ago

I'm using the same implementation of the comm interface as the comm_st_uart.c.

Everything works fine, I setup the modem and then open the socket. Once it's open I use Cellular_SocketSend to send a packet on the socket, but it hangs until timeout and does not send the data. The UART interface does catch the "\r\n> " sent by the modem, but the library doesn't seem to catch it. Any idea ? My modem is the BG96

image

gmodcake commented 2 years ago

After some debbuging, it seems that the _handleRxDataEventin the RX thread fires after the _Cellular_AtcmdRequestTimeoutWithCallbackRaw times out in _Cellular_AtcmdDataSend. The "> " is received immediately tho.

What could be causing this ?

gmodcake commented 2 years ago

I found the solution, if it can help another here is what I what I was doing wrong :

I was calling Cellular_SocketSend(...) directly into the CelluluarSocketOpenCallback_t method. I simply moved the code somewhere else in a task where it xEventGroupWaitBits for a bit that I set in the callback.

Don't put cellular commands directly into callbacks basically.