Archive for March, 2009

If you’ve ever worked with GPIOs from Cinterion TC65 or XT65 (or their MTX terminals), you will have realized that there are different ways to work with them. There are AT commands that allow us to set a specific GPIO as an input/output and there are other AT commands that let us know the status of the GPIO set as an input (1 or 0) or even allow us to change an output status.

In one of the Java examples that I have been posting on this blog, specifically in the GPIO EXAMPLE, I simply used the command AT^SGIO which returns the pin status at that point in time. So it depends on the application that you want to run as this AT command could suffice, but this system isn’t usually used as we obtain a very low “sweep frequency” (in addition to loading the system) and therefore it’s very complicated to detect very small changes in the input pin status. If for example you have to detect a volumetric detection pulse, you might not catch it.

modem-entrada-digital

The best thing to do to detect GPIO status changes is to use polling. This way the modem sends you a URC message each time a GPIO change is detected.

Let’s look at an example. Imagine that you want to control GPIO1, GPIO2, GPIO3 and GPIO4 inputs. How do we do it?

Well the first thing you need to do is enable the GPIOs, to do this send:

AT^SPIO=1

Then, configure the pins GPIO1, GPIO2, GPIO3 and GPIO4 as inputs, to do this:

AT^SCPIN=1,0,0

AT^SCPIN=1,1,0

AT^SCPIN=1,2,0

AT^SCPIN=1,3,0

After that we create a port, i.e. a port with all of the GPIOs that we want to involve in the polling process:

AT^SCPORT=0,1,2,3

By sending this command, the AT command will return an IDPort (port identifier) e.g. it will response with IDPort = 112

And now we have everything ready to activate polling. We activate doing this:

AT^SCPOL=1,112

This way whenever there is a change in one of the GPIOs, the modem will send us a URC in this style:

^SCPOL: 112, x

X can be worth 0-1024 i.e. it returns the status of the 10 possible GPIOs that you can control with the TC65 modem.

Well I’ll be back another day, I’m going to go and make dinner now as today CSI Las Vegas is on and it’s the only bit of TV I watch all week. The truth is every time I watch the TV I realize that I like is less and less. Am I getting old?! :S

Tags: , , ,

Comments 9 Comments »

Good afternoon. In today’s post I’m going to talk about how to connect a UMTS/HSDPA modem to the internet (specifically Matrix‘s MTX-H25, based on Siemens HSDPA/Cinterion HC25 modem) with a Linux operating system (en specifically an Ubuntu). I’m not going to uncover anything new as you can find the information in the modem user guide. The only difference is that I’m going to post specific steps from 1-7 of what to do on here. Thanks go to my friend Linuxero Javi who is the original author of the manual. ;)

linux-vs-windows

Step 1.

First we set the MTX-HC25 modem to MDM mode, it’s very easy to do this from Windows. Take the modem (as if it had just come out of the factory) and connect it to a PC with Windows. After a few seconds (about 10) you will see that “My Computer” appears in “Mass Storage Device” like it was a pen drive. Go into it and the modem drivers will be installed (yes you’re right, the MTX-HC25 drivers are inside the modem itself, cool right?)

Once the drivers are installed, you will see that three new devices have been installed in Windows Control Panel (a network card, a USB modem and a virtual COM). Look at the virtual COM that has been created to find out the COM port number.

Once we have the COM port can we open the HyperTerminal and run the at^susb command. You have to configure it like I have below; I won’t go into any more details other than saying that the “Startup” must be in MDM mode in order to be able to work with Linux.

at^susb?
^SUSB: “Startup”,”Mdm”
^SUSB: “MaxPower”,”10″
^SUSB: “PowerSource”,”SELF”
^SUSB: “Mdm/DD”,”0″
^SUSB: “MdmNet/DD”,”0″
^SUSB: “MdmNet/TO”,”60000″
^SUSB: “MS/CRC”,”6B1A1842?”
^SUSB: “MS/DD”,”0″
^SUSB: “MS/OnEject”,”MdmNet”
^SUSB: “MS/WProt”,”Disabled”

Leave the parameter ^SUSB: “MdmNet/TO”,”60000″ as it is in case you get yourself into a mess as Linux can retrieve it from Windows (you must connect it to Windows and after 60 seconds it will be visible again from Windows, returning to MdmNet mode). When everything is ready in Linux it is recommended that you set this parameter to 0.

Step 2.

Install the standard CDC-ACM drivers in Linux writing this in the control panel:

sudo modprobe cdc_acm

sudo modprobe usbserial vendor=0×0681 product=0×0047

Then take the modem, power it up and connect it via USB. If you have done this before, it may have become a Mass Storage (if it has been over a minute from when you plugged it in until when you installed the drivers). If so, unplug the power supply then plug it in again.

After doing this we send the “Isusb” command via Linux console so that we can see the MTX-H25 modem listed as a USB device.

Once we have done this, if we want we can send AT commands to the modem. We can do it by simply running this from the Linux console:

echo AT+cfun=1,1 > dev/ttyUSB0

(With the above example, we reset modem)

Step 3.

Launch the configuration script and check that Linux can detect our modem, run this from the Linux console:

sudo wvdialconf

If all goes well you will see the MTXH25 installed in /dev/ttyACM0

Step4.

Edit the configuration file /etc/wvdial.conf :

[Dialer Defaults]
Init1 = ATZ
Init2 = ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
Phone = *99***1#
New PPPD = yes
Modem Type = USB Modem
Baud = 460800
Auto DNS = off
Modem = /dev/ttyACM0
DNS = 80.58.0.33

[Dialer movistar]
Init3 = AT+CGDCONT=1,”IP”,”movistar.es”
Password = MOVISTAR
Username = MOVISTAR

[Dialer vodafone]
Init3 = AT+CGDCONT=1,”IP”,”airtelnet.es”
Password = vodafone
Username = vodafone

Step 5.

We’re missing something.

Edit the file /etc/ppp/peers/wvdial with the ppp settings for the connection:

# Name
name wvdial
# No authentification
noauth
# Use PPP interface as default IP table route
defaultroute
# PPPD must not force an IP address’
noipdefault
# Do not use the Server DNS
# usepeerdns
mtu 472

Step 6.

Now you can run “wvdial” to connect to the net with the modem. To do this run wvdial from the Linux console along with the desired operator. If we have configured the /etc/wvdial.conf file the same as in step 4, it’s like this:

wvdial movistar

Step 7.

Enjoy the MTX-H25 modem’s HSDPA speed. 

I hope this has been useful to anyone googling “MTX-H25 Linux”.  I’ll be back another day ;)

Tags: , , , , ,

Comments 18 Comments »