I wanted to understand how to talk to the Pyra's modem so I started by studying how hns does it in the wwan-status script. I've tidied this up a bit to give more description in its output and reduced the delay a bit so it runs faster.
The original script is from the letux kernel tree and is installed on the pyra at /usr/share/pyra/scripts/letux/wwan-status
If you want to add more AT commands they are described in the datasheets on the Thales website.
The original script is from the letux kernel tree and is installed on the pyra at /usr/share/pyra/scripts/letux/wwan-status
If you want to add more AT commands they are described in the datasheets on the Thales website.
Modem power usage from INA231:
Current = 8mA
Voltage = 4.065V
Power = 34.375mW
-------------
SIM status : AT^SCKS?
^SCKS: 0,2
OK
-------------
Manufacturer : AT+CGMI
Cinterion
OK
-------------
Model : AT+CGMM
PLS8-E
OK
-------------
Revision : AT+CGMR
REVISION 02.011
OK
-------------
Request International Mobile Equipment Identity (IMEI) : AT+CGSN
358000000000000
OK
-------------
International Mobile Subscriber Identity (IMSI) : AT+CIMI
+CME ERROR: SIM PIN required
-------------
PIN status : AT+CPIN?
+CME ERROR: SIM failure
-------------
Network name : AT+COPS?
+CME ERROR: SIM PIN required
-------------
Network connection : AT+WS46?
+WS46: 25
OK
-------------
Signal quality : AT+CSQ
+CME ERROR: SIM PIN required
-------------
Battery voltage : AT^SBV
^SBV: 4066
OK
-------------
Temperature : AT^SCTM=0,1
OK
-------------
Real time clock : AT+CCLK?
+CCLK: "80/01/06,04:14:02"
OK
-------------
GPS/GLONASS status : AT^SGPSC?
^SGPSC: "Engine","0"
^SGPSC: "Nmea/Freq",1
^SGPSC: "Nmea/Glonass","on"
^SGPSC: "Nmea/Output","off"
^SGPSC: "Nmea/Urc","off"
^SGPSC: "Power/Antenna","auto"
OK
-------------
Serving cell : AT^SMONI
^SMONI: 4G,1617,3,20,20,FDD,234,30,2C2F,0841400,497,9,-118,-18,LIMSRV
OK
-------------
Neighbour cell : AT^SMONP
+CME ERROR: operation not supported
Current = 8mA
Voltage = 4.065V
Power = 34.375mW
-------------
SIM status : AT^SCKS?
^SCKS: 0,2
OK
-------------
Manufacturer : AT+CGMI
Cinterion
OK
-------------
Model : AT+CGMM
PLS8-E
OK
-------------
Revision : AT+CGMR
REVISION 02.011
OK
-------------
Request International Mobile Equipment Identity (IMEI) : AT+CGSN
358000000000000
OK
-------------
International Mobile Subscriber Identity (IMSI) : AT+CIMI
+CME ERROR: SIM PIN required
-------------
PIN status : AT+CPIN?
+CME ERROR: SIM failure
-------------
Network name : AT+COPS?
+CME ERROR: SIM PIN required
-------------
Network connection : AT+WS46?
+WS46: 25
OK
-------------
Signal quality : AT+CSQ
+CME ERROR: SIM PIN required
-------------
Battery voltage : AT^SBV
^SBV: 4066
OK
-------------
Temperature : AT^SCTM=0,1
OK
-------------
Real time clock : AT+CCLK?
+CCLK: "80/01/06,04:14:02"
OK
-------------
GPS/GLONASS status : AT^SGPSC?
^SGPSC: "Engine","0"
^SGPSC: "Nmea/Freq",1
^SGPSC: "Nmea/Glonass","on"
^SGPSC: "Nmea/Output","off"
^SGPSC: "Nmea/Urc","off"
^SGPSC: "Power/Antenna","auto"
OK
-------------
Serving cell : AT^SMONI
^SMONI: 4G,1617,3,20,20,FDD,234,30,2C2F,0841400,497,9,-118,-18,LIMSRV
OK
-------------
Neighbour cell : AT^SMONP
+CME ERROR: operation not supported
Bash:
#!/bin/bash
#
# print UMTS modem status
#
# usage: wwan-status
#
# Create an array of commands and descriptions
CMDS=()
CMDS+=('AT^SQPORT?' ); DESC+=('Port (Application, Modem, ...)')
CMDS+=('AT^SCKS?' ); DESC+=('SIM status')
CMDS+=('AT+CGMI' ); DESC+=('Manufacturer')
CMDS+=('AT+CGMM' ); DESC+=('Model')
CMDS+=('AT+CGMR' ); DESC+=('Revision')
CMDS+=('AT+CGSN' ); DESC+=('Request International Mobile Equipment Identity (IMEI)')
CMDS+=('AT+CIMI' ); DESC+=('International Mobile Subscriber Identity (IMSI)')
CMDS+=('AT+CPIN?' ); DESC+=('PIN status')
CMDS+=('AT+COPS?' ); DESC+=('Network name')
CMDS+=('AT+WS46?' ); DESC+=('Network connection')
CMDS+=('AT+CSQ' ); DESC+=('Signal quality')
CMDS+=('AT^SBV' ); DESC+=('Battery voltage')
CMDS+=('AT^SCTM=0,1' ); DESC+=('Temperature')
CMDS+=('AT+CCLK?' ); DESC+=('Real time clock')
CMDS+=('AT^SGPSC?' ); DESC+=('GPS/GLONASS status')
CMDS+=('AT^SMONI' ); DESC+=('Serving cell')
CMDS+=('AT^SMONP' ); DESC+=('Neighbour cell')
SCRIPTPATH="$(dirname "$0")"
IF="$($SCRIPTPATH/wwan-on)"
case "$IF" in
"" )
echo Modem Application interface not found >&2
exit 1
;;
/dev/ttyACM[0-4] | /dev/ttyUSB[0-4] ) # Neo900 / Pyra with PHS8/PLS8
INA231=$($SCRIPTPATH/findhwmon ina231)
if [ "$INA231" ]
then
pmuw=$(cat $INA231/power1_input)
pmv=$(cat $INA231/in1_input)
pw=$(bc <<< "scale=3; $pmuw/1000")
pv=$(bc <<< "scale=3; $pmv/1000")
echo Modem power usage from INA231:
# echo "shunt resistor: $(cat $INA231/shunt_resistor) uOhm"
# echo "across shunt voltage: $(cat $INA231/in0_input) mV"
echo "Current = $(cat $INA231/curr1_input)mA"
echo "Voltage = ${pv}V"
echo "Power = ${pw}mW"
fi
for i in $(seq 1 $((${#CMDS[@]}-1))); do
cmd=${CMDS[i]}
desc=${DESC[i]}
echo "-------------"
echo -n "$desc : "
(echo "$cmd"; sleep 0.2) | ${SCRIPTPATH}/femtocom ${IF} | sed -r '/^\s*$/d'
done
echo
;;
esac
Last edited: