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.
9 years, 11 months ago.
stm32F746 serial connection 115200baud problem
Hello,
I am trying to connect my stm32F746 board to a serial device at 115200 baud and it doesen't work. The same connection with 9600 works fine. So I tryed to locate the problem with a simple terminal-connection in this way:
Serial uart(PF_7, PF_6); // Tx, Rx
Serial pc(USBTX, USBRX);
.....
pc.baud(115200);
pc.format(8, SerialBase::None, 1);
pc.printf("\n\n\r...start \n\r");
uart.baud(115200);
uart.format(8, SerialBase::Odd, 2); //
....
read = 0;
while(1) {
if((pc.readable()) && (read == 0)){
// zeichen von Ubuntu
c = pc.getc();
if (c == 0x0d){ //send 3 bytes on enter
uart.putc(0x8a);
uart.putc(0xFF);
uart.putc(0xAC);
pc.printf("Enter an Terminal gesendet \n\r");
read = 1;
}
}
if ((uart.readable()) && (read ==1)){
pc.printf("==> %#02x \n\r", uart.getc());
pc.printf("==> %#02x \n\r", uart.getc());
pc.printf("==> %#02x \n\r", uart.getc());
read = 0;
}
}
This connection runs with 2 Computers and terminal programs. I try to send more than one byte in both directions, but more than one Byte could not be send without fault. The same thing works fine with 9600baud (9600uart / 115200pc) !
Could anyone help me?
Stephan
1 Answer
9 years, 11 months ago.
This is working correctly for me
#include "mbed.h"
DigitalOut myled(LED1);
Serial pc(USBTX,USBRX);
int main() {
int loop=1;
pc.baud(115200);
while(1) {
myled = 1; // LED is ON
wait(0.2); // 200 ms
myled = 0; // LED is OFF
wait(1.0); // 1 sec
pc.printf("Hello %d",loop++);
}
}
Sorry, but there are two Serial lines and "Serial uart(PF_7, PF_6);" causes the problem.
I need the uart connection for communication with a RS232 device at 115200 baud and 8 Databits, 2 Stopbits, parity Space. So I wrote a little program to test this connection with two terminal programs and the communication doesen't work with 115000. But with 9600 everything works fine.
posted by 27 Nov 2015