cancel
Showing results for 
Search instead for 
Did you mean: 

USART display error on STM32 NUCLEO H533RE

Rav3nPho3nix
Visitor

Hi, i'm currently beginning to create my own RTOS (on bare metal) for my NUCLEO H533RE.

My source code is available here : https://github.com/Rav3nPho3nix/Rav3nTOS

Here is my issue : i'm trying to implement USART 2 for my board to have a "print" tool. I can connect with "minicom" to see the output from the ST LINK.

 

My main function (the main function on my repo is not up to date) is here :

#include <stdint.h>
#include "platform.h"
#include "usart.h"

int main(void) {
    platform_init();
    while (1) {
        usart_write_string("Test\n\r");
        for (volatile uint32_t i = 0; i < 1000000; i++);
    }
}

 It just call 'platform_init' then print with usart 2.

My 'platform_init' just initialize usart by setting the baud rate to 115200 :

usart_init(115200U);

 And to finish, here is the code for usart : https://github.com/Rav3nPho3nix/Rav3nTOS/blob/main/bsp/stm32h533/usart.c

I think my problem come from this line when is calculate the brr value :

    // Set up BBR
    // 64 Mhz of frequency
    // BBR = (64,000,000) / BaudRate
    USART2->BRR = 64000000U / baudrate;

Here is supposed that the frequency is 64 Mhz, but i'm not sure. I have read the reference manual and datasheet of the STM32H533 but i didn't found what is the correct frequency value.

As a result, when i use minicom to display my usart 'print', these characters appears : ����怆, wich correspond to my `Test\r\n', so it's really just a brr value calculation error for me.

Do you know the correct value ?
Thx in advance.

0 REPLIES 0