7 years, 5 months ago.

how to set serial baud rate on NUCLEO-F091RC from default 9600 to something else?

I'm using Hello World example on: https://developer.mbed.org/components/X-NUCLEO-IKS01A1/

The default serial rate is 9600. I've searched source code and cannot find where this is set. Code uses printf() and I believe it defaults to stdio.

2 Answers

7 years, 5 months ago.

Instead of using the default stdio, you should explicitly use the PC USB serial port. That allows you to modify the baudrate.

#include "mbed.h"              
 
Serial pc(USBTX, USBRX); // tx, rx
 
int main() {
    pc.baud(9600);

    pc.printf("Hello World!\n");
}

Accepted Answer
7 years, 5 months ago.

you can use baud.. but write it after main()

ex : Serial pc(USBTX, USBRX);

int main() { pc.baud(57600); ... }