Debian Linux and Orange Mobile Office Card 3G

Author: Jules Kavanagh
Issue: 1.5


  1. Introduction
  2. The Kit
  3. Inserting the 3G Card
  4. The Dialing scripts
  5. Dialing Orange
  6. Misc
  7. Contact


History:

This report is listed at TuxMobil - Linux on laptops, notebooks, PDAs and mobile phones.

1. Introduction

Disclaimer: Use of the information contained within this document is entirely at your own risk!

This is my short guide to setting up and using an Orange Mobile Office 3G Card with Debian "Sarge" (I used to use Libranet 2.8.1). I live and work in the UK, therefore some bits of this guide will be specific to the UK and Orange's service in this country.

Before I bought the 3G Card, I searched for technical information about the Orange 3G Card, and I was disappointed to discover that there was very little information.

Orange UK did not have any support pages for linux users, and I would guess that their support for their Windows users isn't that good.

I found one web page about getting the Orange 3G datacard to work with linux, at Calum's web-site http://gk.umtstrial.co.uk/~calum/u530.php and this gave me the confidence to try to get mine working.

Also I have a small confession, I did use M$ Windows and the horrid Orange software to run my 3G Card for the first couple of weeks. But it was useful, as it allowed me to find out about some of the AT commands that can be used. Note: I may also have activated the USIM/3G Card whilst using the Orange software by reading an SMS from the 3G card (Sorry, I don't know how to do this from linux).

2. The Kit

My Orange Mobile Office Card 3G was bought retail from an Orange shop. The underside of the card indicates it is a Novatel Wireless Merlin U530 (Model: NRM-U530) and I am guessing the hardware revision is HW:01.08 040714 as this is printed on a white sticker.

2.1. Old laptop

This laptop has now been retired, owing to a structural failure i.e the hinges broke.

My ACER laptop was running the Debian linux Libranet 2.8.1 distro http://www.libranet.com. It was a minimal install of Libranet 2.8.1, which was then updated using aptitude to upgrade/dist-upgrade from a Debian Sarge/Testing DVD-R (bought from the Linux Emporium http://www.linuxemporium.co.uk).

I was using the default debian kernel binary package:


   jules@acerlin:~/Total_3G$ uname -a
   Linux acerlin 2.4.27-1-686 #1 Fri Sep 3 06:28:00 UTC 2004 i686 GNU/Linux

Before getting the card, I did install the pcmcia package and I think I ran the Libranet Xadminmenu to enable pcmcia support.

2.2. New laptop

Typically, I couldn't decide what laptop to get next. In the end, I opted for the ultra-light weight Fujitsu P7010D 1.1GHz 512M 60MB HD and a free finger-print scanner (the latter being of no use since there isn't a linux driver available). As the hardware is fairly new, and because the fan is noisy, cpu frequency stepping and power management are important, I figured that I should be using a 2.6.x kernel.

Unfortunately, I had until recently (10th Sep 2005) been frustrated that I was unable to get 2.6.x to run smoothly on my laptop. Linux would noticeably and briefly freeze every few minutes, the mouse pointer, video playback, etc were all affected.

Looking at the output from top, I could see that the events/0 process jumped to 33 %CPU usage and the Time+ was always very high (when I first start linux it was greater than 3:00 within the first minute of uptime!)


  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
  3 root      31  -5     0    0    0 S 33.3  0.0   0:53.82 events/0  

UPDATE My events/0 problem was due to loading the genrtc driver. I've now unselected 'genrtc' in the .config and recompiled the kernel. Many thanks to Tobias Ramforth for the answer.

I started using the Con Kolivas patches when I was trying to find a solution to the events/0 problem, and they were very effective in hiding many of the "freeze" symptoms. A responsive desktop still seems like a good idea, so I am going to continue applying the ck patches.

At the time of updating this guide, I was using the following kernel


  jules@fsclin:~$ uname -a
  Linux fsclin 2.6.13-ck1 #1 Sat Sep 10 14:34:03 BST 2005 i686 GNU/Linux

I also have problems with lots of ppp0 rx errors when I use the 3G card and I think this may be due or contributed to by the ACPI code. My workaround, to reduce the rx errors, is to disable the ACPI with the kernel parameter acpi=off. I have two menu items in my grub's menu.lst file to either boot kernel 2.6.13-ck1 with or without ACPI.

The remainder of this guide (I hope) is equally valid for either a 2.4.x or 2.6.x kernel.

3. Inserting the 3G Card

