My HAT and Telit LE910C1 runs OK after the installation and connection works well.
How can I automate the step of giving the AT-command for the boot to avoid manually activating the connection via AT commands?
AT#ECM=1,0,"","",0
Currently I give it with the minicom, but it MUST be automated.
Regards,
-severi
I have the same question. This is kind of a dealbreaker for managing the device remotely.
Hi,
have you figured out a way of solving it?
I just had to figure this out myself and here is what I came up with that seems to be working well.
first, make sure that modemmanager is not installed because otherwise it tries to take over:
sudo apt-get remove modemmanager
Next make the serial port writable by non-root users (optional but otherwise use root crontab – untested)
chmod o+rw /dev/ttyUSB2
Next make a shell script to do the monitoring and reconnecting: sudo nano ~/net_fix.sh
#!/usr/bin/bash
ping -I wwan0 -c 1 8.8.8.8 > /dev/null
ping_result_1=$?
sleep 1
ping -I wwan0 -c 1 8.8.4.4 > /dev/null
ping_result_2=$?
if [ $ping_result_1 -ne 0 ] && [ $ping_result_2 -ne 0 ]; then
stty -F /dev/ttyUSB2 115200 raw -echo -echoe -echok -echoctl -echoke 2> /dev/null
echo -ne '\rAT#REBOOT\r' > /dev/ttyUSB2
sleep 50 # 25 is the minimum. Safety factor of 2
stty -F /dev/ttyUSB2 115200 raw -echo -echoe -echok -echoctl -echoke 2> /dev/null
echo -ne '\rAT#ECM=1,0,"","",0\r' > /dev/ttyUSB2
fi
make the script executable:
sudo chmod +x ~/net_fix.sh
make a cron job to run the script every two minutes: crontab -e
*/2 * * * * /home/pi/net_fix.sh
That will force the modem to reboot and reconnect every two minutes if it cannot ping either 8.8.8.8 or 8.8.4.4 (the google dns servers)
5 Likes