I tried to use RAK’s UART to communicate with the A7600C1 4G module. I can use USB-TTL module to communicate with my PC with both RAK and 4G module. But when I connect the RAK with 4G, it doesn’t work.
I use RAK4631 with RAK5005-o. And I use the J10 Pin’s Tx and Rx.
I found that the Tx’s voltage after I activated it is still 0V. What will Tx pin’s voltage be during not activate and working?
#include <Arduino.h>
#include <Adafruit_TinyUSB.h>
bool handshakeDone = false;
void setup() {
delay(3000); // 等待 4G 模块稳定上电
Serial1.begin(115200);
// 上电后自动发送 AT 握手命令
Serial1.print(“AT\r\n”);
Serial.println(“已发送: AT”);
}
void loop() {
// 握手:超时轮询收集 4G 模块回复,判断是否收到 OK
if (!handshakeDone) {
String response = “”;
unsigned long start = millis();
while (millis() - start < 2000) { // 最多等 2 秒
while (Serial1.available()) {
char c = Serial1.read();
response += c;
start = millis(); // 收到数据就重置超时
}
}
Serial.print("4G模块回复: ");
Serial.println(response);
if (response.indexOf("OK") >= 0) {
Serial.println("握手成功!4G模块已就绪。");
handshakeDone = true;
} else {
Serial.println("握手失败!请检查接线和波特率。");
// 调试阶段不做重试,直接进入透传便于排查
handshakeDone = true;
}
}
// USB → 4G 模块(透传)
while (Serial.available()) {
Serial1.write(Serial.read());
}
// 4G 模块 → USB(透传)
while (Serial1.available()) {
Serial.write(Serial1.read());
}
}
here is the code.
Which A7600C1 4G module exactly are you using?
What is the specified voltage on the serial lines of this A7600C1 module? The UART lines on the WisBlock Base Board are only compatible with 3.3V voltage levels.
Did you cross the RX and TX lines between the A7600C1 module and the WisBlock Base Board?
| WisBlock | A7600C1 |
|---|---|
| TX | RX |
| RX | TX |