Difference between revisions of "SW startup guide for VIBE2"

From Yantrr Wiki
Jump to: navigation, search
(AT Commands Manual)
 
(27 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
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.
 
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)
  
==Overview==
+
:: Username for root login is '''''root''''' and password is '''''root'''''. For user login, username is '''''debian''''' and password is '''''temppwd'''''.
VIBE2 is 2nd generation IoT hardware platform which provides a unique combination of industrial sensor interfaces (Ethernet, SPI, I2C, RS232, CAN, GPIO, PWM, ADC), worldwide 3G/HSPA+ connectivity (US carriers certified), optional local area WiFi & Bluetooth Low Energy (BT4.1) networking and a low power ARM processor for both industrial machine-to-machine (M2M) and home IoT applications. In an approximately 2x credit card size board, VIBE2 modularl design integrates wireless LAN/WAN connectivity with a powerful CPU system based on TI's popular AM335x Sitara ARM Cortex-A8 processors (600MHz to 1GHz options) complemented by 512MB (standard) DDR3 memory and abundant 4GB eMMC FLASH memory.
+
  
<h2>Key Features</h2>
+
:'''a. Through 3.3V UART to USB cable'''
<h3>Application Processor (BeagleBone compatible):</h3>
+
* TI Sitara™ ARM® Cortex®-A8 AM335x , up to 1GHz, 2000MIPS with 512 MB RAM, 4GB eMMC FLASH
+
* Supports UART/I2C/SPI/SDIO/CAN interfaces for sensor & machine data
+
* Standard BeagleBone headers for existing cape compatibility (See cape compatibility matrix)
+
* MicroSD storage
+
* Optional HDMI video
+
* 10/100M Ethernet
+
* Ships with Debian ARMHF OS
+
  
