SW startup guide for VIBE2

From Yantrr Wiki
Revision as of 07:21, 15 December 2016 by Vaibhav (Talk | contribs) (Understanding the ports for 3G Modem on VIBE2-3G)

Jump to: navigation, search

VIBE2 IoT platform is a unique combination of community famous Beaglebone Black with industry standard modem connectivity for WAN. Below, we describe how to set up VIBE2 and the associated software.

Getting started

Setting up the system

  • Place 3V coin cell(supplied with VIBE2) in the holder for RTC and/or Navika hot start feature.
  • Place a data enabled micro-SIM in the SIM card slot and connect a GSM antenna to the respective 2G/3G antenna connector.
  • Ensure that the power jumpers J2 and J3(ignore if battery feature present) on VIBE are in place and eeprom address set at 0x54 using dip switch S7
  • Power up VIBE2 using the 5V,5A DC adapter(supplied with VIBE2).
  • After powering up and bootup, ssh into VIBE2 by any of the following option  :
a. Through 3.3V UART to USB cable at either of UART0 headers.
b. Through Ethernet Cable (at IP 192.168.1.150 for preflashed eMMC images)
c. Through HDMI monitor and USB keyboard (when HDMI feature present)
Username for root login is root and password is root. For user login, username is debian and password is temppwd.
a. Through 3.3V UART to USB cable

This gives debug-console access to VIBE2. Once login prompt comes, use the above provided username and password to login. These cables are available as an accessory on Yantrr(USB UART adapter with jumper wires) and further options are also listed here.

Download link for Windows drivers for the adapter - click here

b. Through Ethernet cable

Pre-flashed image on the emmc has the fixed IP address as 192.168.1.150 with gateway 192.168.1.1 SSH into VIBE2 over ethernet :

ssh -l root 192.168.1.150

For more help please follow.

c. Through HDMI Display and USB Keyboard

This option is available for use in VIBE2 with HDMI option. Default VIBE2 comes without HDMI configuration.

To ssh into VIBE2 using this method, a micro HDMI to HDMI cable (click here), a display with HDMI port and a USB Keyboard is needed. Setup the VIBE2 with the micro HDMI to HDMI cable, Display and USB keyboard before powering it up. Once VIBE2 starts booting, a login prompt comes within some time. Use the username and password as provided above to login.


After logging into VIBE2, we have to set some GPIOs and effect some configurations so that it can be used desirably. In pre-flashed image, all these settings are pre defined and configured once VIBE2 boots up successfully.

The set of commands executed at bootup in pre-flashed image are in this file :

cd ~
nano boot_run.sh
  • Basically after logging into the VIBE2, GPIOs 44, 45 and 46 have to be set high as output.
cd /sys/class/gpio/
echo 44 > export
echo 45 > export
echo 46 > export
cd gpio44
echo “high” > direction
cd ..
cd gpio45
echo “high” > direction
cd ..
cd gpio46
echo "high" > direction
  • NOTE : In pre-flashed image, for ease of use of regular commands with the GPIOs, functions have been created: pinexp, setout, setin, pinread.
pinexp 45          //export gpio45 to userspace
pinread 45         //read value of gpio45
setin 45           //set gpio45 in input mode
setout 45 high     //set gpio45 in output mode as high value
setout 45 low      //set gpio45 in output mode as low value

Power On Modem

  • For 2GQ-A,2GP-A,3GH-A/B/C/E, 3GC-A and 4GL-E types :
Modem can be powered on by providing a low level pulse at ON/OFF Pin for 3-4s when the module is off. It can be achieved by either using the push button switch S4 or GPIO45.
GPIO45 should always be in default High state.
  • 3G Modems are configured to be turned on after bootup in pre-flashed image or sd card image provided by us. 2G modems need to be issued a Power-On cycle.
cd /sys/class/gpio/
echo 45 > export
cd gpio45
echo "high" > direction
sleep 4
echo "low" > direction
sleep 4
echo "high" > direction
  • After some time, LED D15 should start blinking as to indicate modem has turned on (this feautre is optional in 3GH-A/B/C and 3GC-A modules).
  • For 3GH-D type :
