SW startup guide for Vayu 3G

From Yantrr Wiki
Revision as of 03:02, 21 May 2015 by Mayank (Talk | contribs) (FAQ)

Jump to: navigation, search


For a quick guide to starting with the Vayu 3G cape's HW, see Leaflet for 3G cape.

Below, we describe how to set up the 3G capes and the associated software.


Overview

Data connection is established based on PPP protocols. Wvdial is mainly used to configure the dialup settings. For setting up various settings for PPP connection and establishing a data connection on these capes follow the link to the wiki

  • Way to setup the Vayu 2G Capes
  • How to read location and coarse time as NMEA-0183 message from the serial UART ttyO4 port
  • How to write wvdial conf files for any network
  • Sample wvdial.conf file for AT&T and T-Mobile USA

For using the Vayu-3G-A/Vayu-3GP-A Cape, please ensure that you have the following :

  1. USB drivers for the modem (21f5:2012) installed in kernel
  2. PPS drivers enabled in kernel, required if GPS module is present.
  3. VAYU Device tree overlay file is properly configured.

You can either download kernel patches containing the same to use with your existing images or you can download our prebuilt MicroSD card image or EMMC flasher image.

All the images and files and extra support on software can be found here: Vayu_Cape_SW_images_and_drivers


Note : On most beaglebones, there is a known bug with USB hotplug for using USB HUB with Beaglebone black host port. So to efficiently be able to use the modem, follow the Power on Modem section properly. An alternative easier approach is to keep the second host port on cape populated with a usb device.

Hardware Configurations

The 3G/WCDMA modem has following interfaces available on the Cape: Leaflet_3G modem

  1. Mini USB B Device port on Cape (P9): It has to be connected to USB host port on Beaglebone Black.
  2. SMA connector for GSM/WCDMA antenna(P7): Antenna is connected here.
  3. LED D2 (5V Power LED of Cape) : This LED indicates that the Cape is powered on with 5V and GSM/WCDMA modem is also powered.
  4. LED D4 (SIGNAL LED) : This LED is the SIGNAL LED for the GSM/WCDMA modem whose various blinking states denote the different states of the WCDMA Modem.
  5. GPIO45 (ON/OFF PIN) : It is the GPIO connected to Power ON/OFF pin of GSM/WCDMA Modem.
  6. GPIO60 (Hard Reset Pin) : It is the GPIO connected to Reset pin of GSM/WCDMA Modem.
  7. S1 (ON/OFF switch) : This push button switch is connected to Power ON/OFF pin of GSM/WCDMA modem.
  8. S2 (RESET switch) : This push button switch is connected to Hard Reset pin of GSM/WCDMA modem.


GPIO45 and GPIO60 should be set high at all instances for the GSM/WCDMA modem to be available for use.

Power On Modem