Confirm that the pcmcia drivers were started by looking for output in dmesg:


   Linux Kernel Card Services 3.1.22
     options:  [pci] [cardbus] [pm]
     PCI: Found IRQ 11 for device 00:09.0
     Yenta ISA IRQ mask 0x0698, PCI irq 11
     Socket status: 30000417
     cs: IO port probe 0x0100-0x04ff: excluding 0x378-0x37f 0x4d0-0x4d7
     cs: IO port probe 0x0800-0x08ff: clean.
     cs: IO port probe 0x0c00-0x0cff: clean.
     cs: IO port probe 0x0a00-0x0aff: clean.

When I insert the card I get a double-beep and then the red LED on the 3G card lights and then flashes red. The tail of dmesg shows:


   cs: memory probe 0xa0000000-0xa0ffffff: clean.                           
   ttyS02 at port 0x03e8 (irq = 3) is a 16550A                              

Note: My Mobile Orange 3G Card (aka Novatel Merlin U530, see The Kit section for a fuller description) is using the serial_cs driver. When compiling a kernel, this should include, usually as a module, the SERIAL_8250_CS driver.

As an aside, Vodafone UK rebrand the Option 3G card, which needs the usbserial/option driver, I don't cover this hardware in this guide. On a cautionary note, it is possible that Orange, may also rebrand a different make of card in the future or that Novatel may switch to a different serial interface without changing the model number or packaging.

3.1. Minicom

Everybody runs up minicom to look at their modem, don't they? Actually there is one really important AT command that you'll want to know, but I'll leave that until later.

