Skip to main content

Expansion Board - 4G EC20

Navigation bar

On the CAM126B-P, connect the onboard 24PIN expansion UART to the AT port of a Quectel EC20 / EC25 to query GPS. The board has a built-in TTL adapter, so there is no need to buy a USB-TTL adapter. SSH into the 1126 and operate on /dev/ttyS2.

You can also use the ready-made EC20-38: 4G data goes over its 4PIN Ethernet port, GPS goes over the 24PIN UART0 (pins 22 / 23).

For interface definitions and pins, see Interface Definition and Interface Debugging:

The default interface of CAM126B-P is ttyS2, and the default baud rate is 9600

The GPS commands in this document are based on tests with QuecOpen / fanconn firmware (the module reports EC20F).

About the EC25

The EC25 uses the same expansion board PCB as the EC20 and has similar functions; only the module model differs (the EC25 covers more bands and higher rates). AT commands, the GPS query flow and the wiring are identical, so every command in this document also applies to the EC25.

Caution

Do not connect to the onboard Debug pads of the CAM126B-P (TTL debug 1500000). That is the camera's own Linux console, not the module's AT port.

The TX / RX of the 24PIN expansion UART are crossed with the module, and GND is common. The level is 1.8V (tested to communicate with TTL 3V3 for short periods).

The SDIO voltage is 1.8V; do not connect it to the GPS serial port.

Which side of the module the wire connects toModule nodeHow to recognize it on the 1126Purpose
AT (main UART)ttyHS0Send AT and get OKQuery GPS (this document)
DebugttyHSL0login:Enter the module's Linux (optional)

NMEA is not necessarily emitted continuously from the UART (a common outport is linuxsmd or usbnmea). Idle listening on ttyS2 often yields no $GPGGA; you must send an AT query.


Connecting the EC20-38 Expansion Board (Ethernet + GPS over 24PIN)​

The EC20-38 is a ready-made expansion board: 4G data goes over its 4PIN Ethernet port, and GPS / AT queries go over the 24PIN UART0. Both can be used at the same time.

RequirementWhich port to useOn the 1126 side
4G dataJ11 / J12 of the EC20-38 (4PIN Ethernet)6PIN Ethernet port / RJ45
GPS, AT queriesJ2 of the EC20-38 (module AT port)24PIN pins 22 / 23

For expansion board interface details, see EC20-38 Interface Description.

Connecting the 4PIN Ethernet Port to the 1126​

RV1126 6PINSignalEC20-38 J11 / J12
1TX+1 T_TA_P
2TX−2 T_TA_N
3RX+3 T_TB_P
4RX−4 T_TB_N
5 / 6NC (reserved for POE, not used)Leave unconnected

EC20-38 connected to the RV1126 6PIN Left: RV1126 6PIN Ethernet port; right: J11 of the EC20-38; bottom: only wires 1/2/3/6 are used when crimping an RJ45

  • J11 and J12 carry the same signals. Use only one and leave the other unconnected.
  • Both PHYs support auto-MDIX, so a straight-through cable is enough; if it does not link, try a crossover cable.
  • Pins 5 and 6 of the 6PIN connector are reserved for POE; do not connect them on either end.

Information Obtained via DHCP​

After power-up, the EC20-38 acts as a DHCP server, and the peer automatically receives an address in 192.168.100.x/24. Measured (an ImmortalWrt router connected via eth1):

root@Cudy-WRT:~# ip addr show eth1
3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 state UP group default qlen 1000
link/ether 80:af:ca:8c:64:71 brd ff:ff:ff:ff:ff:ff
inet 192.168.100.80/24 brd 192.168.100.255 scope global eth1
valid_lft forever preferred_lft forever
ItemMeasured valueDescription
Subnet192.168.100.0/24Default LAN subnet of the expansion board
Peer address192.168.100.80Assigned automatically by DHCP
Gateway192.168.100.1The expansion board itself (subject to actual measurement)

On the 1126 side, bring up DHCP manually and verify:

udhcpc -i eth0
ip addr show eth0
ping -c 3 192.168.100.1

The Ethernet interface name on the 1126 is not necessarily eth0; check the actual name with ip link first.

GPS over the 24PIN UART0​

J2 of the EC20-38 (VDD_3V3_F20 / TXD_3V3 / RXD_3V3 / GND) is the module's main UART. AT commands, GPS and 4G band queries all go through it:

1126 24PINSignalConnect to EC20-38 J2
22UART0_TX3 RXD_3V3 (module receives)
23UART0_RX2 TXD_3V3 (module transmits)
1 / 2GND4 GND

TX / RX must be crossed, and GND must be common.

You can also connect J4 (the module Debug port, DBG_TXD_3V3 / DBG_RXD_3V3) to enter the module's Linux and query GPS with attool:

/usrdata/fanconn/bin/attool AT+QGPS?
Which port to useWhat you can seeBest for
J2 (main UART)AT returns OKSending AT commands for GPS / band queries (recommended)
J4 (Debug)Module Linux boot logs, login:Troubleshooting inside the module
Voltage levels

