EM7455: at-commands are sent incorrectly

Very strange things happen with EM7455. I noticed that commands through atinout often do not pass through the first time, and because of this my script to restore the connection does not work properly.
Example of an error (OpenWrt):

root@Xiaomi-Mi-Router-3G:~# echo at!gstatus? | atinout - /dev/ttyUSB2 -
at!b


ERROR
root@Xiaomi-Mi-Router-3G:~# echo at!gstatus? | atinout - /dev/ttyUSB2 -


ERROR
root@Xiaomi-Mi-Router-3G:~# echo at!gstatus? | atinout - /dev/ttyUSB2 -
at!gstatus?


!GSTATUS:

Current Time:  26655            Temperature: 33

Reset Counter: 1                Mode:        ONLINE

System mode:   LTE              PS state:    Not attached

LTE band:      No band          LTE bw:      1.4 MHz

LTE Rx chan:   0                LTE Tx chan: 4294967295

LTE CA state:  NOT ASSIGNED

EMM state:     Deregistered     Attach Needed

RRC state:     RRC Idle

IMS reg state: No Srv



PCC RxM RSSI:  0                RSRP (dBm):  0

PCC RxD RSSI:  0                RSRP (dBm):  0

Tx Power:      --               TAC:         FFFF (65535)

RSRQ (dB):     0.0              Cell ID:     FFFFFFFF (4294967295)

SINR (dB):





OK
root@Xiaomi-Mi-Router-3G:~# echo at!gstatus? | atinout - /dev/ttyUSB2 -


ERROR
root@Xiaomi-Mi-Router-3G:~# echo at!gstatus? | atinout - /dev/ttyUSB2 -
at!gren E cttacIrFat!gstatus?


ERROR
root@Xiaomi-Mi-Router-3G:~#

This happens on the router (OpenWrt 22.03.5 and Rooter) and on a laptop with Ubuntu. Also the same picture is observed if you use socat or echo+cat instead of atinout. (!!!)And only picocom on all devices works without these glitches. Curiously, atinout, socat and echo+cat also work properly when actively connected via picocom. But when I leave the picocom, these utilities start outputting garbage again after a few commands.
I tried changing the firmware on the modem (02.38.00 and 02.33.03), but even in this case after some number of successful sends the errors start again.
Example of an error (Ubuntu):

------------------------------------------------------------------------
firmware update operation finished successfully
vars-cat@varscat-Latitude-E6530:~$ echo "at!gstatus?" | sudo ./atinout - /dev/ttyUSB2 -
at!gstatus?


!GSTATUS: 

Current Time:  79		Temperature: 33

Reset Counter: 6		Mode:        ONLINE         

System mode:   LTE        	PS state:    Not attached 

LTE band:      No band		LTE bw:      1.4 MHz 

LTE Rx chan:   0		LTE Tx chan: 4294967295

LTE CA state:  INACTIVE    		LTE Scell band:No band

LTE Scell bw:1.4 MHz 		LTE Scell chan:0

EMM state:     Deregistered   	Limited Service

RRC state:     RRC Idle       

IMS reg state: No Srv  		



PCC RxM RSSI:  0		RSRP (dBm):  0

PCC RxD RSSI:  0		RSRP (dBm):  0

SCC RxM RSSI:  0		RSRP (dBm):  0

SCC RxD RSSI:  0		RSRP (dBm):  0

Tx Power:      --		TAC:         0000 (0)

RSRQ (dB):     0.0		Cell ID:     00000000 (0)

SINR (dB):     





OK
vars-cat@varscat-Latitude-E6530:~$ echo "at!impref?" | sudo ./atinout - /dev/ttyUSB2 -
at!impref?


!IMPREF: 

 preferred fw version:    02.38.00.00

 preferred carrier name:  GENERIC

 preferred config name:   GENERIC_002.082_000

 preferred subpri index:  000

 current fw version:      02.38.00.00

 current carrier name:    GENERIC

 current config name:     GENERIC_002.082_000

 current subpri index:    000



OK
vars-cat@varscat-Latitude-E6530:~$ echo "at!lteinfo?" | sudo ./atinout - /dev/ttyUSB2 -
at!lteinfo?


!LTEINFO: Unavailable





OK
vars-cat@varscat-Latitude-E6530:~$ echo "at!entercnd=\"A710\"" | sudo ./atinout - /dev/ttyUSB2 -
at!entercnd="A710"


OK
vars-cat@varscat-Latitude-E6530:~$ echo "at!usbcomp?" | sudo ./atinout - /dev/ttyUSB2 -
at!usbcomp?


Config Index: 1

Config Type:  1 (Generic)

Interface bitmask: 0000010D (diag,nmea,modem,rmnet0) 



OK
vars-cat@varscat-Latitude-E6530:~$ echo "at!image?" | sudo ./atinout - /dev/ttyUSB2 -
at!at!at!image?


ERROR
vars-cat@varscat-Latitude-E6530:~$

suggest you trying with minicom with ubuntu PC
Also you need to stop modem manager as it might also send AT command to the module

For five minutes I kept sending commands via atinout on Ubuntu, but this time I couldn’t catch the error :smiley:
Minicom on Ubuntu works fine, as well as picocom.
But when I connected this modem to an OpenWrt router, I got an error when sending the fourth command. After connection via picocom, commands via atinout started to be sent without errors. After exiting picocom, after two or three commands errors started to appear :frowning:
How can I find out what in OpenWrt prevents sending atinout commands? There is no information in the log, and modemmanager is not installed.

Can you use minicom in openwrt?

Yes, I can. The at-commands are being sent without error.

then seems to be your atinout has some problem?

I think it’s not about atinout. socat and echo+cat also work with errors.

then why does minicom have no problem in your environment?

I’d like to know that too :smiley:
Even more interesting is this (OpenWrt):

It looks like the issue is not with the modem, but with OpenWrt, so I should ask this question on another forum where there are OpenWrt experts.

Solution: stty -F /dev/ttyUSB2 raw -echo