Sending AT Command to GPRS Modem

hello,
I want to send AT command from colibri imx6dl to gprs modem. my carrier board is iris V1.1A

I use UART-A RS-232 header (X13) and attach my device in here.

information about UART-A RS-232 in here;

UART-A RS-232 header (X13)

The Full Function (FF) UART-A RS-232 connector is a 10 way (2 rows x 5 way) 2.54mm pitch header

capable of being connected to an industry standard DTK/INTEL 10 way IDC to 9 way D-type male

connector.

Connector type: 2x5 Pin Header Male, 2.54mm

Pin Signal Name

1 RS232_A_ DCD I

2 RS232_A_ DSR I

3 RS232_A_ RXD I

4 RS232_A_ RTS O

5 RS232_A_ TXD O

6 RS232_A_ CTS I

7 RS232_A_ DTR O

8 RS232_A_ RI I

9 GND 10 NC

so ı attached my gprs module on my board with rx tx and gnd.

than run this command;

root@colibri-imx6:~# dmesg | grep tty

[ 0.000000] Kernel command line: enable_wait_mode=off galcore.contiguousSize=50331648 ip=off

root=/dev/mmcblk0p2 rw,noatime rootfstype=ext3 rootwait fec_mac=00:14:2d:4a:4b:48 consoleblank=0

no_console_suspend=1 console=tty1 console=ttymxc0,115200n8

video=mxcfb0:dev=lcd,640x480M@60,if=RGB666 video=mxcfb1:off fbmem=8M

[ 0.000000] console [tty1] enabled

[ 0.426579] 2020000.serial: ttymxc0 at MMIO 0x2020000 (irq = 58) is a IMX

[ 1.150351] console [ttymxc0] enabled

[ 1.151105] 21e8000.serial: ttymxc1 at MMIO 0x21e8000 (irq = 59) is a IMX

[ 1.151558] 21ec000.serial: ttymxc2 at MMIO 0x21ec000 (irq = 60) is a IMX

[ 3.307480] systemd[1]: Expecting device dev-ttymxc0.device…

[ 3.579594] systemd[1]: Starting system-serial\x2dgetty.slice.

[ 3.611031] systemd[1]: Created slice system-serial\x2dgetty.slice.

[ 3.648763] systemd[1]: Starting system-getty.slice.

[ 3.681008] systemd[1]: Created slice system-getty.slice.

Created slice system-getty.slice.

but ı can not found my device .

how can ı find it ?

please help me about this problem. thank you so much .

Hi AsimTurgut, first question. Your modem GPRS is 5V or 3.3V?

The serial ports are:

...
[ 0.426579] 2020000.serial: ttymxc0 at MMIO 0x2020000 (irq = 58) is a IMX >
[ 1.150351] console [ttymxc0] enabled
[ 1.151105] 21e8000.serial: ttymxc1 at MMIO 0x21e8000 (irq = 59) is a IMX
[ 1.151558] 21ec000.serial: ttymxc2 at MMIO 0x21ec000 (irq = 60) is a IMX
...

Your UART-A possibly will be:

/dev/ttymxc0

Try:

# minicom -D /dev/ttymxc0 -b 115200

Or

# picocom /dev/ttymxc0 -b 115200

Replace 11500 by baudrate of modem, after send command AT by the console serial.

Att,
Cleiton Bueno

Blog | Linkedin | B2Open

UART_A is the standard debug port used on our modules, you could use any other free UART port for interfacing your GPRS modem, may be UART_B. The UART device’s are not hot plugable, one cannot find it on plugging. You can use ‘ppp’ for configuring/using serial GPRS modems.

Here are the steps for using serial GPRS modem:

  • Enable PPPOE by adding CONFIG_PPPOE=y to the kernel defconfig file for the module. Refer here for instructions on building the kernel from source.
  • Build the kernel after enabling the above option for kernel and flash the uImage on the module.
  • The ppp package can be installed via opkg package manager. e.g. # opkg update && opkg install ppp
  • On the module, create a file in the path “/etc/ppp/peers/gprs” with the below content:
/dev/ttymxc1
 115200
 connect ‘chat -f /etc/ppp/chat/gprs’
 defaultroute
 usepeerdns

The first line is the serial port to which the GPRS module is connected to, for information on available UARTports, refer here. The second line is the baud rate. The third line is to tell pppd which chat script to use. The last two lines are to tell the pppd to use the default gateway and DNS information received from the remote host to complete the configuration of IP related settings.

  • Next is the chat script. The chat script is used to send commands to the modem until it’s ready for negotiation of the ppp connection. Below is the example chat script which should be saved as /etc/ppp/chat/gprs