<h3>Enhanced for M2M:</h3>
+
This gives debug-console access to VIBE2. Once login prompt comes, use the above provided username and password to login.
* Multi-port USB hub with 4x USB-A host connectors for connecting additional USB devices
+
These cables are available as an accessory on Yantrr([http://www.yantrr.com/products/accessories?product_id=88 USB UART adapter with jumper wires]) and further options are also listed [http://www.elinux.org/Beagleboard:BeagleBone_Black_Accessories#Serial_Debug_Cables here].
* High precision battery backed RTC
+
* Optional battery circuit for standby purposes with reverse voltage protection, battery charging and thermistor cutout
+
  
<h3>Connectivity & IoT Enablement:</h3>
+
Download link for Windows drivers for the adapter - [https://www.dropbox.com/s/dyrcycd5b483y27/PL2303_Prolific_DriverInstaller_v1_9_0.zip?dl=0 click here]
* Wireless modem options
+
  
1.PTCRB certified GSM/WCDMA HSPA+ multi-band modem (Up to 21/5.76 Mbps DL/UL data rates), optional integrated GPS.
+
:'''b. Through Ethernet cable'''
  
2.Verizon certified 1xRTT & EV-DO Rev. A (3.1/1.8 Mbps DL/UL data rates), optional integrated GPS.
+
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 :
 +
<pre>
 +
ssh -l root 192.168.1.150
 +
</pre>
  
3.Global bands HSPA+/3G/2G modem (Up to 21/5.76 Mbps DL/UL data rates).
+
For more help [http://www.elinux.org/Beagleboard:Terminal_Shells please follow].
  
* Optional Bluetooth 4.1 (BLE) wireless
+
:'''c. Through HDMI Display and USB Keyboard'''
* Optional 802.11 b/g/n WiFi wireless
+
* Push-Push Mini SIM socket
+
* u.FL connectors for attaching modem antennas
+
* Optional Dedicated GPS+Timing Module with 1PPS output on a u.FL connector or GPIO
+
  
<h1>Hardware Configuration</h1>
+
This option is available for use in VIBE2 with HDMI option. Default VIBE2 comes without HDMI configuration.
  
Following images give a proper understanding of the VIBE2 :
+
To ssh into VIBE2 using this method, a micro HDMI to HDMI cable ([http://www.elinux.org/Beagleboard:BeagleBone_Black_Accessories#HDMI_Cables 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.
  
[[File:VIBE2_topside.jpg|1213px|1000px]]
 
  
[[File:VIBE2_bottomside.jpg|1213px|1000px]]
+
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.
  
<h2>Technical Specifications</h2>
+
The set of commands executed at bootup in pre-flashed image are in this file :
 +
<pre>
 +
cd ~
 +
nano boot_run.sh
 +
</pre>
  
[[File: ts.png]]
+
*Basically after logging into the VIBE2, GPIOs 44, 45 and 46 have to be set high as output.
 +
<pre>
 +
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
 +
</pre>
  
<h2>Beaglebone Section</h2>
+
::*'''NOTE : In pre-flashed image, for ease of use of regular commands with the GPIOs, functions have been created: ''pinexp, setout, setin, pinread.'''''
  
* '''Processor''' VIBE2 uses TI's Sitara ARM cortex-A8 AM3352 1 GHz processor (AM3352BZCZ100) which is different from 1GHz AM3358 (AM3358BZCZ100) used in original Beaglebone Black. The differences between the two being AM3352 does not have PRU subsystem, EtherCAT and SGX Graphics support.
+
<pre>
 +
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
 +
</pre>
 +
 
 +
===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.''
 +
 
 +
<pre>
 +
cd /sys/class/gpio/
 +
echo 45 > export
 +
cd gpio45
 +
echo "high" > direction
 +
sleep 4
 +
echo "low" > direction
 +
sleep 4
 +
echo "high" > direction
 +
</pre>
 +
 
 +
:*''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 [http://www.yantrr.com/wiki/ZTE_modem please follow].
 +
 
 +
* '''For 3GH-E and 4GL-E type : '''
 +
: For complete instructions for 3GH-E and 4GL-E type of modems [http://www.yantrr.com/wiki/Telit_Modem 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:'''
 +
<pre>
 +
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
 +
</pre>
 +
 
 +
'''System messages (logs) show what happened when 3G modem was turned on and its drivers were assigned '''
 +
<pre>
 +
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'''
 +
</pre>
 +
 
 +
'''When using Default debian image without USB drivers for 3G modem, issue following command:'''
 +
<pre>
 +
modprobe usbserial vendor=0x21f5 product=0x2012
 +
</pre>
 +
 
 +
:*'''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 :
 +
<pre>
 +
cd /lib/firmware
 +
echo BB-UART1 > /sys/devices/bone-capemgr.*/slots
 +
</pre>
 +
 
 +
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:
 +
<pre>/dev/ttyUSB0  /dev/ttyUSB1  /dev/ttyUSB2</pre>
 +
 
 +
*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 [http://www.yantrr.com/wiki/ZTE_modem please follow].
 +
;VIBE2-3GH-E:
 +
For complete instructions for 3GH-E type of modems [http://www.yantrr.com/wiki/Telit_Modem please follow].
 +
 
 +
===Understanding the ports for 4G Modem on VIBE2-4G===
 +
----
 +
The 4G modem on VIBE2-4G OR VIBE2-4G-GPS/TIM board is interfaced via USB2.0 HS to USB1 host port.
 +
;VIBE2-4GL-E :
 +
For complete instructions for 4GL-E type of modems [http://www.yantrr.com/wiki/Telit_Modem 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.
 +
 
 +
<pre>
 +
cd /sys/class/gpio/
 +
echo 45 > export
 +
cd gpio45
 +
echo "high" > direction
 +
sleep 4
 +
echo "low" > direction
 +
sleep 4
 +
echo "high" > direction
 +
</pre>
 +
 
 +
Modem can also be turned off by issuing following AT commands on port /dev/ttyUSB2 for 3GH-A/B/C type modems.
 +
<pre>AT+ZPWROFF</pre>
 +
 
 +
===Soft Resetting the Modem===
 +
----
 +
Steps -
 +
#Power Off the Modem.
 +
#Wait for 1-2s at least.
 +
#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.
 +
 
 +
<pre>
 +
cd /sys/class/gpio/
 +
cd gpio44
 +
echo "low" > direction
 +
sleep 1
 +
echo "high" > direction
 +
</pre>
 +
 
 +
:*'''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 [http://www.yantrr.com/wiki/ZTE_modem please follow].
 +
 
 +
===AT Commands Manual===
 +
----
 +
The AT Command Manual for the 2G modem can be downloaded from [[File:GPRS Module AT Commands.pdf | here]]
 +
 
 +
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 | here]]
 +
 
 +
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 | here]]
 +
 
 +
=Applications=
 +
 
 +
* [[Data_connection_procedure_using_PPP |Data connection procedure using PPP ]].
 +
* [[Configuring_USB_Wireless_Devices | USB Wireless Devices]].
 +
* [[Sending_and_receiving_sms|Sending and receiving sms]]
 +
* [[Using_GPS_module_with_Debian_Wheezy|GPS Module]]
 +
 
 +
=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'''
 
   
 
   
* '''USB host ports''' VIBE2 contains FOUR USB 2.0 HS host ports with type A connector whereas original Beaglebone black has only one. VIBE2 has reconfigured USB0 OTG port as self powered USB hub host ports. So there is no USB client port. USB1 OTG port remains configured as USB 2.0 Host port and used for interface with 3G modem.
+
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
  
* '''Battery''' VIBE2 can be powered up by 3.7V Li-ion rechargeable battery with automatic backup switch over circuit from 5V DC input and can power up the whole VIBE2 including 3G/2G modem, all the USB Host ports and HDMI. Original Beaglebone black also supports 3.7V Li-ion Rechargeable battery but with limited functionality of USB host port and HDMI unavailable.
+
i2cdetect -y -r 1
  
* '''Ethernet reset''' VIBE2 includes a standalone ethernet reset circuit over GPIO. This addresses a bug in the original beaglebone black where the Ethernet PHY is not detected at bootup and board had to be reset.
+
[[File:rtc1.png]]
  
1.In VIBE2, the ethernet phy can be individually reset separate from the whole board by toggling gpio GPIO3_21 (GPIO 117).
+
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
  
2.To use the GPIO ethernet reset feature, HDMI audio has to be disabled in device tree and then GPIO1_27 (GPIO 59) has to be pulled low so that GPIO3_21 is available for use. Also, HDMI is an optional feature on VIBE2.
+
echo ds1307 0x68 > /sys/class/i2c-adapter/i2c-1/new_device
  
* '''Watchdog Timer''' VIBE2 includes a watchdog timer circuit which can generate an external reset to PMIC and address the Under Voltage Lockout (UVLO) issue faced in Original Beaglebone Black. If the PMIC TPS65217C enters in UVLO and is not resolved within 10s, watchdog timer will generate an external reset to PMIC.
+
The RTC is now ready. Check the present time on the RTC by:
  
* '''Real Time Clock''' VIBE2 has an accurate Real Time clock with an integrated temperature compensated oscillator and crystal for time keeping operations.
+
hwclock -r -f /dev/rtc1
  
1. It includes a 3V non-chargeable coin cell (CR1025/CR1216/CR1220) for standby power.
+
[[File:rtc2.png]]
  
2. RTC (DS3231) is interfaced over I2C2 to AM3352 processor. Its registers can be read to indirectly serve as Temperature sensor too.
+
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:
  
3. RTC IC generates a 1Hz Square wave signal. This signal is available (optionally) on an uFL connector and GPIO27 when GPS module is not present.
+
sudo apt-get install ntp
  
* '''Extra UART0''' header at the edge of the board for easy handling and convenience.
+
To update the time, use
* Fully compatible Beaglebone Black expansion header. Most of the LCD capes are compatible with VIBE2.
+
  
 +
ntpdate -b -s -u pool.ntp.org
  
For more details on Beaglebone Black refer:[[https://en.wikipedia.org/wiki/Beagleboard| Beaglebone boards]]
+
After this check logcat system date and time using
 +
 +
date
  
 +
After this write this by using
  
<h2>Radio Section</h2>
+
hwclock -w -f /dev/rtc1
  
VIBE has an option between 2G/GPRS modem and 3G/HSPA (3G/CDMA) modem for WAN connectivity.
+
[[File:rtc3.png]]
  
* '''2G modem''' : The 2G modem is interfaced via UART to UART1 port of the AM3352 processor on VIBE. There are following versions for different regions :
+
'''Note:''' The updated time would be in UTC.  
** Quad-Band(2G-Q) : For Global connectivity covering bands GSM 850/EGSM 900/DCS 1800/PCS 1900 with data rates of 85.6kbps DL/42.8kbps UL.
+
** Dual-Band(2G-D) : For Asia/Europe connectivity covering bands EGSM 900/DCS 1800 with data rates of 85.6kbps DL/42.8kbps UL.
+
  
* '''3G modem''' : The 3G modem  is interfaced via USB2.0 HS on USB1 Host port of AM3352 processor on VIBE. There are following versions for different regions in both GSM/HSPA and CDMA/EVDO :
+
This will update the time. Check it again using the hwclock command:  
** 3G HSPA-A (3GH-A) : For Asia/Europe connectivity covering bands WCDMA 2100 and GSM 850/EGSM 900/DCS 1800/PCS 1900 with data rates of 7.2Mbps DL/5.76Mbps UL.
+
** 3G HSPA-B (3GH-B) : For Americas connectivity covering bands WCDMA 2100/850 and GSM 850/EGSM 900/DCS 1800/PCS 1900 with data rates of 7.2Mbps DL/5.76Mbps UL.
+
** 3G HSPA-C (3GH-C) : For Asia/Europe/Australia Connectivity covering bands WCDMA 2100/900 and GSM 850/EGSM 900/DCS 1800/PCS 1900 with data rates of 7.2Mbps DL/5.76Mbps UL.
+
** 3G HSPA-D (3GH-D) : For Global connectivity covering bands WCDMA 850/1900/2100 and GSM 850/EGSM 900/DCS 1800/PCS 1900 with data rates of 3.6Mbps DL/384kbps UL.
+
** 3G CDMA (3GC-A) : For Global connectivity covering bands CDMA 800/1900 with data rates of 3.1Mbps DL/1.8Mbps UL.
+
  
:3GH-A/B/C and 3GC-A modems create ports /dev/ttyUSB0, /dev/ttyUSB1 and /dev/ttyUSB2 with ports assigned as :
+
hwclock -r -f /dev/rtc1
::a. /dev/ttyUSB0 : Modem port and AT commands port
+
::b. /dev/ttyUSB2 : AT commands port
+
  
:3GH-D modem creats ports /dev/ttyUSB0, /dev/ttyUSB1, /dev/ttyUSB2, /dev/ttyUSB3 with ports assigned as :
+
'''To start the script at bootup Create a new script in any folder
::a. /dev/ttyUSB1 : AT commands port
+
::b. /dev/ttyUSB3 : Modem port and AT commands port
+
  
 +
cd /usr/share/ mkdir rtc
 +
nano init.sh
  
Both 2G/3G modems have following control interfaces :
+
Contents of the script
:a. '''Modem Hard reset''' over GPIO - GPIO44
+
:b. '''Modem Hard reset''' over push button switch - S5
+
:c. '''Modem On/Off''' over GPIO - GPIO45
+
:d. '''Modem On/Off''' over push button switch - S4
+
:e. '''Netlight/Signal LED''' - D15 (this feature is optional in 3GH-A/B/C and 3GC-A modules)
+
:f. 3G Modem Antenna - On-module GSC connector
+
:g. '''2G Modem Antenna''' - uFL connector
+
:h. '''3G Modem Wakeup_out'''/ 2G/3G UART RI - GPIO26
+
:i. '''Modem Interface''' - 2G : UART1 (rx,tx) ; 3G : USB2.0 HS USB1 (and UART1 - optional)
+
:j. '''SIM/RUIM card''' - 6 pin Push-pull mini-sim card connector
+
:k. Audio - 3.5mm TRRS Analog stereo audio and mic jack(optional)
+
  
Additional interfaces for 2G modem only :
+
#!/bin/bash
:l. UART RTS : I2C1_SCL(UART1_RTS)
+
echo ds3231 0x68 > /sys/class/i2c-adapter/i2c-1/new_device
:m. UART CTS : I2C1_SDA(UART1_CTS)
+
hwclock -s -f /dev/rtc1
:n. UART DTR : GPIO61
+
hwclock -w
:o. UART DCD : GPIO65
+
:p. '''2G Modem Status GPIO''' : GPIO47
+
:q. '''2G Modem Status LED''' : D14
+
:r. 2G Debug UART : on Extra UART0 header
+
  
::*'''Default values of GPIO44 and GPIO45 is high. '''
+
[[File:rtc4.png]]
::*'''USB drivers for the modem (21f5:2012, 21f5:2009, 19d2:ffeb, 19d2:fffe) should be included in the kernel. We provide pre-compiled images with USB drivers included in the kernel.'''
+
Save the script and then use crontab to start the script at the bootup
  
== GPS section ==
+
crontab -e
 +
@reboot bash /usr/share/rtc/init.sh
  
VIBE provides GPS module as an add-on feature to 3G/2G modem and/or as a standalone feature.
+
Reboot the system and then check using
  
GPS module is interfaced on VIBE over UART at UART4 port. NMEA-0183 messages from the GPS modules can be accessed at /dev/ttyO4 port at baud rate of 19200.
+
hwclock -r -f /dev/rtc1
  
Following are the hardware interfaces of GPS module on VIBE :
+
It should give the updated time.
#Module Interface : UART4(rx,tx) 19200 raw
+
#Module Reset over GPIO : GPIO46
+
#Module Reset over push button : S6
+
#1 PPS output over GPIO : GPIO27
+
#1 PPS output over uFL connector : P14
+
#GPS Fix Led : D16
+
#GPS module Power Led (3.3V) : D17
+
#GPS Antenna : uFL connector P13
+
#Battery backup for Hot start : 3V coin cell
+
  
::*'''GPIO46 should be set to high as Default state for the GPS module to function'''
+
==Network Time Protocol (NTP)==
::*'''Keep the GPS antenna under open sky for better operations and depending on whether GPS module had a cold, warm or hot start, GPS fix LED will soon start blinking at 1Hz.'''
+
  
<h2>Wifi Section</h2>
+
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.
  
VIBE2 has an add on feature of optional 802.11 b/g/n WiFi wireless. The Wifi module used for this purpose is Realtek RTL8188CUS Module.
+
'''Need for time synchronization'''
  
[[File:749633491 021.jpg|300px]]
+
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:
  
The Realtek RTL8188CUS-GR is a highly integrated single-chip QFN-46 pin Wireless LAN (WLAN) USB2.0 network interface controller compatible with the 802.11n specification. It combines a MAC, a 1T1R capable baseband, and RF in a single chip. The RTL8188CUS provides a complete solution for a high throughput performance wireless client.
+
1. Transaction Management
  
For more applications follow the document.
+
2. Billing Services
  
<h2>Bluetooth Section (BLE)</h2>
+
3. Detecting the fault over network
VIBE2 has an add on feature of Optional Bluetooth 4.1 (BLE) wireless. The Bluetooth module used for this purpose is RN4020 microchip.
+
  
[[File:Download1.jpg]]
 
  
The RN4020 is a fully-certified, Bluetooth Version 4.1 low energy module for designers who want to easily add low power wireless capability to their products.  The small form factor, surface mount module has the complete Bluetooth stack on-board and is controlled via simple ASCII commands over the UART interface.  The RN4020 also includes all Bluetooth SIG profiles, as well as MLDP (Microchip Low-energy Data Profile) for custom data.  Developers can utilize the scripting feature to enable standalone operation without a host MCU or Processor.  The RN4020 can be remote controlled by another module over a secure connection and can be updated via the UART interface or over-the-air.
+
'''Basic Features'''
  
'''Following are the control interfaces for BLE:'''
+
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.
  
a. UART2 (/dev/ttyO2) for serial interface
+
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 )
  
b. deep sleep wakeup (WAKE_SW) - GPIO61
+
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
  
c. dormant state wakeup (WAKE_HW) - GPIO65
+
server 0.in.pool.ntp.org
 +
server 3.asia.pool.ntp.org
 +
server 0.asia.pool.ntp.org
  
d. CMD/MLDP mode - GPIO22
+
Now Save and exit.
 +
Restart ntp using
  
e. Connection LED - D19
+
  $ /etc/init.d/ntp re
  
f. MLDP event indicator LED - D14 (does not work when 3G modem mounted)
+
==Console output on HDMI display==
  
g. Activity indicator LED - D20
 
  
'''NOTE:'''
+
* Edit uEnv.txt file
D20 led glows when module is awake and active.
+
#nano /boot/uboot/uEnv.txt
D19 led glows when a connection is being made
+
GPIO61 and GPIO65 should be set to high.  
+
GPIO22 is low then module is in CMD mode and in MLDP mode when high.
+
  
For more applications follow the document.
+
and add the following command :
 +
console=tty1,38400n8
  
= Getting Started =
+
and reboot. Console messages will now be visible on HDMI after it has been enabled in kernel.

Latest revision as of 07:29, 15 December 2016

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

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

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


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

VIBE2-4GL-E 

For complete instructions for 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.