For complete instructions for 3GH-D type of modems please follow.
  • For 3GH-E and 4GL-E type :
For complete instructions for 3GH-E and 4GL-E type of modems please follow.

Following sections are for 3G modem only (for 2G skip to next section) :

Once 3G Modem is properly turned on, check that modem is visible on the USB bus by issuing following command:

lsusb
Bus 001 Device 002: ID 0424:2412 Standard Microsystems Corp.
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 034: ID 21f5:2012 
Bus 001 Device 007: ID 046d:0825 Logitech, Inc. Webcam C270

System messages (logs) show what happened when 3G modem was turned on and its drivers were assigned

dmesg | grep -i usb

usb 1-1.1: New USB device found, idVendor=21f5, idProduct=2012
usb 1-1.1: New USB device strings: Mfr=3, Product=2, SerialNumber=4
usb 1-1.1: Product: StrongRising Technologies
usb 1-1.1: Manufacturer: Modem
usb 1-1.1: SerialNumber: 000000000002
usb 1-1.1: usb_probe_device
usb 1-1.1: configuration #1 chosen from 1 choice
usb 1-1.1: adding 1-1.1:1.0 (config #1, interface 0)
usbserial_generic 1-1.1:1.0: usb_probe_interface
usbserial_generic 1-1.1:1.0: usb_probe_interface - got id
usbserial_generic 1-1.1:1.0: The "generic" usb-serial driver is only for testing and one-off prototypes.
usbserial_generic 1-1.1:1.0: Tell linux-usb@vger.kernel.org to add your device to a proper driver.
usbserial_generic 1-1.1:1.0: generic converter detected
usb 1-1.1: generic converter now attached to ttyUSB0
usb 1-1.1: adding 1-1.1:1.1 (config #1, interface 1)
usbserial_generic 1-1.1:1.1: usb_probe_interface
usbserial_generic 1-1.1:1.1: usb_probe_interface - got id
usbserial_generic 1-1.1:1.1: The "generic" usb-serial driver is only for testing and one-off prototypes.
usbserial_generic 1-1.1:1.1: Tell linux-usb@vger.kernel.org to add your device to a proper driver.
usbserial_generic 1-1.1:1.1: generic converter detected
usb 1-1.1: g'''eneric converter now attached to ttyUSB1'''
usb 1-1.1: adding 1-1.1:1.2 (config #1, interface 2)
usbserial_generic 1-1.1:1.2: usb_probe_interface
usbserial_generic 1-1.1:1.2: usb_probe_interface - got id
usbserial_generic 1-1.1:1.2: The "generic" usb-serial driver is only for testing and one-off prototypes.
usbserial_generic 1-1.1:1.2: Tell linux-usb@vger.kernel.org to add your device to a proper driver.
usbserial_generic 1-1.1:1.2: generic converter detected
usb 1-1.1: '''generic converter now attached to ttyUSB2'''

When using Default debian image without USB drivers for 3G modem, issue following command:

modprobe usbserial vendor=0x21f5 product=0x2012
  • It is recommended to add a proper driver for the modem in kernel. The generic driver is not reliable.
  • Note : If the modem is not visible after the these steps, please cycle through the turn on-off procedure for the modem
  • Note : If the modem is not visible after these steps or any issues are faced while initializing the modem please contact Yantrr Support (support@yantrr.com) with the above log messages (dmesg | grep –I usb or /var/log/syslog).

Understanding the ports for 2G Modem on VIBE2-2G

The 2G modem on VIBE2-2G OR VIBE2-2G-GPS/TIM board is interfaced via UART1.

The 2G modem is accessible over the UART1 port, /dev/ttyO1.

In default Debian images, UART1 port's device tree has to be loaded into the kernel using the following command :

cd /lib/firmware
echo BB-UART1 > /sys/devices/bone-capemgr.*/slots

All the AT Commands can be issued to the 2G modem on ttyO1 port with the baud rate of 115200, 8N1. The UART port of modem is available at one instant only, either it is establishing ppp connection or AT commands are executed on it.

Understanding the ports for 3G Modem on VIBE2-3G

The 3G modem on VIBE2-3G OR VIBE2-3G-GPS/TIM board is interfaced via USB2.0 HS to USB1 host port.

VIBE2-3GH-A/B/C and 3GC-A modems enumerate following serial to USB ports when proper USB drivers are present
/dev/ttyUSB0  /dev/ttyUSB1  /dev/ttyUSB2
  • ttyUSB0 is Data port & AT commands for modem, use this for the WVDIAL or PPPd to establish data connection
  • ttyUSB1 is the diagnostics port for the Firmware upgrade
  • ttyUSB2 is the AT Commands port only.
  • Note :These /dev/ttyUSB ports are only created if proper drivers are present or when “modprobe usbserial” command is issued. Pre-flashed image includes all the USB drivers.
  • Note : Both ttyUSB0 and ttyUSB2 take the AT commands, but ttyUSB0 port is also a Data communications port so for all intended purposes of issuing AT commands use ttyUSB2 port(PCUI port).
VIBE2-3GH-D 

For complete instructions for 3GH-D type of modems please follow.

VIBE2-3GH-E and VIBE2-4GL-E 

For complete instructions for 3GH-E and 4GL-E type of modems please follow.

Power Off Modem

The modem can be powered off by providing a low level pulse at ON/OFF pin for 3-4s when the module is On. It can be achieved by either using the push button switch S4 or GPIO45.

cd /sys/class/gpio/
echo 45 > export
cd gpio45
echo "high" > direction
sleep 4
echo "low" > direction
sleep 4
echo "high" > direction

Modem can also be turned off by issuing following AT commands on port /dev/ttyUSB2 for 3GH-A/B/C type modems.

AT+ZPWROFF

Soft Resetting the Modem

Steps -

  1. Power Off the Modem.
  2. Wait for 1-2s at least.
  3. Power on the modem.

Hard Resetting the Modem

There might arise situations where modem does not seem to be responding to any commands issued on AT commands port or it cannot be turned on/off. In such scenarios, issue hard reset to the modem. It can be done by either toggling Switch S5 for at least 100ms or pulling GPIO44 low for 1s and then setting it high again.

cd /sys/class/gpio/
cd gpio44
echo "low" > direction
sleep 1
echo "high" > direction
  • Note : Please use hard reset conservatively. Soft reset should be preferred under most conditions.

3GH-D modems

For detailed instructions wrt 3GH-D type of modems please follow.

AT Commands Manual

The AT Command Manual for the 2G modem can be downloaded from File:GPRS Module AT Commands.pdf

The AT Command Manual for the 3GH-A/B/C and 3GC-A type Modules can be downloaded from File:Strongrising WCDMA Module AT Command.pdf

The AT Command Manual for the 3GH-D Module can be downloaded from File:AT Command reference guide for ZTEWelink WCDMA Modules V2.5.pdf

Applications

Appendix

Real time clock (RTC)

Timestamping the data and information is a key feature for any IoT and M2M hardware and SW. Standard high precision battery backed RTC (Real Time Clock) is a low cost solution to have a critical timestamping. One can have much more synchronized timestamping and HW synchronization using GPS timing, VIBE2 also supports GPS base HW time synchronization (See application note). RTC act as a heartbeat for both HW and SW timestamping. The RTC maintains minutes, hours, day, date and year information and automatically account changes for the month date depending on the number of days in the month. Also it includes two programmable time-of-day alarm which can be programmed and a programmable square wave output.

  • VIBE2 uses DS3231 as RTC which also comes with compensated crystal oscillator (TCXO) and crystal.
  • The RTC uses I2C2 and all the transfers are made through it.
  • VIBE2 comes with a 3 volt non-rechargeable coin cell (CR1216) for RTC backup.
  • RTC can be time synchronized with GPS (Optional with VIBE2) that can give a time synchronized to GPS for days with minor correction sent from GPS timing.

Setting up RTC on VIBE2

Shipped Beaglebone black does not include a RTC. VIBE2 added RTC to have a key feature for M2M and IoT application where the remote data timestamping is a key feature. The RTC uses I2C, so we can check it using the command

i2cdetect -y -r 1

Rtc1.png

An ID 68 can be seen on the address 0x68 which shows the presence of RTC. This means that the module is wired up and is verified. After this execute the following for our DS3231 module

echo ds1307 0x68 > /sys/class/i2c-adapter/i2c-1/new_device 

The RTC is now ready. Check the present time on the RTC by:

hwclock -r -f /dev/rtc1

Rtc2.png

If it has been accessed the first time then you will see the date as 1 January 2000 as can be seen from the figure. To update to a proper time use ntp:

sudo apt-get install ntp 

To update the time, use

ntpdate -b -s -u pool.ntp.org 

After this check logcat system date and time using

date 

After this write this by using

hwclock -w -f /dev/rtc1 

Rtc3.png

Note: The updated time would be in UTC.

This will update the time. Check it again using the hwclock command:

hwclock -r -f /dev/rtc1 

To start the script at bootup Create a new script in any folder

cd /usr/share/ mkdir rtc 
nano init.sh 

Contents of the script

#!/bin/bash 
echo ds3231 0x68 > /sys/class/i2c-adapter/i2c-1/new_device 
hwclock -s -f /dev/rtc1 
hwclock -w 

Rtc4.png Save the script and then use crontab to start the script at the bootup

crontab -e 
@reboot bash /usr/share/rtc/init.sh

Reboot the system and then check using

hwclock -r -f /dev/rtc1 

It should give the updated time.

Network Time Protocol (NTP)

NTP is a time synchronizing protcol.It synchronizes the time of the machines on a network by using the set of time servers as its reference.

Need for time synchronization

Most of us believe that the computer clocks are accurate, being unaware of the fact that the crystal oscillator that is being used in the computer clocks drift each day because it is sensitive to temperature and other things.It is because of this reason there is a necessity for those organizations to synchronize their computers clocks who requires time accuracy nearest to seconds. Importance of Time Synchronization In today's era time synchronization plays a critical role in managing or debugging things over the network as each event requires time stamp. Following are the areas where time synchronization is critical:

1. Transaction Management

2. Billing Services

3. Detecting the fault over network


Basic Features

1. NTP also requires some time reference clock with whose time it can synchronize the clocks of other computers on the network. It uses UTC as reference time.

2. NTP selects the best among all defined time servers to get synchronize to.It selects the one from which it is receiving the reply in lesser time(i.e. for whom the roundtrip time is least )

3. If the network is temporarily not available then NTP uses previous measurements to get the current time.

Installing and Configuring NTP for GPS NMEA and PPS

To get accurate time, we use the GPS Module Navika100 GPS NMEA messages and 1 PPS signal as inputs and feed it to a NTP server running on the Beaglebone black. This page describes how it is done. The overall architecture is like this: NTP runs as a daemon (ntpd). It receives inputs from servers (pool.ntp.org, etc.), and NMEA drivers.

$ sudo su

Install ntp

$ apt-get install ntp

Change the configuration file of ntp on Beaglebone Black to include the servers according to your time zone to obtain the time.

$ nano /etc/ntp.conf

Add the ntp server as per your location from NTP Pool Servers. If your time zone is Asia and in Asia you are in India then add the following in ntp.conf just after the section where 4 servers from debian are already mentioned and by default commented. Uncomment the first server from that list, to look like this:

server 0.debian.pool.ntp.org
#server 1.debian.pool.ntp.org iburst
#server 2.debian.pool.ntp.org iburst
#server 3.debian.pool.ntp.org iburst
server 0.in.pool.ntp.org
server 3.asia.pool.ntp.org
server 0.asia.pool.ntp.org

Now Save and exit. Restart ntp using

 $ /etc/init.d/ntp re

Console output on HDMI display

  • Edit uEnv.txt file
#nano /boot/uboot/uEnv.txt

and add the following command :

console=tty1,38400n8

and reboot. Console messages will now be visible on HDMI after it has been enabled in kernel.