RAK4630 Serial over UART

Now that code can be uploaded to my RAK4630 I wanted to communicate over Serial UART1.
Here is my current configuration :

  • Firmware RUI3 and Arduino IDE.
  • Firmware version : RUI_4.0.5_RAK4631
  • On Windows 10

The aim is to communicate over Serial UART. I’m using an Arduino UNO to simulate the chip I want to comunicate with in the future.
But it seems to not even work with Arduino UNO.
Note that the Arduino UNO’s running only ledBlinking with no Serial. So it’s used as a Serial USB dongle.

Some strange things :

  • the normal Serial get the inputString well and prints well on this Serial (USB)
  • Serial1 never prints to UART (I have port COM open on PC to get infos from Arduino UNO)
  • During one try, the COM port from Arduino UNO worked in AT mode

I’ve followed some examples from librairies but never worked.
Here’s below the simple code I made to test the communication over Serial1.

Anyone has some idea to this “issue”?

* Simple led blinking and 2 Serial links
* Serial link to PC at 115200
* Serial link to UNO at 9600 
* UNO running only led blinking NO serial
* Board : ESP32 Dev Module  
* Author : A. Patrouix ETM
* Date : 04/07/2023
#include <HardwareSerial.h>

#define BaudRatePC 115200
#define BaudRateKIM 9600

// constants won't change. Used here to 
// set pin numbers:
const int ledPin =  P1_02;      // the number of the LED pin
// Variables will change:
int ledState = HIGH;             // ledState used to set the LED
long previousMillis = 0;        // will store last time LED was updated
// the folHIGH variables is a long because the time, measured in miliseconds,
// will quickly become a bigger number than can be stored in an int.
long intervalMillis = 500;            // interval at which to blink (millisseconds)
int i = 0;

// Serial link data to PC
bool SerialFlag = false;
String inputString = "";        // a string to hold incoming data
boolean stringComplete = false; // whether the string is complete

// Serial link data to UNO or KIM
// Hardware UART1 
//HardwareSerial Serial1;
bool Serial1Flag = false;
const byte rxPin = P0_19;
const byte txPin = P0_20;

void setup() {
  // set the digital pin as output:
  pinMode(ledPin, OUTPUT); 
  // initialize serial:
  // Wait for USB Serial to be ready or terminal to be connected
  SerialFlag = WaitingSerial(Serial,5000);
  // BOOT Message
  if (SerialFlag)
    Serial.println("\nBOOT Serial PC ready to work");
  // initialize serial1:
  Serial1.begin(BaudRateKIM, SERIAL_8N1, RAK_DEFAULT_MODE);
  // Wait for USB Serial to be ready or terminal to be connected
  Serial1Flag = WaitingSerial(Serial1,5000);
  // BOOT Message
  if (Serial1Flag)
    Serial.println("Serial UART1 to UNO ready to work");
  // reserve 200 bytes for the inputString

// Blink Led on ledPin
// 50% duty cycle
// intervalMillis is 1/2 period
void BlinkLed(long intervalMillis){
  // check to see if it's time to blink the LED; that is, if the 
  // difference between the current time and last time you blinked 
  // the LED is bigger than the interval at which you want to 
  // blink the LED.
  unsigned long currentMillis = millis();
  if(currentMillis - previousMillis > intervalMillis) {
    // save the last time you blinked the LED 
    previousMillis = currentMillis;   
    // if the LED is off turn it on and vice-versa:
    if (ledState == HIGH)
      ledState = LOW;
      ledState = HIGH;
    // set the LED with the ledState of the variable:
    digitalWrite(ledPin, ledState);
void loop()
  // Blink Led still alive
  // here is where you'd put code that needs to be running all the time.

  // check is some data are in on Serial from PC

  // print the string when a newline arrives:
  if (stringComplete) {
    // Push string to UNO 
     // clear the string:
    inputString = "";
    stringComplete = false;

// SerialRead is called in loop(), so using delay inside loop can delay
// response.  Multiple bytes of data may be available.
void serialRead() {
    char inChar;
    while (Serial.available()) {
      // get the new byte:
      inChar = (char)Serial.read(); 
      // add it to the inputString:
      inputString += inChar;
      // if the incoming character is a newline, set a flag
      // so the main loop can do something about it:
      if (inChar == '\n') {
         stringComplete = true;

// Wait for Serial to be ready or terminal to be connected
// Return True if Serial OK else False if TimeOut
bool WaitingSerial(HardwareSerial serial, time_t timeOut){
  bool timeOutFlag = false;
  time_t timeout = millis(); // Timeout in case the system runs on its own
  // Waiting for Serial
  while ((!serial) && (!timeOutFlag))
    // UPdate TimeOut flag
    if((millis() - timeout) > timeOut)
      timeOutFlag = true;
    // Blink the LED to show that we are alive
    digitalWrite(ledPin, !digitalRead(ledPin));
  return !timeOutFlag;

I am also facing similar plb… Serial 1 of RAK4630 is not working … Check your baseboard to see whether it is Version B or Version D?


Are you using WisBlock BaseBoard or a RAK4630 on a custom PCB?

UARTS of the RAK4631/RAK4630 are 3.3V level, don’t connect them directly to an Arduino UNO with 5V UART levels, you might kill your RAK4630 or it’s UART.

The RAK4630 is on a custom industrial PCB.

I tried using a level converter sharing the same ground.

Did you have the level converter when you connected it the first time to the UNO?

If not, you most likely killed the UART or the whole RAK4630.

Otherwise, can you share your schematics?