1

I've decided to bring up a GSM Modem for my Linux machine (OpenSuse 12.1 64-bit on Vmware) so that I can use it as the SMS gateway. I've got a Wavecom M1306B GSM modem which provides a USB interface, and obviously there is a USB cable (end to end, GSM Modem to my Desktop) with it.

I tested this modem successfully with my Windows 7 64-bit PC by running some basic commands on it. (like: AT , ATZ, ..)

Here are some of my logs:

machine2:~ # lsusb
Bus 001 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 001 Device 002: ID 0e0f:0003 VMware, Inc. Virtual Mouse
Bus 001 Device 003: ID 0e0f:0002 VMware, Inc. Virtual USB Hub
Bus 001 Device 006: ID 067b:2303 Prolific Technology, Inc. PL2303 Serial Port

lsusb -v output for that interface:

Bus 001 Device 006: ID 067b:2303 Prolific Technology, Inc. PL2303 Serial Port
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               1.10
  bDeviceClass            0 (Defined at Interface level)
  bDeviceSubClass         0 
  bDeviceProtocol         0 
  bMaxPacketSize0        64
  idVendor           0x067b Prolific Technology, Inc.
  idProduct          0x2303 PL2303 Serial Port
  bcdDevice            3.00
  iManufacturer           1 Prolific Technology Inc.
  iProduct                2 USB-Serial Controller
  iSerial                 0 
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength           39
    bNumInterfaces          1
    bConfigurationValue     1
    iConfiguration          0 
    bmAttributes         0xa0
      (Bus Powered)
      Remote Wakeup
    MaxPower              100mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           3
      bInterfaceClass       255 Vendor Specific Class
      bInterfaceSubClass      0 
      bInterfaceProtocol      0 
      iInterface              0 
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x81  EP 1 IN
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x000a  1x 10 bytes
        bInterval               1
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x02  EP 2 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x83  EP 3 IN
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               0
Device Status:     0x0000
  (Bus Powered)



machine2:/proc # setserial -a /dev/ttyUSB0
/dev/ttyUSB0, Line 0, UART: 16654, Port: 0x0000, IRQ: 0
        Baud_base: 460800, close_delay: 0, divisor: 0
        closing_wait: infinte
        Flags: spd_normal

machine2:/home/smsto/bin # setserial -a /dev/ttyS0
/dev/ttyS0, Line 0, UART: 16550A, Port: 0x03f8, IRQ: 4
        Baud_base: 115200, close_delay: 50, divisor: 0
        closing_wait: 3000
        Flags: spd_normal skip_test

machine2:/home/smsto/bin # setserial -a /dev/ttyS1
/dev/ttyS1, Line 1, UART: 16550A, Port: 0x02f8, IRQ: 3
        Baud_base: 115200, close_delay: 50, divisor: 0
        closing_wait: 3000
        Flags: spd_normal skip_test

machine2:/proc # setserial -G /dev/ttyUSB0
/dev/ttyUSB0 uart 16654 port 0x0000 irq 0 baud_base 460800 spd_normal

machine2:/proc # setserial /dev/ttyUSB0
/dev/ttyUSB0, UART: 16654, Port: 0x0000, IRQ: 0


machine2:/proc/tty/driver # ls -ltr
total 0
-r--r--r-- 1 root root 0 Jan 10 14:03 usbserial
-r--r--r-- 1 root root 0 Jan 10 14:03 serial

machine2:/proc/tty/driver # cat serial 
serinfo:1.0 driver revision:
0: uart:16550A port:000003F8 irq:4 tx:0 rx:0 CTS|DSR|CD
1: uart:16550A port:000002F8 irq:3 tx:0 rx:0 CTS|DSR|CD
2: uart:unknown port:000003E8 irq:4
3: uart:unknown port:000002E8 irq:3
4: uart:unknown port:00000000 irq:0
5: uart:unknown port:00000000 irq:0
6: uart:unknown port:00000000 irq:0
7: uart:unknown port:00000000 irq:0

machine2:/proc/tty/driver # cat usbserial 
usbserinfo:1.0 driver:2.0
0: module:pl2303 name:"pl2303" vendor:067b product:2303 num_ports:1 port:1 path:usb-0000:02:00.0-2.1

