7 years, 8 months ago.

UART function can not success

Hi All,

I can use serial API to set tx rx (PC_6, PC_7) by NUCLEO-F746ZG , and it is work. But when I change other pin(PB_10,PB_11), it is not work. Have anyone can teach me why?

UART test

#include "mbed.h"
Serial pc(PB_10 , PB_11   ); // tx, rx

int main() {
  pc.baud(115200);
       while(1)
        {
                pc.putc(pc.getc()); 
        }
   
}

stm32

posted by Terry Lung 12 Apr 2017

UART

posted by Terry Lung 12 Apr 2017

What is your problem? Error message? MCU hangs? Can not receive or can not transmit data?

posted by Mark Peter Vargha 14 Apr 2017

I can not receive, but can send "Hello Word".

posted by Terry Lung 14 Apr 2017

Please, be accurate. Send "Hello World" from Nucleo to computer. You receive the message in the terminal application on your computer. (Which terminal application?) You send the "Hello World" from terminal application, and? Nucleo hangs? Or? Which USB-TTL adapter do you use? Connections are OK? Have you make the loopback test?

posted by Mark Peter Vargha 14 Apr 2017

Dear Mark,

This is my environment::

software: tera term, ST-LINK Utility, mbed(online compiler).

hardware: NUCLEO-F746ZG, ftdi232.

I am indeed get "Hello World" from NUCLEO and echo every word by using PC_6 and PC_7. But when I change to PB_10 PB_11, it just only have a "Hello World" form NUCLEO. I can not echo word anymore.

UART_test2

#include "mbed.h"
Serial pc(PB_10 , PB_11   ); // tx, rx
 
int main() {
  pc.baud(115200);
  pc.printf("Hello World");     
while(1)
        {
                pc.putc(pc.getc()); 
        }
posted by Terry Lung 17 Apr 2017
Be the first to answer this question.