I am using the RAK4630 module integrated on a RAK5005 baseboard, which is being powered serially through a USB cable. And I am connecting the RAK2011 cellular shield (based on Quectel BG96) to RAK4630 via UART using J10 (RX,TX) pins on RAK5005 baseboard.
Following is the pin configuration between the baseboard and cellular shield pins:
What Baud rate are you using?
Did you try to switch RX and TX?
How do you send the command and how do you wait for response?
How do you initialize the Serial1 on the RAK4631?
Yes, I tried switching RX and TX. It was still the same behavior.
I am using the following “unvarnished transmission” example for BG77 :
/**
@file BG77_Unvarnished_Transmission.ino
@author rakwireless.com
@brief BG77 unvarnished transmission via USB
@version 0.1
@date 2020-12-28
@copyright Copyright (c) 2020
**/
#include <Adafruit_TinyUSB.h>
#define BG77_POWER_KEY WB_IO1
void setup()
{
time_t serial_timeout = millis();
Serial.begin(115200);
while (!Serial)
{
if ((millis() - serial_timeout) < 5000)
{
delay(100);
}
else
{
break;
}
}
Serial.println("BG77 AT CMD TEST!");
// Check if the modem is already awake
time_t timeout = millis();
bool moduleSleeps = true;
Serial1.begin(115200);
delay(1000);
Serial1.println("ATI");
//BG77 init
while ((millis() - timeout) < 6000)
{
if (Serial1.available())
{
String result = Serial1.readString();
Serial.println("Modem response after start:");
Serial.println(result);
moduleSleeps = false;
}
}
if (moduleSleeps)
{
// Module slept, wake it up
pinMode(BG77_POWER_KEY, OUTPUT);
digitalWrite(BG77_POWER_KEY, 0);
delay(1000);
digitalWrite(BG77_POWER_KEY, 1);
delay(2000);
digitalWrite(BG77_POWER_KEY, 0);
delay(1000);
}
Serial.println("BG77 power up!");
}
void loop()
{
int timeout = 100;
String resp = "";
String snd = "";
char cArr[128] = {0};
while (timeout--)
{
if (Serial1.available() > 0)
{
resp += char(Serial1.read());
}
if (Serial.available() > 0)
{
snd += char(Serial.read());
}
delay(1);
}
if (resp.length() > 0)
{
Serial.print(resp);
}
if (snd.length() > 0)
{
memset(cArr, 0, 128);
snd.toCharArray(cArr, snd.length() + 1);
Serial1.write(cArr);
delay(10);
}
resp = "";
snd = "";
}
I checked by adding a if/else statement to see when Serial1.available() is true. It only returns true when I repeatedly send 3-4 commands/strings to the serial and response to those commands are some unknown characters.
For initializing Serial1 on the RAK4631, I’m not sure about this part. I am assuming that RX and TX pins on the baseboard are sufficient for the communication.
I do not have the RAK2011 (old board, no longer produced). But from the schematics, it seems you have to connect the IOREF pin to 3.3V of the RAK5005-O board.
RAK2011 was designed for 5V Arduino boards.
Because Arduino boards have usually 5V, there is a voltage converter on the RAK2011 that needs IOREF to be connected to the power supply of the RAK5005-O.