RTL8720DN Serial communication


I am trying to get UART working across two RTL8720DN boards.

I am using one RTL8720DN as the master and the second RTL8720DN as the slave. Just wondering if the code I have would work.

#include <SoftwareSerial.h>

#define BLUE_LED            PA13   // also known as PA13 in BW16 module (see variant.h)

SoftwareSerial Serial2(PA30, PA26); // RX, TX

void setup() {
  // put your setup code here, to run once:
  Serial2.begin(115200);            // initialize UART with the second board with baud rate of 9600


void loop() {
  // put your main code here, to run repeatedly:

You can see that I have chosen two random pins and allocated them as serial pins. Is this okay or should I use the specified Serial RX (PB2) and Serial TX (PB1) for serial communication between the two boards?


Hi you should try sticking to the hardware UART pins, otherwise this might not work at all


I appreciate the quick response. I have currently routed PB1 to PA7 and PB2 to PA8 in order to flash code from the Arduino IDE. Can I still use PB1 and PB2 for serial communication to another board?

Hi, for BW16 dev board, there are 2 sets of UART you can use,


  • PA_7
  • PA_8


  • PB_1
  • PB_2

These 2 can be used independently. However, if you have routed UART1 to LOG UART, then you need a seperate USB-to-Serial module (eg FTDI, CH340, CP2102) to connect to LOG UART for printing out serial msg, then you can use the other set for serial communication