Automatic Configuration of Vayu Cape at bootup
From Yantrr Wiki
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
- 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.