9 years, 8 months ago.  This question has been closed. Reason: Duplicate question

NUCLEO-F401RE not sending anything on PC serial port

Hi all,

I just tried to use for the first time my NUCLEO-F401R4 board; I have two of these boards and I upgraded the ST-Link firmware to V2.J22.M5 as requested and I also upgraded the ST-Link driver on my PC (Windows 7 Pro, 64-bit).

I have developed the following simple program to measure the duration of the time period for wich the user presses the USER_BUTTON and to print it on the debug serial port:

#include "mbed.h"

Serial debug(SERIAL_TX, SERIAL_RX);   // sends log messages via USB to PC terminal
InterruptIn button(USER_BUTTON);
DigitalOut led(LED1);
Timer tmr;
int count;

void button_pressed() {
    tmr.reset();
    tmr.start();
    led = 1;
}
    
void button_released() {
    tmr.stop();
    led = 0;
    count = tmr.read_us();
    debug.printf("Pulse duration: %.3f ms\n", count/1000);
}

int main() 
{
    debug.baud(9600);
    debug.printf("Hello, World!\n");
    button.rise(&button_released);
    button.fall(&button_pressed);
    button.enable_irq();
    while(1);
}

I can compile and upload my program whitout errors but nothing is sent on the serial port; I use Tera Term to receive data from the Nucleo board that is correctly enumerated (I can see the virtual COM port on my Device Manager).

I don't receive any character from my Nucleo board, even the initial "Hello, World!" is not displayed on the Tera Term window; I also tried with Putty but nothing happens.

However I can see that the program works correctly because when I press the USER_BUTTON, the LED is ON and it goes OFF only when I release the button.

The behaviour is the same for both boards.

Please can anyone help me to solve this problem?

I just solved the problem! It seems it was caused by some problem with the ST-LINK driver; I uninstalled and reinstalled it and now I get messages sent to the Virtual COM Port on my Tera Term window.

posted by Francesco Adamo 14 Aug 2014