Expansion Board - 4G EC20

On the CAM126B-P, connect the onboard 24PIN expansion UART to the AT port of a Quectel EC20 / EC25 to query GPS. The board /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 is9600
The GPS commands in this document are based on tests with QuecOpen / fanconn firmware (the module reports EC20F).
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.
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 to | Module node | How to recognize it on the 1126 | Purpose |
|---|---|---|---|
| AT (main UART) | ttyHS0 | Send AT and get OK | Query GPS (this document) |
| Debug | ttyHSL0 | login: | 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.
| Requirement | Which port to use | On the 1126 side |
|---|---|---|
| 4G data | J11 / J12 of the EC20-38 (4PIN Ethernet) | 6PIN Ethernet port / RJ45 |
| GPS, AT queries | J2 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 6PIN | Signal | EC20-38 J11 / J12 |
|---|---|---|
| 1 | TX+ | 1 T_TA_P |
| 2 | TX− | 2 T_TA_N |
| 3 | RX+ | 3 T_TB_P |
| 4 | RX− | 4 T_TB_N |
| 5 / 6 | NC (reserved for POE, not used) | Leave unconnected |
Left: RV1126 6PIN Ethernet port; right:
J11of the EC20-38; bottom: only wires1/2/3/6are used when crimping an RJ45
J11andJ12carry 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
| Item | Measured value | Description |
|---|---|---|
| Subnet | 192.168.100.0/24 | Default LAN subnet of the expansion board |
| Peer address | 192.168.100.80 | Assigned automatically by DHCP |
| Gateway | 192.168.100.1 | The 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 withip linkfirst.
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 24PIN | Signal | Connect to EC20-38 J2 |
|---|---|---|
| 22 | UART0_TX | 3 RXD_3V3 (module receives) |
| 23 | UART0_RX | 2 TXD_3V3 (module transmits) |
| 1 / 2 | GND | 4 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 use | What you can see | Best for |
|---|---|---|
J2 (main UART) | AT returns OK | Sending AT commands for GPS / band queries (recommended) |
J4 (Debug) | Module Linux boot logs, login: | Troubleshooting inside the module |
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/ttyS2with the device corresponding to the 24PINUART0(usually/dev/ttyS0; confirm withls /dev/ttyS*).
Debugging
Onboard Interface
| Item | Value | Description |
|---|---|---|
| Device node | /dev/ttyS2 | Default expansion UART of the CAM126B-P |
| Factory baud rate | 9600 | Same as Interface Debugging |
| Data bits | 8N1 | No flow control |
| Adapter | Onboard TTL | No USB-TTL, no /dev/ttyUSB0 |
| 24PIN | X05C2024TZ | See the pin table below |
| Pin number | Function description |
|---|---|
| 1 | GND |
| 2 | GND |
| 22 | UART0_TX (1126 transmits) |
| 23 | UART0_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
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.
| Command | Purpose | Key response |
|---|---|---|
AT+CPIN? | SIM status | Normal only when +CPIN: READY |
AT+CSQ | Signal strength | +CSQ: 29,99 (0–31; 99 = unknown) |
AT+COPS? | Current operator | +COPS: 0,0,"CHN-CT",7 |
AT+CEREG? | LTE registration status | 0,1 registered, 0,5 roaming |
AT+QNWINFO | RAT / operator / band / EARFCN | See below |
AT+QENG="servingcell" | Serving cell (band, PCI, TAC) | See below |
AT+QCSQ | RSSI / RSRP / RSRQ / SINR | See below |
AT+QCAINFO | Carrier aggregation | Any 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
| Field | Example | Description |
|---|---|---|
| act | "FDD LTE" | FDD LTE / TDD LTE / WCDMA / GSM |
| oper | "46011" | MCC + MNC; 46011 = China Telecom |
| band | "LTE BAND 3" | Current band |
| channel | 1650 | EARFCN |
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:
| Band | Frequency | Duplex | Band | Frequency | Duplex |
|---|---|---|---|---|---|
| B1 | 2100 MHz | FDD | B34 | 2010–2025 MHz | TDD |
| B3 | 1800 MHz | FDD | B38 | 2570–2620 MHz | TDD |
| B5 | 850 MHz | FDD | B39 | 1880–1920 MHz | TDD |
| B8 | 900 MHz | FDD | B40 | 2300–2400 MHz | TDD |
| B41 | 2496–2690 MHz | TDD |
Typical bands in China: China Mobile B3/B8/B34/B38/B39/B40/B41, China Unicom B1/B3/B8, China Telecom B1/B3/B5.
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
| Item | 1126 board (documented default) | When connecting to EC20 AT |
|---|---|---|
| Device | /dev/ttyS2 | Same as left |
| Baud rate | 9600 | Change the local side to 115200 |
| Frame format | 8N1 | Module AT+ICF? → +ICF: 3,3 (8N1) |
| Flow control | None | Module AT+IFC? → +IFC: 0,0 |
| Adapter | Onboard TTL | No 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>
| Field | Description |
|---|---|
| utc | UTC hours, minutes, seconds |
| lat / lon | Decimal degrees |
| hdop | Horizontal dilution of precision |
| alt | Altitude (meters) |
| date | DDMMYY |
| nsat | Number 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
| Command | Purpose |
|---|---|
AT / ATE0 / ATI | Confirm the AT port |
AT+IPR? AT+ICF? AT+IFC? | Baud rate / frame format / flow control |
AT+QGPS=1 | Enable GNSS |
AT+QGPS? | Whether it is already enabled |
AT+QGPSCFG="outport" | NMEA output port |
AT+QGPSCFG="nmeasrc" | Must be 1 for QGPSGNMEA |
AT+QGPSLOC=2 | Decimal coordinates |
AT+QGPSLOC=0 | Degrees/minutes/seconds coordinates |
AT+QGPSGNMEA="GGA" | A single GGA sentence |
AT+QNWINFO | Current 4G band / operator / EARFCN |
AT+QENG="servingcell" | Serving cell (band, PCI, TAC) |
AT+QCSQ | Signal quality (RSRP / RSRQ / SINR) |
Error Codes
| Code | Meaning |
|---|---|
504 | GNSS is already enabled; AT+QGPS=1 was sent again |
516 | No fix (antenna, indoors, just powered on) |
501 | Parameter error (for example, incorrect outport syntax) |
Left: RV1126 6PIN Ethernet port; right: