# RTL8720DN Serial communication

**URL:** <https://forum.amebaiot.com/t/rtl8720dn-serial-communication/1265>\
**Category:** Peripherals\
**Tags:** evb-bw16\
**Created:** [May 23, 2022, 2:52am UTC](https://forum.amebaiot.com/t/rtl8720dn-serial-communication/1265 "2022-05-23T02:52:05Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Shaner3](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.amebaiot.com/shaner3/32/1064_2.png) [@Shaner3](https://forum.amebaiot.com/u/Shaner3)\
**Post date:** [May 23, 2022, 2:52am UTC](https://forum.amebaiot.com/t/rtl8720dn-serial-communication/1265/1 "2022-05-23T02:52:05Z")

</div>

Hi

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.

```auto
#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:
  Serial2.println(3);
  delay(5000);
}

```

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?

Thanks.

---

<div class="post-metadata">

**Author:** ![xidameng](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.amebaiot.com/xidameng/32/18_2.png) [@xidameng](https://forum.amebaiot.com/u/xidameng)\
**Post date:** [May 23, 2022, 7:53am UTC](https://forum.amebaiot.com/t/rtl8720dn-serial-communication/1265/2 "2022-05-23T07:53:32Z")

</div>

> [@Shaner3](#):
>
> 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

---

<div class="post-metadata">

**Author:** ![Shaner3](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.amebaiot.com/shaner3/32/1064_2.png) [@Shaner3](https://forum.amebaiot.com/u/Shaner3)\
**Post date:** [May 23, 2022, 8:53pm UTC](https://forum.amebaiot.com/t/rtl8720dn-serial-communication/1265/3 "2022-05-23T20:53:37Z")

</div>

Hi

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?

---

<div class="post-metadata">

**Author:** ![xidameng](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.amebaiot.com/xidameng/32/18_2.png) [@xidameng](https://forum.amebaiot.com/u/xidameng)\
**Post date:** [May 24, 2022, 1:57am UTC](https://forum.amebaiot.com/t/rtl8720dn-serial-communication/1265/4 "2022-05-24T01:57:03Z")

</div>

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

LOG UART:

- PA\_7
- PA\_8

UART1

- 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
