Arm Mbed and Pelion Device Management support forum

NUCLEO Software Serial problem

Hello there,
I need to create a serial communication for the Nucleo F303RE board using the A1 and A0 pins. So far I’ve tried several libraries for software serial communication but with no luck.

So far this code which is supposed to echo returns only 224.

#include "mbed.h"
#include "SoftSerial.h"

SoftSerial SerialAD(A1, A0);

uint8_t num;

int main(){
        while(SerialAD.readable() == 1){
            num = SerialAD.getc();


And when I try to send some info with putc() it sends the data multiplied by two except for the 10:

I can’t wrap my head around what exactly am I missing and would be more than grateful for some help.

probably depends on the board and its speed on GPIO pins or something like that.
I tested your code on two boards:

  • Nucleo-F446RE = no problem, it runs OK
  • Nucleo-F303K8 = similar problem like you have

BR, Jan

Well I’m driving a CO2 sensor which requires 9600 baud rate and I can’t switch its connected pins. I’m out of ideas on what to do ¯_(ツ)_/¯

Why you can not switch to another pins?

Because the sensor is mounted on a shield that connects it to those two pins specifically

Maybe remove the these two pins from the header of the shield and replace them with wires and connect it to PA_14 and PA15.

BR, Jan