9 years, 10 months ago.

the serial port seems doesn't send data

I tried the "Nucleo_printf" example, and I use another board with a serial port to receive the data, but it seems no data transmit from TX port, what's the problem?

When I change USART2 to USART1 like below, the USART1 port works normally Serial pc(SERIAL_TX, SERIAL_RX); Serial pc(PA_9, PA_10);

posted by Qiang Guo 26 Jul 2014

1 Answer

9 years, 8 months ago.

First make sure you update the mbed library to the latest revision (in the compiler click on the mbed library, go to the far right summary tab, click 'update')

than try this code

#include "mbed.h"

DigitalOut myled(LED1);
 
int main() {
  int i = 1;
  printf("Hello World !\n");
  while(1) { 
      wait(1);
      printf("This program runs since %d seconds.\n\r", i++);
      myled = !myled;
  }
}

Updating the library as described fixed my issue. Note that adding Serial pc(SERIAL_TX, SERIAL_RX); and using pc.printf still works

posted by Julien D 25 Feb 2015