# Using Swan Serial2/3

**URL:** <https://discuss.blues.com/t/using-swan-serial2-3/3141>\
**Category:** Hardware\
**Created:** [July 1, 2025, 2:32pm UTC](https://discuss.blues.com/t/using-swan-serial2-3/3141 "2025-07-01T14:32:12Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![soupdragon](https://avatars.discourse-cdn.com/v4/letter/s/977dab/32.png) [@soupdragon](https://discuss.blues.com/u/soupdragon)\
**Post date:** [July 1, 2025, 2:32pm UTC](https://discuss.blues.com/t/using-swan-serial2-3/3141/1 "2025-07-01T14:32:12Z")

</div>

New to Blues and new to this Forum. But reasonably experienced with Arduino and serial ports. I’m struggling to get spare UARTs (2 and 3) working on my Swan v3.0, which is plugged into Notecarrier F. All brand new.

I’ve found stuff like this:  
HardwareSerial Serial2(PD\_6, PA\_2);  
Serial2.begin() etc

But no luck. Searching this forum on this topic I also found this …

HardwareSerial Serial2(A5, A4);

or this …

HardwareSerial Serial2(PB6, PA2\_ALT);

All compiled OK, but nothing actually worked for me (nothing out of Tx).

Can anyone help ?

Also, can anyone tell me where all these pins are defined ? I get PD6, PA2 (these are defined in the Swan data sheet), but PD\_6, PA\_2, A5, A4 ? I’m definitely missing something. What is the significance of the underscores ? And my Swan data sheet defines A4 and A5 as analog.

---

<div class="post-metadata">

**Author:** ![abucknall](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.blues.com/abucknall/32/1335_2.png) [@abucknall](https://discuss.blues.com/u/abucknall)\
**Post date:** [July 1, 2025, 3:50pm UTC](https://discuss.blues.com/t/using-swan-serial2-3/3141/2 "2025-07-01T15:50:33Z")

</div>

Hi @soupdragon welcome!

```cpp
HardwareSerial Serial2(PD6, PA2); // RX, TX

```

Will work fine, but the issue you will have with the Notecarrier F is that PD6 and PA2 are only exposed on the [castellated edges](https://dev.blues.io/datasheets/swan-datasheet/swan-v3-0/#swan-embedded) of the Swan, which are not connected to the Notecarrier F unfortunately. Some other options you can try are:

```cpp
HardwareSerial SerialUsart1(PA10, PA9) // RX/TX
HardwareSerial SerialUsart2(PD6, PA2) // RX2/TX2 castellations
HardwareSerial SerialUsart3(PB11, PB10) // RX3/TX3 castellations

```

Were you hoping to access this additional UART via the Notecarrier F?

Thanks,  
Alex

---

<div class="post-metadata">

**Author:** ![soupdragon](https://avatars.discourse-cdn.com/v4/letter/s/977dab/32.png) [@soupdragon](https://discuss.blues.com/u/soupdragon)\
**Post date:** [July 2, 2025, 8:49am UTC](https://discuss.blues.com/t/using-swan-serial2-3/3141/3 "2025-07-02T08:49:56Z")

</div>

Thanks Alex, that is reassurring. I was on the right lines. However still no success. Full code below (minimal, based on Quickstart tutorial).

LED flash works and Serial.print ‘.’ works, but only for 63 cycles. Then the whole thing stops. Nothing ever from UART2. Maybe a flow control problem - so I tried tying RTS/CTS together, still no luck. (although I haven’t declared RTS/CTS pins anywhere, wasn’t sure how)

63 ‘.’ characters from the trusted Serial port is suspicious, suggesting we’ve hit a buffer limit and crashed when writing 64 or more characters to Serial2.

Longer term, if we ever did get one of these spare serial ports working, my hope would be to disable RTS/CTS flow control.

Many thanks in advance for any help you can offer,

John

#include \<Arduino.h\>

//HardwareSerial Serial2(PD6, PA2);  
HardwareSerial SerialUsart2(PD6, PA2);

void setup() {  
// put your setup code here, to run once:

// initialize digital pin LED\_BUILTIN as an output.  
pinMode(LED\_BUILTIN, OUTPUT);

delay(2500);  
Serial.begin(115200);

// Swan serial2 experiments  
SerialUsart2.begin(9600);  
}

void loop() {  
// put your main code here, to run repeatedly:  
digitalWrite(LED\_BUILTIN, HIGH); // turn the LED on (HIGH is the voltage level)  
delay(1000); // wait for a second  
digitalWrite(LED\_BUILTIN, LOW); // turn the LED off by making the voltage LOW  
delay(1000); // wait for a second

// Send something out of UART 2 (castellated pin PA2)  
Serial.print(‘.’);  
SerialUsart2.print(‘,’);  
}

---

<div class="post-metadata">

**Author:** ![abucknall](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.blues.com/abucknall/32/1335_2.png) [@abucknall](https://discuss.blues.com/u/abucknall)\
**Post date:** [July 3, 2025, 10:01am UTC](https://discuss.blues.com/t/using-swan-serial2-3/3141/4 "2025-07-03T10:01:52Z")

</div>

@soupdragon I believe you are right. The 63 cycles indicate a full buffer issue; It sounds like you are unable to read from SerialUsart2’s TX pin, where the expected character is ‘,’? I would guess that the TX buffer is filled at the point the code freezes.

I currently don’t have a way to attach a serial probe to the castellated edges of my Swan. I’ll check with a colleague and see if they can break out the castellated edges. I’ll see if I can check that this works for you.

---

<div class="post-metadata">

**Author:** ![yordanyre](https://avatars.discourse-cdn.com/v4/letter/y/898d66/32.png) [@yordanyre](https://discuss.blues.com/u/yordanyre)\
**Post date:** [March 27, 2026, 7:37pm UTC](https://discuss.blues.com/t/using-swan-serial2-3/3141/5 "2026-03-27T19:37:55Z")

</div>

When using **UART2** on the Swan R5, the correct declaration is:

> HardwareSerial SerialUart2(PD6, PA2\_ALT1);

The reason **PA2\_ALT1** is required instead of plain **PA2** is that in _ **PeripheralPins\_SWAN\_R5.c** _, **PA2** is mapped to _LPUART1_ as its primary function, with _ **USART2** _ listed as the alternate **(PA2\_ALT1)**. If you use **PA2** directly, the STM32 core picks _LPUART1_ for TX while **PD6** resolves to _ **USART2** _ for RX — two different peripherals, so the port never initializes correctly. Using **PA2\_ALT1** forces the core to assign both pins to **USART2**.
