2 years, 7 months ago.

Nucleo - STM32F410RB not reading from serial port

I have a 3DR radio telemetry setup with which I am trying to establish two way communications between a laptop and the Nucleo board. The board functions fine while transmitting data but it is just not reading from the radio. The radio receives the data, and also on the laptop side, the radio is successfully transmitting data.

STM32F410RB code

#include "mbed.h"

#define TX_PIN PB_6
#define RX_PIN PA_10

Serial pc(USBTX, USBRX);
Serial pc2(TX_PIN, RX_PIN);
DigitalOut myled(LED1);
char recvdChar = 'a';

void recvdData(){
        recvdChar = pc2.getc();

int main()
    myled = 1;
    myled = !myled;
    pc2.attach(&recvdData, Serial::RxIrq);
    while(1) {
       pc.printf("%c\n", recvdChar);

Laptop code

  import serial
  import time
   board = serial.Serial(port = '/dev/tty.usbserial-DN02136Z', baudrate = 57600    , timeout = 3)

You probably should declare the variable recvdChar as 'volatile' since it is updated in an interrupt. The compiler does not understand that and might optimise out re-checking the new value before printing it in your main loop.

posted by Wim Huiskamp 05 Dec 2017
Be the first to answer this question.

Assigned to Graham S. 2 years, 7 months ago.

This means that the question has been accepted and is being worked on.