Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
7 years, 6 months ago.
USART communication between STM32F411 to PC
I am trying to print the measurement of an analog signal on my PC in Tera Term using USART though pins PA_9 and PA_10. When I run the below code I get a bunch of gibberish. I checked the baud rates and they are the same. When displaying the below code through the USB it works fine, only when it is using USART I get gibberish. Any help would be greatly appreciated.
int main() { float meas; serial.baud(9600); serial.format(8, Serial::None, 1); printf("\nAnalogIn example\n"); while(1) { meas = analog_value.read(); // Converts and read the analog input value (value from 0.0 to 1.0) meas = meas * 3300; // Change the value to be in the 0 to 3300 range printf("measure = %.0f mV\r\n", meas); serial.printf("measure = %.0f mV\r\n", meas); wait(1); } }
1 Answer
7 years, 5 months ago.
Hi Robert,
If you are using Mbed OS 5 I would try the following example to print to the serial terminal: https://os.mbed.com/docs/latest/reference/serial.html#serial-hello-world
I might try commenting out the serial.format(8, Serial::None, 1);
line to see if that helps.
- Jenny, team Mbed