Serial Print problem

Hi , I’m using NUCLEO F429Zi for testing purposes .
I want to take serial output from teraterm and perform tests.

I’m using this code

#include <iostream>
#include "LIB_TEST.h"

using namespace std;

int main()
    double a = 7.4;
    int b = 99;
    std::cout << "a + b = " <<
        LIB_TEST::Arithmetic::Add(a, b) << std::endl;
    std::cout << "a - b = " <<
        LIB_TEST::Arithmetic::Subtract(a, b) << std::endl;
    std::cout << "a * b = " <<
        LIB_TEST::Arithmetic::Multiply(a, b) << std::endl;
    std::cout << "a / b = " <<
        LIB_TEST::Arithmetic::Divide(a, b) << std::endl;
    return 0;

mbed_app.json file is this;

        "target_overrides": {
        "*": {
            "platform.stdio-baud-rate": 115200,
            "target.c_lib": "std",
            "target.printf_lib": "std"

And I’m getting nothing from the teraterm.

The port configuration on the teraterm side is configured correctly.

NUCLEO’S driver installed as mbed nucleo documentation.

What I’m doing wrong can u guys help ?


Hello again,

I remember STD::cout Can't see variables
What happened? The settings and code seems to be same as in the previos topic.

Do you have correct baud rate in Teraterm?

BR, Jan

Yes you are right.

I’m using both Mbed Studio and Keil Studio online.
Same program and OS version.
Mbed Studio works fine with both built in terminal and teraterm but no good on Keil Studio.

Mbed Studio works a lot better than Keil Studio online, many ‘weird’ things with that at the moment, perhaps it will improve.

May be a pita for you, download and try Mbed Studio you get a build profile box where you can select ‘debug profile’ and get message from within your libraries.
(No OS2 unfortunately).


Also the build output that I can’t seem to find on Keil Studio.


Ok, so again.
What exactly not working?

  • Keil Studio Cloud
  • MbedOS 6.16
  • Nucleo-F429ZI
  • Serial terminal apps - Termite, YAT, Puty - all same result
  • mbed_app.json from above
  • the code and output below (I do not know what is inside of LIB_TEST.h)
#include "mbed.h"
#include <iostream>

#define BLINKING_RATE     500ms
DigitalOut led(LED1);

int main()
    std::cout << "Hello\n";
    double a = 7.4;
    int b = 1;
    while (true) {
        led = !led;
        b = rand() % 20;
        std::cout << "a + b = " <<a + b << std::endl;
        std::cout << "a * b = " << a * b << std::endl;
        std::cout << "a / b = " << a / b << std::endl;
a + b = 20.4
a * b = 96.2
a / b = 0.569231
a + b = 15.4
a * b = 59.2
a / b = 0.925
a + b = 26.4
a * b = 140.6
a / b = 0.389474
a + b = 8.4
a * b = 7.4
a / b = 7.4

BR, Jan

Hi Jan,
STD::cout Can’t see variables
Everything was fine after that , There was a situation where I had to uninstall and reinstall the operating system.
But I didn’t change anything.

I just felt that there is something strange on the screen where I selected the serial port of the teraterm.

This is what it looks like when I connect it;

This is how it shows the port when the NUCLEO is not connected;

Seems like this is causing a problem with the port is it seeing something else when the port is idle?

We don’t need to take a library review, I observe the same thing in the code in the screenshot I took.

That was not what I mean. It was just about why I can not use 1:1 of your code.

After successful connection, when I try New connection again, the ST-Link COM port is not in the list until disconnecting the first session.
After connection and correcting of the baud rate, then the output looks like below (first line is before the baud rate change)

á§ë¦( ďG„×( á¦( ďG„×a + b = 8.4  !      ‡@((    L   (
a * b = 7.4
a / b = 7.4
a + b = 15.4

Do you have installed also another program for VCP? I mean something else than just - STSW-LINK009

BR, Jan

Hello Jan,

I tried another computer it was working clearly.

I installed drivers for plc on my computer after that I think it was a problem with the port. I’m thinking about how can avoid these problem without a remove the operating system.


maybe try change COM port of ST-Link to another number in Device manager or check if ST-link’s drivers are same on both machines.

BR, Jan

Thanks Jan.
I uninstall the other driver. The port is confused.
No problem that’s work fine.