Difference between revisions of "GPRS Data"
(2 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
− | |||
− | = How to Set Up GPRS Data on IPLOG-GAMA G2 | + | = How to Set Up GPRS Data on IPLOG-GAMA G2 = |
== IPLOG-GAMA G2 == | == IPLOG-GAMA G2 == | ||
− | The property '''GPRS data''' is disabled from the default configuration. However, the system has everything | + | The property '''GPRS data''' is disabled from the default configuration. However, the system has everything that you need to successfully establish a PPP connection. |
− | This allows the IPLOG-GAMA G2 unit access | + | This allows the IPLOG-GAMA G2 unit to access the mobile Internet. |
Line 19: | Line 18: | ||
− | The file contains two commented lines 45 and 52 (#pon and #poff), delete the comment | + | The file contains two commented lines 45 and 52 (#pon and #poff), delete the comment character '''#''' before. |
The resulting file should look like this:<syntaxhighlight lang="shell" line="1"> | The resulting file should look like this:<syntaxhighlight lang="shell" line="1"> | ||
Line 100: | Line 99: | ||
{{Tip|TipText= <br/> | {{Tip|TipText= <br/> | ||
Text editing - Hit the '''i''' (insert mode).<br/> | Text editing - Hit the '''i''' (insert mode).<br/> | ||
− | Save and Exit - Write | + | Save and Exit - Write the charakters ''':wq''' (write and quit). The cursor moves to bottom of screen whenever a colon (:) is typed. This type of command is completed by hitting the '''Enter''' key. }} |
==== 3. Device Reboot ==== | ==== 3. Device Reboot ==== | ||
Line 109: | Line 108: | ||
==== 4. Check the Connection ==== | ==== 4. Check the Connection ==== | ||
− | After system reboot | + | After system reboot to see that the GPRS connection is working. |
{{NotePre | {{NotePre | ||
|text=root@buildroot:~# ifconfig ppp0 | |text=root@buildroot:~# ifconfig ppp0 | ||
}} | }} | ||
− | If | + | If a connection was established the output will looks like: |
{{NotePre | {{NotePre | ||
Line 127: | Line 126: | ||
}} | }} | ||
− | If connection | + | If the connection is not working: |
{{NotePre | {{NotePre | ||
Line 134: | Line 133: | ||
− | '''Error | + | '''Error Posibilities:''' |
− | [[PIN_Check|SIM card PIN | + | [[PIN_Check|SIM card PIN configuration.]] |
− | GSM LED on the front panel flash | + | GSM LED on the front panel flash or shines = it is not a registered to GSM network. |
− | Antenna is connected and 2G/3G signal is available on site. | + | Antenna is connected and a 2G/3G signal is available on site. |
The APN configuration corresponds to the local operator. | The APN configuration corresponds to the local operator. | ||
− | SIM card contains a credit and mobile data are enable. | + | The SIM card contains a credit and mobile data are enable. |
Line 150: | Line 149: | ||
=== APN Configuration === | === APN Configuration === | ||
− | An Access Point Name (APN) is the name of | + | An Access Point Name (APN) is the name of the gateway between the GSM, GPRS, 3G or 4G mobile networks and another computer network, frequently called public Internet. |
− | In the Czech Republic, the most commonly used name for the APN point is the '''"internet"'''. The "internet" is a default APN point name, if your operator has the same APN name, use the default configuration. It can be different in other countries. Below you can find the easy way how to change name of APN point. | + | In the Czech Republic, the most commonly used name for the APN point is the '''"internet"'''. The "internet" is a default APN point name, if your operator has the same APN name, use the default configuration. It can be different in other countries. Below you can find the easy way how to change name of an APN point. |
==== 1. Edit the Configuration File ==== | ==== 1. Edit the Configuration File ==== | ||
Line 160: | Line 159: | ||
}} | }} | ||
− | File '''gprs-chat''' template. Important is the row 13 begins 'OK AT+CGDCONT=...', where the "YOUR_APN_NAME" is | + | File '''gprs-chat''' template. Important is the row 13 begins 'OK AT+CGDCONT=...', where the "YOUR_APN_NAME" is the name of your APN (including quotes). |
<syntaxhighlight lang="shell" line="1"> | <syntaxhighlight lang="shell" line="1"> | ||
Line 182: | Line 181: | ||
{{Tip|TipText= <br/> | {{Tip|TipText= <br/> | ||
Text editing - Hit the '''i''' (insert mode).<br/> | Text editing - Hit the '''i''' (insert mode).<br/> | ||
− | Save and Exit - Write | + | Save and Exit - Write characters ''':wq''' (write and quit). The cursor moves to bottom of screen whenever a colon (:) is typed. This type of command is completed by hitting the '''Enter''' key. }} |
==== 2. Device Reboot ==== | ==== 2. Device Reboot ==== | ||
Line 194: | Line 193: | ||
=== Monitoring of Active Data Connection === | === Monitoring of Active Data Connection === | ||
− | The PPP connection is established only once until the GSM connection | + | The PPP connection is established only once until the time of a GSM connection failure. Such outages in mobile networks actually occur, and as a result the PPP connection can interrupted. To enable automatic re-connection after the interruption occurred, you will need to upload the appropriate scripts to the device. |
==== 1. Create and Save Script ==== | ==== 1. Create and Save Script ==== | ||
Line 249: | Line 248: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
− | This script checks the internal GSM module connection activity and PPP connection activity. In the | + | This script checks the internal GSM module connection activity and PPP connection activity. In the event, of any error, the cript will try to resolve the problem. By running this script the controlling process will begin and then the script will end. Therefore, it is necessary to run it automatically, for example by using CRON. |
==== 2. Automatic Start - CRON ==== | ==== 2. Automatic Start - CRON ==== | ||
Line 255: | Line 254: | ||
'''*/5 * * * * /home/gsm_wdg.sh''' | '''*/5 * * * * /home/gsm_wdg.sh''' | ||
− | '''Meaning:'''CRON application | + | '''Meaning:''' The CRON application automattically runs the scrip '''/home/gsm_wdg.sh''' every 5 minutes. |
− | After CRON configuration update restart the CRON script. | + | |
+ | After CRON configuration update and restart the CRON script. | ||
{{NotePre | {{NotePre | ||
|text=root@buildroot:~# /etc/init.d/S80crond restart | |text=root@buildroot:~# /etc/init.d/S80crond restart | ||
}} | }} |
Latest revision as of 10:15, 14 June 2019
Contents
How to Set Up GPRS Data on IPLOG-GAMA G2
IPLOG-GAMA G2
The property GPRS data is disabled from the default configuration. However, the system has everything that you need to successfully establish a PPP connection. This allows the IPLOG-GAMA G2 unit to access the mobile Internet.
GPRS Data Enable
1. Edit the Configuration File
Open the file /etc/init.d/S41gprs by default text editor Vi.
root@iplog:~# vi /etc/init.d/S41gprs
The file contains two commented lines 45 and 52 (#pon and #poff), delete the comment character # before.
#!/bin/sh
#
# Starts the GPRS
#
NAME=gprs
CONN=vodafone
PRODUCT=`metel-eeprom -c read product`
PCB_ASS=`metel-eeprom -c read assembly-pcb`
PRODUCT=${PRODUCT##* }
PCB_ASS=${PCB_ASS##* }
join()
{
# $1 - file
# $2 - wait for $2 seconds
for i in $(seq 1 $2)
do
if [ -e $1 ]
then
# Telit found
return 0
else
# Wait: 1s
sleep 1
fi
done
return 1
}
start()
{
printf "Starting $NAME: "
# For IPLOG_GAMA_G2_10052018 and newer wait for supply power ON and Teli
if [ $PRODUCT == 0x494702 ]; then
if [ ${PCB_ASS%%_*} != 27042017 ] && [ ${PCB_ASS%%_*} != 18092017 ]; t
join "/dev/ttyACM0" 15
# wait 5s for catch GSM signal
sleep 5
fi
fi
pon gprs
[ $? = 0 ] && echo "OK" || echo "FAIL"
}
stop()
{
printf "Stopping $NAME: "
poff
[ $? = 0 ] && echo "OK" || echo "FAIL"
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart|reload)
stop
start
;;
*)
echo "Usage: $0 {start|stop|restart}"
exit 1
esac
exit $?
#end-of-file
Tip:
Text editing - Hit the i (insert mode).
Save and Exit - Write the charakters :wq (write and quit). The cursor moves to bottom of screen whenever a colon (:) is typed. This type of command is completed by hitting the Enter key.
3. Device Reboot
It is strongly recommended to do a reboot.
root@buildroot:~# reboot
4. Check the Connection
After system reboot to see that the GPRS connection is working.
root@buildroot:~# ifconfig ppp0
If a connection was established the output will looks like:
ppp0 Link encap:Point-to-Point Protocol inet addr:100.91.38.191 P-t-P:100.91.38.191 Mask:255.255.255.255 UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1500 Metric:1 RX packets:5 errors:0 dropped:0 overruns:0 frame:0 TX packets:6 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:3 RX bytes:68 (68.0 B) TX bytes:120 (120.0 B)
If the connection is not working:
ifconfig: ppp0: error fetching interface information: Device not found
Error Posibilities:
GSM LED on the front panel flash or shines = it is not a registered to GSM network.
Antenna is connected and a 2G/3G signal is available on site.
The APN configuration corresponds to the local operator.
The SIM card contains a credit and mobile data are enable.
APN Configuration
An Access Point Name (APN) is the name of the gateway between the GSM, GPRS, 3G or 4G mobile networks and another computer network, frequently called public Internet. In the Czech Republic, the most commonly used name for the APN point is the "internet". The "internet" is a default APN point name, if your operator has the same APN name, use the default configuration. It can be different in other countries. Below you can find the easy way how to change name of an APN point.
1. Edit the Configuration File
Open the file /etc/ppp/peers/gprs-chat by the default text editor Vi.
root@buildroot:~# vi /etc/ppp/peers/gprs-chat
File gprs-chat template. Important is the row 13 begins 'OK AT+CGDCONT=...', where the "YOUR_APN_NAME" is the name of your APN (including quotes).
TIMEOUT 35
ECHO ON
ABORT '\nBUSY\r'
ABORT '\nERROR\r'
ABORT '\nNO ANSWER\r'
ABORT '\nNO CARRIER\r'
ABORT '\nNO DIALTONE\r'
ABORT '\nRINGING\r\n\r\nRINGING\r'
'' \rAT
OK-+++\c-OK ATH0
OK \rATZ
OK 'ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0'
OK AT+CGDCONT=3,"IP","YOUR_APN_NAME","0.0.0.0",0,0
OK ATD*99***3#
CONNECT ''
Tip:
Text editing - Hit the i (insert mode).
Save and Exit - Write characters :wq (write and quit). The cursor moves to bottom of screen whenever a colon (:) is typed. This type of command is completed by hitting the Enter key.
2. Device Reboot
It is strongly recommended to do a reboot.
root@buildroot:~# reboot
Monitoring of Active Data Connection
The PPP connection is established only once until the time of a GSM connection failure. Such outages in mobile networks actually occur, and as a result the PPP connection can interrupted. To enable automatic re-connection after the interruption occurred, you will need to upload the appropriate scripts to the device.
1. Create and Save Script
Save the script to the directory /home/gsm_wdg.sh.
#!/bin/bash
LOGFILE=/var/log/gsm_wdg.log
NOW=$(date +"%Y%m%d_%H%M%S")
PPP_CONECT=$(ifconfig | grep ppp0 | wc -l)
lsusb | grep -q 1bc7:0021
if [[ $? == 0 ]]; then
echo $NOW :: GSM ok >> $LOGFILE
if [[ $PPP_CONECT == "1" ]]; then
echo $NOW :: "PPP is OK" >> $LOGFILE
exit 0
else
/etc/init.d/S41gprs start
echo $NOW :: "PPP was repaired" >> $LOGFILE
exit 0
fi
fi
echo $NOW :: GSM err, try to fix >> $LOGFILE
/etc/init.d/S41gprs stop
/etc/init.d/S50smsd stop
/etc/init.d/S38gsm restart
NOW=$(date +"%Y%m%d_%H%M%S")
echo $NOW :: GSM HW reset >> $LOGFILE
sleep 10
NOW=$(date +"%Y%m%d_%H%M%S")
lsusb | grep -q 1bc7:0021
if [[ $? == 0 ]]; then
echo $NOW :: GSM ok, try to restart services >> $LOGFILE
/etc/init.d/S41gprs restart
/etc/init.d/S50smsd restart
NOW=$(date +"%Y%m%d_%H%M%S")
echo $NOW :: GSM SW reset >> $LOGFILE
exit 0
fi
echo $NOW :: GSM err, quit >> $LOGFILE
This script checks the internal GSM module connection activity and PPP connection activity. In the event, of any error, the cript will try to resolve the problem. By running this script the controlling process will begin and then the script will end. Therefore, it is necessary to run it automatically, for example by using CRON.
2. Automatic Start - CRON
To the end of file /etc/crontabs/root add the line: */5 * * * * /home/gsm_wdg.sh
Meaning: The CRON application automattically runs the scrip /home/gsm_wdg.sh every 5 minutes.
After CRON configuration update and restart the CRON script.
root@buildroot:~# /etc/init.d/S80crond restart