Difference between revisions of "Automatic Configuration of Vayu Cape at bootup"

From Yantrr Wiki
Jump to: navigation, search
(Automatic Start of PPP connection at bootup)
 
(10 intermediate revisions by 2 users not shown)
Line 1: Line 1:
== '''<big>Automatic Start Of Internet Connection On Boot'''</big> ==
+
== Automatic Configuration of Vayu Cape at bootup ==
'''<big>STEPS'''</big>
+
 
* An SSH script with all desired commands such as GPS reset, modem reset, modem ON/OFF can be written .
+
Following steps can be executed for the first time and it will setup the Vayu-Cape for automatically configuring different functions at bootup.
 +
 
 +
* Create a SSH script with all the commands required to configure different functions on Cape such as GPS module reset gpio, 2G/3G modem reset gpio, 2G/3G modem ON/OFF gpio and calling device tree overlays for UART ports.
 +
 
 
* Login as root
 
* Login as root
 
<pre>
 
<pre>
Line 8: Line 11:
 
</pre>
 
</pre>
  
* The sample boot_run.sh file looks like this:
+
* A sample script (boot_run.sh) used by us:
 
<pre>
 
<pre>
 
#!/bin/sh -e
 
#!/bin/sh -e
Line 38: Line 41:
 
/bin/echo 'Already started Ntp'
 
/bin/echo 'Already started Ntp'
 
/bin/echo 'Bringing up dialup'
 
/bin/echo 'Bringing up dialup'
#/usr/bin/pon SERVICE_PROVIDER # Start the PPPD connection
+
/usr/bin/pon SERVICE_PROVIDER # Start the PPPD connection for SERVICE_PROVIDER
#/bin/sleep 5
+
/bin/sleep 5
/sbin/ip route list exact default                              # To get the default gateway  
+
/sbin/ip route list exact default                              # To get the default gateway
 
/bin/echo 'All done'
 
/bin/echo 'All done'
  
 
</pre>
 
</pre>
* Make this file executable
+
* Make this file executable. Need to do it only the first time.
 
<pre>
 
<pre>
 
chmod +x boot_run.sh
 
chmod +x boot_run.sh
 
</pre>
 
</pre>
  
* Make a crontab entry for this script to start at bootup.
+
* Make a crontab entry for this script to start at bootup.  
 
<pre>
 
<pre>
 
@reboot /root/boot_run.sh >> /root/boot_run.log  
 
@reboot /root/boot_run.sh >> /root/boot_run.log  
 
</pre>
 
</pre>
 +
 
[[File:Crontab entry.png]]
 
[[File:Crontab entry.png]]
* For the precompiled images uploaded on Yantrr Wiki page the scripts are in place with all these settings preconfigured.
 
  
===='''<big>Automatic Configuration Of Vayu Cape at Bootup'''</big>====
+
* In precompiled images uploaded [http://www.yantrr.com/wiki/Vayu_Cape_SW_images_and_drivers#Download_Files: here] this script is already present.
 +
 
 +
== Automatic Start of PPP connection at bootup ==
 +
 
 
* For an always-on connection, most reliable way is to setup pppd as a respawning daemon in init
 
* For an always-on connection, most reliable way is to setup pppd as a respawning daemon in init
 +
  http://www.tldp.org/HOWTO/Leased-Line/pppd.html
 +
* Use wvdialconf and pppconfig to set up your ISP carrier parameters for using wvdial and pppd resepectively.

Latest revision as of 02:57, 31 March 2015

Automatic Configuration of Vayu Cape at bootup

Following steps can be executed for the first time and it will setup the Vayu-Cape for automatically configuring different functions at bootup.

  • Create a SSH script with all the commands required to configure different functions on Cape such as GPS module reset gpio, 2G/3G modem reset gpio, 2G/3G modem ON/OFF gpio and calling device tree overlays for UART ports.
  • Login as root
cd~
nano boot_run.sh
  • A sample script (boot_run.sh) used by us:
#!/bin/sh -e
/bin/sleep 10
/bin/echo ==============================
/bin/echo 'Setting pins'
/root/bin/pinexp 50						 # GPS MODULE RESET(GPIO 50) is exported			
/root/bin/setout 50 high					 # GPIO 50 is SET HIGH			
/root/bin/pinexp 60						 # MODEM RESET(GPIO 50) is exported to shell
/root/bin/setout 60 high					 # GPIO 60 is SET HIGH
/root/bin/pinexp 45						 # ON/OFF PIN (GPIO 45) is exported
/root/bin/setout 45 high					 # A low level pulse for 4s is applied on ON/OFF(GPIO 45)
                                                                   Pin to turn ON the modem 
/bin/sleep 4
/root/bin/setout 45 low
/bin/sleep 4
/root/bin/setout 45 high
cd /lib/firmware						# Enter device tree kernel
/bin/echo BB-UART1 > /sys/devices/bone_capemgr.9/slots		# Enable UART1 in device tree kernel to communicate
                                                                  with 2G modem
/bin/echo BBB_VAYU > /sys/devices/bone_capemgr.9/slots		
/bin/echo BB-UART4 > /sys/devices/bone_capemgr.9/slots		# Enable UART4 in device kernel to receive NMEA messages 
                                                                  from GPS module 
/bin/stty -F /dev/ttyO4 19200 raw				# Set serial port settings to see NMEA messages
ln -s /dev/ttyO4 /dev/gps1
ln -s /dev/pps1 /dev/gpspps1					 
/bin/echo 'Done with pins and devices'				# Start the NTP server at  boot
/usr/sbin/service ntp restart
/bin/echo 'Already started Ntp'
/bin/echo 'Bringing up dialup'
/usr/bin/pon SERVICE_PROVIDER					# Start the PPPD connection for SERVICE_PROVIDER
/bin/sleep 5							
/sbin/ip route list exact default                               # To get the default gateway
/bin/echo 'All done'

  • Make this file executable. Need to do it only the first time.
chmod +x boot_run.sh
  • Make a crontab entry for this script to start at bootup.
@reboot /root/boot_run.sh >> /root/boot_run.log 

Crontab entry.png

  • In precompiled images uploaded here this script is already present.

Automatic Start of PPP connection at bootup

  • For an always-on connection, most reliable way is to setup pppd as a respawning daemon in init
 http://www.tldp.org/HOWTO/Leased-Line/pppd.html
  • Use wvdialconf and pppconfig to set up your ISP carrier parameters for using wvdial and pppd resepectively.