Arm Mbed OS support forum

NUCLEO-F767ZI - USART Problem when baud rate higher than 2.25 MHz

Hi all :slight_smile:

I have got a problem on my code :

#include “mbed.h”
#include “atoh.h”

Serial pc(SERIAL_TX, SERIAL_RX);
DigitalOut led(LED2);

int main()
{

pc.format(8,SerialBase::None,1);

pc.baud(2250000);

while(1) {
    char c = pc.getc(); // Read hyperterminal
    if (c == '0') {
        led = 0; // OFF
        if (pc.writeable()) {
            pc.printf("OFF\t");
        }
    }
    else if (c == '1') {
        led = 1; // ON
        if (pc.writeable()) {
            pc.printf("ON\t");
        }
    }
    else {
        pc.printf( "%c = 0x%x\t",c,c);
    }
}

}

Hi simply make a LED turn on if I send ‘1’ in the terminal, turn off if I send ‘0’ or send the character pressed if not.

It works correctly for a baud rate at max 2.25 MHz, but when I try to do it higher, for instance 4 or 8 Mhz, I just get on the terminal wrong characters, which do not correspond to what I send.

I looked on the internet and some say that maybe it was a problem of clock linked to the USART3, but I found that the clock is 48 MHz here, which would work…

I just linked my NUCLEO with my PC through a USB-Micro wire to make serial communication.

If someone has any suggestion, it would be nice.

Thanks.

Hello Benoit,

Considering that RS-232 TTL is an asynchronous (no clock signal is used in contrary to for example the SPI), unipolar, non-return-to-zero (opposed to for example RS-485, USB or CAN) I think that 2.25 MHz is an amazing achievement (I would expect ten times less). Of course the distance is very short (from the MCU chip to the ST-Link USART/USB converter).

Best regards, Zoltan

Thank you for the reply :slight_smile:

Finally I stayed with this value for this communication, I was not able to go higher than 2.25 MHz.

Now I moved to USART6 to send data, which is then convert to RS485 and then into USB with my components. I reached 8 MHz with this USART which is the limitation due to my converters components.