ABORT ‘BUSY’
ABORT ‘NO CARRIER’
ABORT ‘ERROR’
‘ ‘ AT
OK AT+CGDCONT=1,”IP”,”www”
OK ATDT99**1#
The first three lines are to detect errors from your modem and stop the dialing process. The next three lines are send if everything is ok. You should add any commands here you need for initialisation (like sending the PIN code and tell the device to attach). You need to replace www by the APN name of your GPRS connection.

  • The DNS information will be populated in the file /var/run/ppp/resolv.conf.
    This is as per the ip-up script in /etc/ will be run after ppp connection which in turn will run the script 08setupdns in ip-up.d. The DNS is picked up from /etc/resolv.conf system wide. Copy the DNS information in /var/run/ppp/resolv.conf to /etc/resolv.conf. Please note that the name of the file in /etc/ip-up.d may be different.

  • Now from the command line on the module, run pon gprs.

  • You can see the ppp0 connection by running ifconfig.

ppp0 Link encap:Point-to-Point Protocol
inet addr:100.64.128.143 P-t-P:10.64.64.64 Mask:255.255.255.255
UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1500 Metric:1
RX packets:16 errors:1 dropped:0 overruns:0 frame:0
TX packets:22 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:3
RX bytes:1224 (1.1 KiB) TX bytes:1039 (1.0 KiB)

  • To turn the connection off, run poff gprs.

For more hints/information on ppp, refer the below links:

http://www.tldp.org/HOWTO/PPP-HOWTO/

https://wiki.archlinux.org/index.php/Pppd

https://wiki.archlinux.org/index.php/3G_and_GPRS_modems_with_pppd

ernstagn.home.xs4all.nl/GPRS-HOWTO/GPRS-HOWTO-6.html

Okey ı found this file and edit. but ı dont have Vfat file system sd card so board could not found sd card ? have you got any idea for this problem ?

ı take an error:

Colibri iMX6 # run setupdate

Failed to mount ext2 filesystem…

** Unrecognized filesystem type **

starting USB…

USB0: Port not available.

USB1: USB EHCI 1.00

scanning bus 1 for devices… 1 USB Device(s) found

   scanning usb for storage devices... 0 Storage Device(s) found

   scanning usb for ethernet devices... 0 Ethernet Device(s) found

** Bad device usb 0 **

Using FEC device

TFTP from server 192.168.10.1; our IP address is 192.168.10.2

Filename ‘flash_eth.img’.

Load address: 0x10800000

Loading: T T T T T T T T T T

Retry count exceeded; starting again

Using FEC device

TFTP from server 192.168.10.1; our IP address is 192.168.10.2

Filename ‘flash_eth.img’.

Load address: 0x10800000

Loading: T T T T T T T T T T

Retry count exceeded; starting again

Using FEC device

TFTP from server 192.168.10.1; our IP address is 192.168.10.2

Filename ‘flash_eth.img’.

Load address: 0x10800000

hi cleitonbueno,

my modem rs232 output is 5v.

ı use only rx tx and ground than pluged this pin on my iris board X13(UART-A RS232) .

than ı open minicom and send At command to my modem but sometimes ı could not get response .

I guess you are trying to reflash the module with the recompiled kernel. For flashing the module one need to prepare the SD card as per the instructions provided here. After preparing the SD card replace the prebuild uImage available in the prepared SD card with the recompiled uImage and use the flash scripts from U-Boot to flash the custom kernel.

e.g.

run setupdate
run update_kernel

hi bhuvanchandra,

I can do this but ı have a other question.

firsty ı clone “u-boot-toradex” with git clone -b 2015.04-toradex git://git.toradex.com/u-boot-toradex.git this command than ı found colibri_imx6_defconfig file on this path u-boot-toradex/configs and ı add CONFIG_PPPOE=y this line on this file .

secondly ı clone “linux-toradex” with git clone -b tegra git://git.toradex.com/linux-toradex.git
this command but ı could not found colibri_imx6_defconfig how can ı found this config file ? I try linux-toradex/arch/arm/configs/ this path but ı could not found file in this path
this is kernel defconfig file but ı could not found this config file .

should I create colibri_imx6_defconfig file manually ?

The CONFIG_PPOE we are talking about is with Kernel, there is no need to recompile U-Boot bootloader and the config is not applicable in U-Boot. Coming to the kernel source clone, you are not selecting the appropriate branch for Colibri iMX6, refer here in this article for information regarding the kernel branch wrt Image version applicable for iMX6 based modules.

Yes I found this colibri_imx6_defconfig thanx for all replies

git clone -b toradex_imx_3.14.28_1.0.0_ga git://git.toradex.com/linux-toradex.git

ı use this branch becouse my image version Colibri_iMX6_LinuxImageV2.5_20151215.

now ı add CONFIG_PPPOE=y this line in the config file . then run this command on the linux-toradex path

make colibri_imx6_defconfig

but ı take an error: error is here :

Can’t find default configuration “arch/x86/configs/colibri_imx6_defconfig”!

should ı move colibri_imx6_defconfig file from linux-toradex/arch/arm/configs to arch/x86/configs/

?

I would recommend you to strictly follow the steps in this article.
One need to export the ARCH and CROSS_COMPILE variables before cross-compiling.