cancel
Showing results for 
Search instead for 
Did you mean: 

X-CUBE-CELLULAR: UART doesn't process "OK" response from modem to AT

MD'Si.1
Associate III

I am porting X-CUBE-CELLULAR to a new modem and host MCU. I am stuck at the initial modem initialization of the AT command channel when sending the cmd "AT" to the modem.

The modem is Nimbelink TC4NAG and host MCU is Nucleo 144 F429. Flow control is disabled on the modem and no flow control is being used. Baud rate is 115200. I started with the BG96 modem as my example.

I have ported the cellular application and I can confirm UART communication channel is working between the modem and the MCU.

My issue is when the command 'AT' is issued by the MCU the "OK" from the modem's response is not processed (it is like the Modem turns off the UART RX interrupt before waiting for the whole "OK" response. I have turned on trace output and I can see what messages the MCU receives via UART.

On line 89 of the code snipped below you will see the second time I send the "AT" cmd the UART has the character "O" from the previous AT command' response in the response buffer. Is there a timeout setting to adjust to fix this behavior?

===== X-Cube-Cellular version : X-CUBE-CELLULAR-6.0.0 =====
 
-----> New State: BOOT_STATE <-----
TC4NAG UART config: BaudRate=115200 / HW flow ctrl=0
CS:CELLULAR_reset_socket_context
*********** modem state : CA_MODEM_POWER_OFF
IPC:IPC channel 0x20003a80 registered
IPC:state 0x1
IPC:active channel handle: 0x20003a80
IPC:inactive channel handle: 0
IPC:HAL_UART_Receive_IT error
UTILS:ppposif_client_config
ComLib: sim state: rt_state:3 index_slot:0 sim_status:8
=====>CST_notif_callback (Data Cache event=0)
=====>CST_notif_callback (Data Cache event=3)
 
<<< Echoclt 1: wait data is ready to get date and time from network!>>>
 
ATCore:<start ATCore TASK>
AUTOM TASK:  BOOT_STATE - NO_EVENT
============ CST_cellular_service_task : autom_event = no event 
AUTOM TASK:  BOOT_STATE - BOOT_EVENT
*********** CST_boot_event_mngt ********
-----> New State: MODEM_INIT_STATE <-----
AUTOM TASK:  MODEM_INIT_STATE - MODEM_INIT_EVENT
*********** CST_init_state_mngt ********
SysCtrl_NL_TC4NAG :Modem Status ON when Power OFF
SysCtrl_NL_TC4NAG :Waiting 30000 millisec for modem running...
SysCtrl_NL_TC4NAG :...done
SysCtrl_NL_TC4NAG :Modem Status ON after Power ON sequence
IPC:IPC channel 0x20003a80 registered
IPC:state 0x1
IPC:active channel handle: 0x20003a80
IPC:inactive channel handle: 0x20000d1c
IPC:IPC select 0x20000d1c
IPC:Change IPC channels
IPC:state 0x1
IPC:active channel handle: 0x20000d1c
IPC:inactive channel handle: 0x20003a80
Datapack:<MAX SIZE INFO> msgtype=4 size=0 (biggest =0)
ATCModem:No data to unpack for SID 101
ATCModem:<modem custom> build the cmd  (type=5, length=0)
ATCModem:==== CMD TIMEOUT = 0 ====
ATCModem:atcm_modem_build_cmd returned status = 0
ATCustom:atcc_getCmd returned status = 0
    ATParser:ATParser_get_ATcmd returned action = 0x2
ATCore:**** Waiting Sema (to=0) *****
IPC:IPC abort 0x20000d1c
BG96:test connection [try number 1] 
ATCModem:<modem custom> build the cmd  (type=4, length=0)
ATCModem:==== CMD TIMEOUT = 1000 ====
ATCModem:atcm_modem_build_cmd returned status = 0
ATCustom:atcc_getCmd returned status = 0
    ATParser:*** SEND (size=3) ***
AT<CR>
ATParser:ATParser_get_ATcmd returned action = 0x2
ATCore:**** Waiting Sema (to=1000) *****
ATCore:Msg received callback
IPC:DBG IPC_RXFIFO_readMsgHeader: index_read = 0
IPC:header_byte1[0x80] header_byte2[0x6]
IPC:complete=1 size=6
    <NULL CHAR>AT<CR><CR><LF>
BG96:input message: size=6 
ATCustom:start idx=0  end idx=2  size=3 rank=1
ATCustom:atcc_extractElement returned endmsg = 1
BG96:receive an un-expected line... is it a text line ?
ATCustom:atcc_analyzeCmd returned action = 0x10
ATParser:analyzeCmd retval = 16 (DATA mode=0) msg_end = 1
ATParser:ATParser_parse_rsp returned action = 0x10
ATCore:RAW ACTION (analyze_action_result) = 0x10
ATCore:CLEANED ACTION=16 (data mode=0)
ATCore:**** Sema Timeout (=1000) !!! *****
ATCore:**** Sema Freed *****
ATCore:TIMEOUT EVENT(1000 ms)
IPC:IPC abort 0x20000d1c
BG96:test connection [try number 2] 
ATCModem:<modem custom> build the cmd  (type=4, length=0)
ATCModem:==== CMD TIMEOUT = 1000 ====
ATCModem:atcm_modem_build_cmd returned status = 0
ATCustom:atcc_getCmd returned status = 0
    ATParser:*** SEND (size=3) ***
AT<CR>
ATParser:ATParser_get_ATcmd returned action = 0x2
ATCore:**** Waiting Sema (to=1000) *****
ATCore:Msg received callback
IPC:DBG IPC_RXFIFO_readMsgHeader: index_read = 8
IPC:header_byte1[0x80] header_byte2[0x6]
IPC:complete=1 size=6
    OAT<CR><CR><LF>
BG96:input message: size=6 
ATCustom:start idx=0  end idx=2  size=3 rank=1
ATCustom:atcc_extractElement returned endmsg = 1
BG96:receive an un-expected line... is it a text line ?
ATCustom:atcc_analyzeCmd returned action = 0x10
ATParser:analyzeCmd retval = 16 (DATA mode=0) msg_end = 1
ATParser:ATParser_parse_rsp returned action = 0x10
ATCore:RAW ACTION (analyze_action_result) = 0x10
ATCore:CLEANED ACTION=16 (data mode=0)
ATCore:**** Sema Timeout (=1000) !!! *****
ATCore:**** Sema Freed *****
ATCore:TIMEOUT EVENT(1000 ms)

Here is a capture of what the MCU sees on the UART RX line ONLY. THe modem has echo mode ON. It responds as expected but the modem doesn't see the 'OK' response to process it.

AT
OK
AT
OK
AT
OK
AT
OK
AT
OK
AT
OK
AT
OK
AT
OK
AT
OK
AT
OK
AT
OK
AT
OK
AT
OK
AT
OK

1 ACCEPTED SOLUTION

Accepted Solutions
MD'Si.1
Associate III

I switched the order of Power up and Open channel in the Sysctrl power on function. Reverting back to the original order i.e. 1) Power up 2) open Uart channel seems to have resolved this.

View solution in original post

1 REPLY 1
MD'Si.1
Associate III

I switched the order of Power up and Open channel in the Sysctrl power on function. Reverting back to the original order i.e. 1) Power up 2) open Uart channel seems to have resolved this.