Chapter 03

Serial Communications & Level Shifting

Mastering the multi-UART architecture, preventing 5V over-voltage damage, tuning baud rates for SoftwareSerial, and resolving the infamous onboard SP3232 bus conflict.

BLUF: Why Does the A7 Ignore Arduino AT Commands?

If your Arduino receives boot text from U_TXD but the A7 ignores all commands sent on U_RXD, you have hit the SP3232 bus collision trap. The board's onboard RS-232 level shifter IC (SP3232, U5) has its output pin (Pin 12, ROUT1) hard-wired directly to U_RXD. When no RS-232 cable is plugged in, the SP3232 actively drives U_RXD HIGH to ~4.0V, overpowering the Arduino’s resistor divider.

The 10-Second Fix: Snip or de-solder Pin 12 (ROUT1) of the SP3232 chip, or use a low-impedance active buffer.

1. Four Distinct Serial Ports on One Board

The AI-Thinker A7 breakout exposes four separate serial interfaces, each dedicated to a distinct task:

Interface Header Pins Baud Rate Voltage Level Primary Purpose
Main AT Port U_TXD (P1.5) / U_RXD (P1.4) 115,200 baud (Configurable) 2.8V / 3.3V TTL Command & Control: AT commands, SMS, voice, GPRS sockets.
GPS Stream Port GPS_TXD (P1.11) 9,600 baud (Fixed) 2.8V / 3.3V TTL Dedicated, continuous NMEA 0183 output (Transmit only).
RS-232 Port 232_TXD (P1.9) / 232_RXD (P1.10) 115,200 baud ±6V to ±10V True RS-232 Direct connection to PC DB9 serial COM ports.
Host Debug Port HST_TXD (P1.7) / HST_RXD (P1.8) 921,600 baud 2.8V / 3.3V TTL Kernel debug traces & factory ROM flashing. Leave unconnected.

2. Logic Levels & 5V Arduino Interfacing

The internal baseband processor operates at a nominal 2.8V logic level (CMOS 3.3V compatible).

3.3V MCUs (ESP32, STM32, RP2040)

Connect directly! The 2.8V output from U_TXD and GPS_TXD easily exceeds the 2.0V $V_{IH}$ minimum threshold of 3.3V chips. No level shifter or resistors needed. For zero-conflict ESP32 pin selection, see our ESP32 Optimal Connection Guide.

5.0V MCUs (Arduino Uno, Nano, Mega)

The 5V output of an Arduino TX pin will damage the 2.8V silicon pads over time. Step the voltage down using a two-resistor voltage divider.

The Universal 5V Resistor Divider Circuit:

Arduino Uno (5V)                               A7 Module (2.8V/3.3V)
+---------------+                              +---------------+
|               |                              |               |
|       TX Pin  +--------[ 1.0 kΩ ]----+------->  U_RXD (Pin 4)|
|               |                      |       |               |
|               |                     [ ]      |               |
|               |                    2.0 kΩ    |               |
|               |                      |       |               |
|       GND     +----------------------+------->  GND   (Pin 3)|
|               |                              |               |
|       RX Pin  <------------------------------+  U_TXD (Pin 5)|
|               |       (Direct Wire)          |               |
+---------------+                              +---------------+

Formula: $V_{out} = 5.0\text{V} \times \frac{2000\,\Omega}{1000\,\Omega + 2000\,\Omega} = 3.33\text{V}$. The return wire from U_TXD to Arduino RX is direct, as 2.8V comfortably triggers the ATmega328P digital HIGH threshold.

3. The Dreaded Onboard SP3232 Bus Collision

The Schematic Flaw: On the A7 development board, the onboard SP3232 RS-232 level converter IC (U5) has its TTL output (Pin 12, ROUT1) wired directly in parallel with U_RXD (Header P1 Pin 4).

When no RS-232 cable is connected, the SP3232's input floats. Its internal 5kΩ pull-down pulls it to ground, which the chip interprets as an RS-232 "Mark" (idle). Consequently, Pin 12 actively outputs a solid HIGH (~4.0V) with strong push-pull drive.

When your Arduino Uno transmits through a 1kΩ resistor divider, the Arduino cannot sink enough current to pull the line LOW against the SP3232's active push-pull stage. The line stays permanently HIGH, and the A7 receives nothing!

How to Fix the Collision (Choose One):

  • Option 1 (The 10-Second Hardware Snip — Most Reliable): If you do not need the vintage DB9 RS-232 port, use fine cutters or a soldering iron to snip or lift Pin 12 (ROUT1) of U5 (SP3232). This disconnects the RS-232 chip from U_RXD permanently.
  • Option 2 (Use 3.3V Low-Impedance Drive): The ESP32 or active level-shifter ICs (e.g. 74LVC245) have low output impedance and can sink sufficient current to override the SP3232.
  • Option 3 (Use the RS-232 Pins): Connect your microcontroller through an RS-232 shield directly into Header P1 Pins 9 & 10 (RS232_TXD / RS232_RXD).

4. Tuning Baud Rates for Arduino SoftwareSerial

The A7's factory default baud rate on the main AT port is 115,200 baud. While 115200 is fine for hardware UARTs (ESP32, Mega 2560), the standard Arduino SoftwareSerial library drops bytes and corrupts text at 115200 baud on an 8-bit Uno or Nano.

How to Permanently Change the A7 to 9600 Baud:

Connect the A7 to a USB-to-TTL adapter at 115200 baud and send the following commands to permanently store 9600 baud in the RDA8951's internal NVRAM:

// Step 1: Set baud rate to 9600 baud
AT+IPR=9600
OK

// Step 2: Save setting to non-volatile EEPROM (persists across reboots)
AT&W
OK

Now, both the main AT port and the GPS stream port operate cleanly at 9600 baud, making SoftwareSerial completely rock-solid on 16MHz AVR chips.