Automatic Configuration of Vayu Cape at bootup

From Yantrr Wiki
Revision as of 02:59, 31 March 2015 by Mayank (Talk | contribs)

Jump to: navigation, search

Automatic Start Of Internet Connection On Boot

STEPS

  • An SSH script with all desired commands such as GPS reset, modem reset, modem ON/OFF can be written .
  • Login as root
cd~
nano boot_run.sh
  • The sample boot_run.sh file looks like this:
#!/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
#/bin/sleep 5							
/sbin/ip route list exact default                               # To get the default gateway 
/bin/echo 'All done'

  • Make this file executable
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

  • For the precompiled images uploaded on Yantrr Wiki page the scripts are in place with all these settings preconfigured.