J2 / J4 of the EC20-38 are 3.3V TTL, while the 24PIN UART of the 1126 is 1.8V. Short-term communication works in testing, but for long-term use add a level shifter, and connect only TX / RX / GND — never VDD_3V3_F20.

The AT flow for GPS queries is exactly the same as AT GPS below; just replace /dev/ttyS2 with the device corresponding to the 24PIN UART0 (usually /dev/ttyS0; confirm with ls /dev/ttyS*).


Debugging​

Onboard Interface​

ItemValueDescription
Device node/dev/ttyS2Default expansion UART of the CAM126B-P
Factory baud rate9600Same as Interface Debugging
Data bits8N1No flow control
AdapterOnboard TTLNo USB-TTL, no /dev/ttyUSB0
24PINX05C2024TZSee the pin table below
Pin numberFunction description
1GND
2GND
22UART0_TX (1126 transmits)
23UART0_RX (1126 receives)

Connecting to the EC20/EC25: 1126 TX → module RX, 1126 RX → module TX, GND common. Connect to the module's AT port, not the module's DBG port.

SSH into the camera (example):

ssh root@<CAM126B-P IP>

Check the current baud rate on the board:

root@rv1126bp-buildroot:/# stty -F /dev/ttyS2 -a | grep speed
stty: /dev/ttyS2: Inappropriate ioctl for device
speed 9600 baud; line = 0;

Inappropriate ioctl can be ignored; speed 9600 is the factory default.

Aligning the Baud Rate with the Module AT Port​

The EC20/EC25 AT port is usually 115200 8N1 from the factory (AT+IPR? → +IPR: 115200).
The factory ttyS2 of the 1126 is 9600; a mismatch results in no data or garbled output.

Before querying GPS, change the local side on the 1126 to 115200 (without changing the module):

stty -F /dev/ttyS2 115200 raw -echo
microcom -s 115200 /dev/ttyS2

microcom is already available onboard; exit is usually Ctrl+X. Commands must end with \r.

After testing, you can restore the board side to the documented default:

stty -F /dev/ttyS2 9600

Confirming Which Port You Are Connected To​

Send the following in microcom:

AT
  • If it returns OK: this is the AT port; continue to the next section to query GPS.
  • If u.fanconn.com login: or kernel logs appear: you are connected to the module's Debug port; reconnect to the main UART.

Module Debug Port (Optional)​

Only when you need to enter the module's Linux should you switch ttyS2 to the module DBG port (also use microcom -s 115200 first). The module Debug port is ttyHSL0, 115200 8N1, console=ttyHSL0,115200,n8.

User: root
Password: quectel123
The password is subject to the actual firmware.

After logging in you can confirm the GPS output port (for coordinates, still use the AT port):

/usrdata/fanconn/bin/attool AT+QGPS?
/usrdata/fanconn/bin/attool AT+QGPSCFG="outport"

4G Band / Network Queries​

Besides GPS, the current band, operator and signal strength are also available on the same AT port (/dev/ttyS2, 115200 8N1). Run microcom -s 115200 /dev/ttyS2 first, then send the commands in order.

CommandPurposeKey response
AT+CPIN?SIM statusNormal only when +CPIN: READY
AT+CSQSignal strength+CSQ: 29,99 (0–31; 99 = unknown)
AT+COPS?Current operator+COPS: 0,0,"CHN-CT",7
AT+CEREG?LTE registration status0,1 registered, 0,5 roaming
AT+QNWINFORAT / operator / band / EARFCNSee below
AT+QENG="servingcell"Serving cell (band, PCI, TAC)See below
AT+QCSQRSSI / RSRP / RSRQ / SINRSee below
AT+QCAINFOCarrier aggregationAny response means CA is active

AT+QNWINFO is the most direct source of band information:

AT+QNWINFO
+QNWINFO: "FDD LTE","46011","LTE BAND 3",1650

OK
FieldExampleDescription
act"FDD LTE"FDD LTE / TDD LTE / WCDMA / GSM
oper"46011"MCC + MNC; 46011 = China Telecom
band"LTE BAND 3"Current band
channel1650EARFCN

Field 10 of AT+QENG="servingcell" is the band number (use AT+QENG=0 if the older firmware does not support the quoted form):

AT+QENG="servingcell"
+QENG: "servingcell","NOCONN","LTE","FDD",460,11,1A2B3C4,123,1650,3,20,20,ABCDE,-,-,-,-,-

OK

Under LTE, AT+QCSQ returns "LTE",<rssi>,<rsrp>,<rsrq>,<sinr> in that order. Judge the signal by rsrp (above -90 dBm is good; below -110 dBm is basically unusable):

AT+QCSQ
+QCSQ: "LTE",-55,-78,165,-12

OK

Common band reference:

BandFrequencyDuplexBandFrequencyDuplex
B12100 MHzFDDB342010–2025 MHzTDD
B31800 MHzFDDB382570–2620 MHzTDD
B5850 MHzFDDB391880–1920 MHzTDD
B8900 MHzFDDB402300–2400 MHzTDD
B412496–2690 MHzTDD

