8 years, 7 months ago.

Issue with the Serial class on the Nucleo-F446RE

Hello,

I am having an issue using the Serial class on a Nucleo-F446RE. The simple example code below prints both the stdio and pc messages when NOT using the mbed-rtos lib. However, when I add the mbed-rtos lib and uncomment <#include "rtos.h">, only the stdio message prints. Is there something I am doing wrong?

Tom

#include "mbed.h"
//#include "rtos.h"

DigitalOut led(LED1);
Serial pc(USBTX, USBRX);

int main()
{
    printf("Hello from stdio\n");
    pc.printf("Hello from pc\n");

    while(1) {
        led = 1;
        wait(0.2);
        led = 0;
        wait(0.2);
    }
}

1 Answer

8 years, 7 months ago.

Hi,

I suggest you to have a look to the Nucleo_rtos_basic (https://developer.mbed.org/teams/ST/code/Nucleo_rtos_basic/) and the Nucleo_printf (https://developer.mbed.org/teams/ST/code/Nucleo_printf/) examples, it may be very helpful.

-Syrine-

Well those don't really answer his question. RTOS has some limitations regarding Serial, but I am not aware of this one. @Tom, if you remove the stdio printf, does the pc one get printed?

posted by Erik - 11 Apr 2016

Eric,

When I remove the stdio printf, nothing is printed to the screen if the mbed-rtos lib is included with the project. I also tried this code on a Nucleo- F303K8 with the same results. However, the code work correctly (with and without the mbed-rtos lib) with a Nucleo-F746ZG.

Tom

posted by Tom Doyle 11 Apr 2016