machine2:/proc/tty # cat drivers 
/dev/tty             /dev/tty        5       0 system:/dev/tty
/dev/console         /dev/console    5       1 system:console
/dev/ptmx            /dev/ptmx       5       2 system
/dev/vc/0            /dev/vc/0       4       0 system:vtmaster
usbserial            /dev/ttyUSB   188 0-253 serial
serial               /dev/ttyS       4 64-79 serial
pty_slave            /dev/pts      136 0-1048575 pty:slave
pty_master           /dev/ptm      128 0-1048575 pty:master
unknown              /dev/tty        4 1-63 console


machine2:/proc/tty # dmesg | grep -i tty

[    1.383652] serial8250: ttyS0 at I/O 0x3f8 (irq = 4) is a 16550A
[    1.424541] serial8250: ttyS1 at I/O 0x2f8 (irq = 3) is a 16550A
[    1.581063] 00:0a: ttyS0 at I/O 0x3f8 (irq = 4) is a 16550A
[    1.654207] 00:0b: ttyS1 at I/O 0x2f8 (irq = 3) is a 16550A
[    1.938507] tty tty17: hash matches
[ 2498.137304] usb 1-2.1: pl2303 converter now attached to ttyUSB0

I noticed that the Baud rate of USB0 interface is too much, so i tried to assign 115200 :

machine2:/proc # setserial /dev/ttyUSB0 baud_base 115200
Cannot set serial info: Invalid argument

So, it is the problem ... and I receive this error. Whenever I try to connect S0, S1, USB0 interfaces via minicom, it simply doesn't work.

dsolimano
  • 8,870
  • 3
  • 48
  • 63
atari83
  • 489
  • 1
  • 5
  • 15

2 Answers2

1

Baud_base is not the port speed, it's the maximum speed when a frequency divisor is 1. The ability to set baud_base probably doesn't apply to USB serial device at all, and it's most certainly not what you want.

Use stty to set the port speed, or use cu or minicom for testing (they can set port speed by themselves).

Anton Kovalenko
  • 20,999
  • 2
  • 37
  • 69
  • Thanks for the hint, i tried stty -F /dev/ttyUSB0 115200 , still same result. in minicom, during typing commands i see only strange ascii characters. – atari83 Jan 10 '13 at 17:09
  • Do you receive similar or different replies for the same command (e.g. just AT which should give OK) with different speeds? (I would start with 9600)? Are there any chances that the device doesn't support AT commands at all, using some proprietary binary protocol instead? – Anton Kovalenko Jan 10 '13 at 17:11
  • Thanks Anton, it works !! now i get the device running on 57600 (baud-rate) successfully. now i see my AT commands and responses, but i just faced another problem, when i try send an sms i receive "+CMS ERROR: 512" from device. i can show u the complete list of commands i've used but it is very straight forward, from my Windows PC, i see same result. is it because the device is broken ? – atari83 Jan 10 '13 at 19:20
  • Not necessarily. It can be wrong SMSC number in the device (`AT+CSCA`), and it can be a present/absent SMSC prefix in SMS PDU while the device expects absent/present SMSC prefix. Or it can be something else. I work with this stuff for years, and GSM devices never fail to astonish me on how much can be wrong with them :) – Anton Kovalenko Jan 10 '13 at 19:22
  • P.S. Do you send commands programmatically or by hand? Inserting pauses (e.g. after you received `>` and before you provide data) may help. Ensuring that you don't send `CR+LF`, but rather `CR` in the end of commands/data may help too. – Anton Kovalenko Jan 10 '13 at 19:26
  • :) actually now i'm using terminal tools to make sure if the device is healthy and there are no problem with my platform. for SMSC part, i've checked with `AT+CSCA?` , and the result is: `+CSCA: "+9891100500",145` , then i tried to list the supported SMS Formats by `AT+CMGF?` and it seems only Text mode is supported : `+CMGF: 1` , so i chose text mode and at last tried to send a message but every time it fails. – atari83 Jan 10 '13 at 19:48
0

I'm not sure about the baud rate but If you open up another terminal and do cat /dev/ttyUSB0 Then in the first terminal do echo AT > /dev/ttyUSB0 you might get an OK back..not sure if it helps but it should get you a response at least..

SpaceCowboy
  • 543
  • 6
  • 16