Typical bands in China: China Mobile B3/B8/B34/B38/B39/B40/B41, China Unicom B1/B3/B8, China Telecom B1/B3/B5.

tip

If AT+QNWINFO returns No Service, check AT+CPIN?, AT+CSQ and AT+CEREG? in that order first, then make sure the MAIN antenna and the SIM are in place.


AT GPS​

Opening the AT Port on the 1126​

ssh root@<CAM126B-P IP>
stty -F /dev/ttyS2 115200 raw -echo
microcom -s 115200 /dev/ttyS2
Item1126 board (documented default)When connecting to EC20 AT
Device/dev/ttyS2Same as left
Baud rate9600Change the local side to 115200
Frame format8N1Module AT+ICF? → +ICF: 3,3 (8N1)
Flow controlNoneModule AT+IFC? → +IFC: 0,0
AdapterOnboard TTLNo USB-TTL

Confirming the Module​

ATE0
ATI
AT+IPR?

It should look like:

OK

Quectel
EC20F
Revision: EC20CEFILGR06A04M1G_OCPU

OK

+IPR: 115200

OK

Enabling GNSS​

AT+QGPS=1
AT+QGPS?
AT+QGPSCFG="nmeasrc"
+QGPS: 1
OK

+QGPSCFG: "nmeasrc",1
OK

nmeasrc must be 1; otherwise AT+QGPSGNMEA is unavailable. If it is already 1, running AT+QGPS=1 again may return +CME ERROR: 504 (already enabled), which can be ignored.

The antenna must be outdoors or outside a window.

Querying Coordinates​

AT+QGPSLOC=2

Decimal degrees; on success it returns a single line:

+QGPSLOC: <utc>,<lat>,<lon>,<hdop>,<alt>,<fix>,<cog>,<spkm>,<spkn>,<date>,<nsat>
FieldDescription
utcUTC hours, minutes, seconds
lat / lonDecimal degrees
hdopHorizontal dilution of precision
altAltitude (meters)
dateDDMMYY
nsatNumber of satellites used in the fix

For degrees/minutes/seconds format, use AT+QGPSLOC=0.

No fix:

+CME ERROR: 516

A cold start may take tens of seconds; repeat AT+QGPSLOC=2 until it no longer returns 516.

Querying NMEA (Optional)​

AT+QGPSGNMEA="GGA"
AT+QGPSGNMEA="RMC"
AT+QGPSGNMEA="GSA"
AT+QGPSGNMEA="GSV"
AT+QGPSGNMEA="VTG"

If field 7 of $GPGGA is 0, the data is invalid; 1 or above means a fix has been obtained.

Test Results (CAM126B-P ttyS2)​

On the board, first run microcom -s 115200 /dev/ttyS2, then send AT+QGPSLOC=2 / AT+QGPSGNMEA="GGA":

+IPR: 115200
+QGPS: 1
+QGPSCFG: "outport",usbnmea
+QGPSCFG: "nmeasrc",1

+QGPSLOC: 085415.0,23.17198,113.40420,0.7,47.0,2,4.56,0.0,0.0,210926,10

OK

+QGPSGNMEA: $GPGGA,085430.00,2310.319110,N,11324.251854,E,1,07,0.7,47.3,M,-4.0,M,,*4E

OK

This corresponds to about 23.17198°N, 113.40420°E. The GGA quality field is 1.

On the same ttyS2, at the default 9600, this EC20 AT returns nothing; after changing to 115200 it works normally. When outport is usbnmea, NMEA is also not emitted continuously from the UART, so still use the AT queries above.

Common Commands​

CommandPurpose
AT / ATE0 / ATIConfirm the AT port
AT+IPR? AT+ICF? AT+IFC?Baud rate / frame format / flow control
AT+QGPS=1Enable GNSS
AT+QGPS?Whether it is already enabled
AT+QGPSCFG="outport"NMEA output port
AT+QGPSCFG="nmeasrc"Must be 1 for QGPSGNMEA
AT+QGPSLOC=2Decimal coordinates
AT+QGPSLOC=0Degrees/minutes/seconds coordinates
AT+QGPSGNMEA="GGA"A single GGA sentence
AT+QNWINFOCurrent 4G band / operator / EARFCN
AT+QENG="servingcell"Serving cell (band, PCI, TAC)
AT+QCSQSignal quality (RSRP / RSRQ / SINR)

Error Codes​

CodeMeaning
504GNSS is already enabled; AT+QGPS=1 was sent again
516No fix (antenna, indoors, just powered on)
501Parameter error (for example, incorrect outport syntax)
AI Translation Notice

This page was translated into English by AI and is provided for reference only. The original document is written in Chinese. If there is any discrepancy, the Chinese version prevails.

本页英文内容由 AI 自动翻译生成,仅供参考;原文为中文,如有差异请以中文原文为准。

查看中文原文 / View the Chinese original →