Run minicom -s as root, so that you can set the minicom configuration. Using the dmesg info from when the card was inserted, set the tty serial port e.g. /dev/ttyS2 (Note: the zero '0' is not entered, don't know why?)

A couple of AT commands, they can be entered in either upper or lowercase:


   Welcome to minicom 2.1
  
   OPTIONS: History Buffer, F-key Macros, Search History Buffer, I18n
   Compiled on Nov 12 2003, 19:21:57.
  
   Press CTRL-A Z for help on special keys
  
   AT                                                                         
   OK                                                                         
   ati                                                                        
   Manufacturer: Novatel Wireless Incorporated                                
   Model: Merlin U530 (HW REV 1)                                              
   Revision: 35.0-35.0  [2004-05-12 18:22:10]                                 
   IMEI: xxxxxxxxxxxxxxx                                                      
   +GCAP: +CGSM,+ES                                                           
                                                                              
   OK                                                                         
   at&f                                                                       
   OK                                                                         
   at&v                                                                       
                                                                              
   &C: 1; &D: 2; &F: 0; E: 1; L: 0; M: 0; Q: 0; V: 1; X: 4; Z: 0; S0: 0;      
   S3: 13; S4: 10; S5: 8; S6: 2; S7: 50; S8: 2; S9: 6; S10: 14; S11: 95;      
   +ICF: 3,3; +IFC: 2,2; +IPR: 115200; +DR: 0; +DS: 0,0,2048,6;               
   +CBST: 7,0,1; +CHSN: 0,0,0,0; +CREG: 0; +CGREG: 0; +CSCS: "IRA";           
   +CSTA: 129; +CR: 0; +CRC: 0; +CMEE: 0; +CGDCONT: ; +CGEQREQ: ;             
   +CGEQMIN: ; +CGQREQ: ; +CGQMIN: ; +CGEREP: 0,0; +CGCLASS: "A"; +CGSMS: 3;  
   +CSMS: 0; +CMGF: 0; +CSCA: "+447973100973",145; +CSMP: ,,0,0; +CSDH: 0;    
   +FCLASS: 0; +FDD: 0; +FAR: 0; +FCL: 0;  +FIT: 0,0; +ES: ,,;                
   +ESA: 0,,,,0,0,255,; +CRLP: 61,61,48,6; +CPIN: ,; +CGATT: 1; +CGACT: ;     
   +CPBS: "SM"; +CPMS: "ME","ME","SM"; +CNMI: 0,0,0,0,0; +FTS: 0; +FRS: 0;    
   +FTH: 3; +FRH: 3; +FTM: 96; +FRM: 96; +CCUG: 0,0,0; +CUSD: 0               
                                                                              
   OK                                                                         

Now for the first of the useful AT commands:


   at+csq
   +CSQ: 9,99
  
   OK

The AT+CSQ command gives the signal strength. The responses are:

   +CSQ: 99,99	  No signal (red LED)
   +CSQ: 9,99	  Maybe 1 bar out of 5?

And now probably the most useful AT commands I can tell you about:


   at$nwrat?
   $NWRAT: 2,2,3
  
   OK
   at$nwrat=2,2
   OK

The AT$NWRAT? command shows whether the card has been set to use GPRS/3G, GPRS or 3G only.

In the responses, the first and second arguments (together) shows whether the card has been set to use GPRS/3G, GPRS or 3G only. The third argument shows the data services currently locked to, where a '0' when there is no signal (flashing red LED), a '6' when locked to a GPRS signal (flashing green LED) and a '3' when locked to a 3G signal (flashing blue LED):

   $NWRAT: 0,2,6   Use either GPRS/3G
   $NWRAT: 1,2,6   Use only GPRS (green LED)
   $NWRAT: 2,2,3   Use only 3G (blue LED)

The AT$NWRAT=n,n command is used to select whether to use GPRS/3G, GPRS or 3G only.

   $NWRAT=0,2      Set to use either GPRS/3G
   $NWRAT=1,2      Set to use only GPRS (green LED)
   $NWRAT=2,2      Set to use only 3G (blue LED)

Note: In marginal reception areas it seems to be more reliable if you choose the appropriate service (either GPRS or 3G only) rather than let the card switch back and forth. If you let the card switch back and forth, it has been my experience that the connection is more likely to be dropped.

4. The Dialing scripts

To setup the PPP dialing, I used the pppconfig tool, which I think is the default ppp setup utility for Debian, and then I added extra AT commands to the chatscript and commented out lines in the ISP peers file.

/etc/ppp/peers/orange


  # This optionfile was generated by pppconfig 2.3.2. 
  # 
  #
  noauth
  connect "/usr/sbin/chat -v -f /etc/chatscripts/orange"
  debug
  /dev/ttyS2
  115200
  defaultroute
  noipdefault 
  # ipcp-accept-local
  # ipcp-accept-remote
  user any
  password any
  # remotename orange
  # ipparam orange
  usepeerdns
  # novj

/etc/chatscripts/orange


  # This chatfile was generated by pppconfig 2.3.2.
  # Please do not delete any of the comments.  Pppconfig needs them.
  # 
  # ispauth chat
  # abortstring
  ABORT BUSY ABORT 'NO CARRIER' ABORT VOICE ABORT 'NO DIALTONE' ABORT 'NO DIALTONE' ABORT 'NO ANSWER' ABORT DELAYED
  # modeminit
  '' ATZ
  # Check SIM pin should return ready
  OK-AT-OK "AT+CPIN?"
  # Check the whether 3G or GPRS
  OK-AT-OK "AT$NWRAT?"
  # Set +CGEE to 2
  OK-AT-OK "AT+CMEE=2"
  # Setup PDP? in +CGDCONT
  OK-AT-OK 'AT+CGDCONT=3,"IP","orangeinternet"'
  # Setup +CGEQREG
  OK-AT-OK 'AT+CGEQREQ=3,3,64,384,0,0,2,0,"0E0","0E0",3,0,0'
  # Attached to Orange network, will return 1
  OK-AT-OK 'AT+CGATT?'
  # ispnumber
  OK-AT-OK 'ATD*99***3#'
  # ispconnect
  #CONNECT \c
  # prelogin
  
  # ispname
  # ogin: "dummy"
  # isppassword
  # ssword: \q"dummy"
  # postlogin
  #'' \c
  # end of pppconfig stuff

The AT commands that I added were (some of) the ones that the Orange software was issuing.

The +CPIN?, $NWRAT? and +CGATT? are not important as they only print information. The +CGEQREQ= apparently sets the limits of the data link and that string means the maximum anyway, so probably not necessary. The +CGDCONT and ATD*99***3# are the important strings, if you look at other web-sites these usually have '1's in place of the '3's in mine.

5. Dialing Orange

The Libranet distro comes with a simple GUI Dialer called LibranetPPP. On Debian, I'm now using gpppon, a gnome wrapper around pon and poff.

As root you can also control a PPP connection using the pon & poff commands. To startup a PPP connection:

   pon orange

Or

   pon orange && tail -f /var/log/messages

To shutdown a PPP connection

   poff orange 

The following is a sample of a PPP connection from /var/log/messages:


  Nov 20 09:48:31 acerlin kernel: CSLIP: code copyright 1989 Regents of the
  University of California
  Nov 20 09:48:32 acerlin kernel: PPP generic driver version 2.4.2
  Nov 20 09:48:32 acerlin pppd[2078]: pppd 2.4.2 started by jules, uid 1000
  Nov 20 09:48:33 acerlin chat[2079]: abort on (BUSY)
  Nov 20 09:48:33 acerlin chat[2079]: abort on (NO CARRIER)
  Nov 20 09:48:33 acerlin chat[2079]: abort on (VOICE)
  Nov 20 09:48:33 acerlin chat[2079]: abort on (NO DIALTONE)
  Nov 20 09:48:33 acerlin chat[2079]: abort on (NO DIAL TONE)
  Nov 20 09:48:33 acerlin chat[2079]: abort on (NO ANSWER)
  Nov 20 09:48:33 acerlin chat[2079]: abort on (DELAYED)
  Nov 20 09:48:33 acerlin chat[2079]: send (ATZ^M)
  Nov 20 09:48:33 acerlin chat[2079]: expect (OK)
  Nov 20 09:48:33 acerlin chat[2079]: ATZ^M^M
  Nov 20 09:48:33 acerlin chat[2079]: OK
  Nov 20 09:48:33 acerlin chat[2079]:  -- got it 
  Nov 20 09:48:33 acerlin chat[2079]: send (AT+CPIN?^M)
  Nov 20 09:48:33 acerlin kernel: spurious 8259A interrupt: IRQ7.
  Nov 20 09:48:33 acerlin chat[2079]: expect (OK)
  Nov 20 09:48:33 acerlin chat[2079]: ^M
  Nov 20 09:48:33 acerlin chat[2079]: AT+CPIN?^M^M
  Nov 20 09:48:33 acerlin chat[2079]: +CPIN: READY^M
  Nov 20 09:48:33 acerlin chat[2079]: ^M
  Nov 20 09:48:33 acerlin chat[2079]: OK
  Nov 20 09:48:33 acerlin chat[2079]:  -- got it 
  Nov 20 09:48:33 acerlin chat[2079]: send (AT$NWRAT?^M)
  Nov 20 09:48:33 acerlin chat[2079]: expect (OK)
  Nov 20 09:48:33 acerlin chat[2079]: ^M
  Nov 20 09:48:34 acerlin chat[2079]: AT$NWRAT?^M^M
  Nov 20 09:48:34 acerlin chat[2079]: $NWRAT: 2,2,3^M
  Nov 20 09:48:34 acerlin chat[2079]: ^M
  Nov 20 09:48:34 acerlin chat[2079]: OK
  Nov 20 09:48:34 acerlin chat[2079]:  -- got it 
  Nov 20 09:48:34 acerlin chat[2079]: send (AT+CMEE=1^M)
  Nov 20 09:48:34 acerlin chat[2079]: expect (OK)
  Nov 20 09:48:34 acerlin chat[2079]: ^M
  Nov 20 09:48:34 acerlin chat[2079]: AT+CMEE=1^M^M
  Nov 20 09:48:34 acerlin chat[2079]: OK
  Nov 20 09:48:34 acerlin chat[2079]:  -- got it 
  Nov 20 09:48:34 acerlin chat[2079]: send (AT+CGDCONT=3,"IP","orangeinternet"^M)
  Nov 20 09:48:34 acerlin chat[2079]: expect (OK)
  Nov 20 09:48:34 acerlin chat[2079]: ^M
  Nov 20 09:48:35 acerlin chat[2079]: AT+CGDCONT=3,"IP","orangeinternet"^M^M
  Nov 20 09:48:35 acerlin chat[2079]: OK
  Nov 20 09:48:35 acerlin chat[2079]:  -- got it 
  Nov 20 09:48:35 acerlin chat[2079]: send (AT+CGEQREQ=3,3,64,384,0,0,2,0,"0E0","0E0",3,0,0^M)
  Nov 20 09:48:35 acerlin chat[2079]: expect (OK)
  Nov 20 09:48:35 acerlin chat[2079]: ^M
  Nov 20 09:48:36 acerlin chat[2079]: AT+CGEQREQ=3,3,64,384,0,0,2,0,"0E0","0E0",3,0,0^M^M
  Nov 20 09:48:36 acerlin chat[2079]: OK
  Nov 20 09:48:36 acerlin chat[2079]:  -- got it 
  Nov 20 09:48:36 acerlin chat[2079]: send (AT+CGATT?^M)
  Nov 20 09:48:36 acerlin chat[2079]: expect (OK)
  Nov 20 09:48:36 acerlin chat[2079]: ^M
  Nov 20 09:48:36 acerlin chat[2079]: AT+CGATT?^M^M
  Nov 20 09:48:36 acerlin chat[2079]: +CGATT: 1^M
  Nov 20 09:48:36 acerlin chat[2079]: ^M
  Nov 20 09:48:36 acerlin chat[2079]: OK
  Nov 20 09:48:36 acerlin chat[2079]:  -- got it 
  Nov 20 09:48:36 acerlin chat[2079]: send (ATD*99***3#^M)
  Nov 20 09:48:36 acerlin pppd[2078]: Serial connection established.
  Nov 20 09:48:36 acerlin pppd[2078]: Using interface ppp0
  Nov 20 09:48:36 acerlin pppd[2078]: Connect: ppp0 <--> /dev/ttyS2
  Nov 20 09:48:38 acerlin pppd[2078]: CHAP authentication succeeded
  Nov 20 09:48:38 acerlin kernel: PPP BSD Compression module registered
  Nov 20 09:48:38 acerlin kernel: PPP Deflate Compression module registered
  Nov 20 09:48:43 acerlin pppd[2078]: Could not determine remote IP address: defaulting to 10.64.64.64
  Nov 20 09:48:43 acerlin pppd[2078]: local  IP address 10.40.3.187
  Nov 20 09:48:43 acerlin pppd[2078]: remote IP address 10.64.64.64
  Nov 20 09:48:43 acerlin pppd[2078]: primary   DNS address 193.36.81.38
  Nov 20 09:48:43 acerlin pppd[2078]: secondary DNS address 193.36.81.37
  Nov 20 10:05:35 acerlin pppd[2078]: LCP terminated by peer
  Nov 20 10:05:35 acerlin pppd[2078]: Hangup (SIGHUP)
  Nov 20 10:05:35 acerlin pppd[2078]: Modem hangup
  Nov 20 10:05:35 acerlin pppd[2078]: Connection terminated.
  Nov 20 10:05:35 acerlin pppd[2078]: Connect time 17.0 minutes.
  Nov 20 10:05:35 acerlin pppd[2078]: Sent 98739 bytes, received 511152 bytes.
  Nov 20 10:05:37 acerlin pppd[2078]: Exit.

5.1. Problems & Tips

I've encountered a few problems while I was setting up and starting a PPP connnection.

  1. When I was first trying to connect, I spent a very frustrating couple of hours trying to work out why I was getting a "Serial link is not 8-bit clean" error message from pppd. I had made a typo when entering the telephone number and I had only typed in one 9 instead of two. Aaargh!

  2. The pppd tries to get the dns ip addresses but after many attempts exits. If I run up minicom after such a failure then NO CARRIER is the first response back from the 3G Card. Question, is the chatscript missing the NO CARRIER response? By observation when it does occur, I've got the Card locked to using the 3G only and the signal is probably not strong enough.

  3. Is there a way to monitor the signal strength when online? Apparently, a later version of the Orange software for Windows can now monitor the signal strength. I haven't seen the newer software, but I've read messages that it is still awful.

  4. If the connection drops, I can't always get the PPP to connect again. When I investigate with minicom, sometimes I have to enter AT&F (which should probably be in my chatscript anyway?). On other occasions, I've found that the card needs to be switched between 3G and GPRS (or the other way around) before it will pick up a signal.

  5. To save from unplugging the card all the time. For kernel 2.4.x: I've been using the pcmcia init.d script. As root, I've been entering /etc/init.d/pcmcia stop and this seems to switch off the 3G card because the LED on the 3G card goes off. Switch the 3G card back on using /etc/init.d/pcmcia start.

    For kernel 2.6.x: I'm using sudo cardctl eject and sudo cardctl insert to switch the card off and on.

  6. Some emails would hang part way through sending and the connection would timeout. I was finding that sometimes I couldn't send emails. If I tried with a small test email that would often send okay. Adding mtu 1452 to /etc/ppp/peers/orange seemed to solve the problem.

6. Misc

I wrote this document with jed and then translated it to html using the txt2tags command:

  txt2tags -n --toc -i debian-orange-3g.t2t -o debian-orange-3g.html -t html

TO DO

  1. The PPPStatus program
  2. Calculating the total bytes used. I made some progress with a small Python script to parse the PPPStatus log files. It currently prints each connection made in date order, the totals bytes transferred so far this month and the remaining bytes available. I am still a beginner with Python, so I haven't put it up here yet.

7. Contact

If you wish to comment on this guide, please send any comments to debora3g at xemaps point com

--The End--