The 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 S1 or GPIO45.

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 D4 should start blinking as to indicate modem has turned on. (Note : In some of 3G modules LED functionality is not enabled by the manufacturer, so the LED D4 might not blink)
  • Now, attach usb cable between mini USB port (#16 on leaflet) of cape and host port of Beaglebone Black. Alternatively, if the USB host on cape is also populated,then the USB cable can be kept intact before Board was booted up.
  • Check that modem is visible on the USB bus by:
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 007: ID 21f5:2012
  • Assigning driver on the USB modem (Not needed if using pre-built images)
modprobe usbserial vendor=0x21f5 product=0x2012
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 007: ID 21f5:2012
  • System messages show what happened after applying modprobe usbserial
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'''
  • It is recommended to add a proper driver for the modem in kernel. The generic driver is not reliable.

Understanding the TTYUSB ports on BBB capes

Vayu 3G cape enumerate 3 different usb ports

/dev/ttyUSB0  /dev/ttyUSB1  /dev/ttyUSB2
  • ttyUSB0 is data port & command for modem, use this for the WVDIAL conf or PPP
  • ttyUSB1 is the diag port for the Firmware upgrade
  • ttyUSB2 is the AT CMD port only

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 S1 or GPIO45.

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

Soft Resetting the Modem

Steps -

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

AT Commands Manual

The AT Command for the 3G Module can be downloaded from here : WCDMA AT Commands Manual

FAQ

FAQ for this section click here

Data connection procedure using PPP

Notes

  • All commands are recommended to executed as root user.
  • USB drivers need to be installed in the kernel for the WCDMA modem to work.
  • Modem port for Vayu cape is ttyUSB0, use this port for PPPd or Wvdial
  • AT Commands port for Vayu cape is ttyUSB2

Wvdial Configuration for Debian Wheezy

Download and install Wvdial

apt-get install wvdial

Executing the following command usually sets the wvdial.conf file which is used for dialing to GPRS communication, but since here our modem port is on a UART(/dev/ttyO1) and not on /dev/ttyS* or /dev/ttyUSB* ports, we will have to manually configure it.

So, open the wvdial.conf file

$ nano /etc/wvdial.conf

Assuming that you have the USERNAME, PASSWORD and APN available for the service provider of the sim card being used, edit and make wvdial.conf file like this. Sample wvdial.conf file for AT&T and T-Mobile USA

[Dialer Defaults]
Modem Type = Analog
ModemPhone = *99#
ISDN = 0
Baud = 115200
Username = USERNAME
Password = PASSWORD
Modem = /dev/ttyUSB0
Init1 = ATZ
Init2 = at+cgdcont=1,"ip","APN"
Stupid Mode = 1

Usually for GSM Networks, Modemphone is *99# or *99***1#. Consult your network provider for exact details in case you are facing difficulties. After editing, save and exit, now run wvdial for establishing communication.

$ wvdial

If all parameters are correct and everything is working, you should see a success message from wvdial. Once PPP connection has been established, you will see a ppp0 IP.

To check the status of wvdial and find out its IP open a new shell and use either of following:

  • Run ifconfig and find ppp0 in the list of network connections.
$ ifconfig
or
$ ifconfig ppp0
  • Check the network statistics for IP and their gateways and check the Iface column for ppp0
$ netstat -arn
* Kernel IP routing table 

Destination Gateway Genmask Flags MSS Window irtt Iface
0.0.0.0 192.168.1.1 0.0.0.0 UG 0 0 0 eth0
192.168.1.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
192.168.7.0 0.0.0.0 255.255.255.252 U 0 0 0 usb0
192.200.1.21 0.0.0.0 255.255.255.255 UH 0 0 0 ppp0
  • Read the system messages as
$ cat /var/log/messages

It lists all the attempts at establishing ppp communication using the modem and IPs for the successful attempt.

Now all that is left is to route the network traffic over the gateway of ppp0 instead of eth0 so that GPRS communication is fully completed.

PPP connection has been established over GPRS using 2G/3G module and wvdial.

System Status

After PPP has been established, the following is the status of the LEDs and GPIOs (For verification)

  1. STATUS LED D3 – It is continuously glowing, once the Modem was turned on.
  2. SIGNAL LED D4 – It is now blinking at 64ms ON/300ms OFF . Earlier when PPP was not established but SIMcard was detected by modem, then it was blinking at 64ms ON/3000ms OFF.
  3. ON/OFF GPIO45 – Its value should be 1.
  4. RESET GPIO60 – Its value should always be 1.

FAQ

FAQ for this section click here


Adding a DNS

nano /etc/resolv.conf add following

nameserver 8.8.8.8
nameserver 208.67.222.222

These are public nameservers, and you are free to use any other if they do not work.

Using GPS module with Debian Wheezy

Please refer to Software startup Guide for VAYU GPS


FAQ

FAQ 1: Modem / TTYUSB of modem not detected

Solution 1. Remove the power cord from the board and reconnect it while the USB cable is not connected to the cape. Then you should follow the procedure to turn on the 3G module as follows

  • set GPIO 45 to high in output mode
  • Then after 3-4s , either press the switch S1 for 4s and then release it or instead of switch you can also recycle the value of GPIO 45 to low then high at intervals of 4s
  • and now connect the USB cable.

** Always make sure GPIO 45 is in HIGH state **
cd /sys/class/gpio/
echo 45 > export
cd gpio45
echo "high" > direction
sleep 4

**Now enable the modem by toggling GPIO 45 ***
echo "low" > direction
sleep 4
echo "high" > direction
sleep 4

** To disable the Modem, again toggle GPIO45 **

echo "low" > direction
sleep 4
echo "high" > direction
sleep 4
  • Solution 2. Due to hotplug issue in AM335x we can do a workaround, connect a usb device like a pendrive on second host port on cape and then just press the switch S1 for 4s after setting GPIO45 high.

This will most certainly work.

  • Solution 3. This solution resets the usbcore of the AM335x and reinitialize it. This has been identified as a last resort workaround, NOTE, this will reset all peripheral on that USB CORE

If the Device is disconnecting as soon as you try to establish connection even when you are sure that 3G module is on, then following should be followed : reset the USB1

echo 0 > /sys/bus/usb/devices/usb1/bConfigurationValue
echo 1 > /sys/bus/usb/devices/usb1/bConfigurationValue