This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

UARTE0 BAUDRATE setting method

OS in development environment :Windows7
HARD :(Taiyo Yuden)EBSHSN Series Evaluation Board : Central / Peripherals
CPU :(Nordic) nRF52832 / ARMR Cortex-M4F 32 bit processor 28-pin Land Grid Array / 15GPIOs / SWD
Soft Ver:nRF5_SDK_15.3.0_59ac345

The ble_app_uart program uses UARTE0. However, the correct value is not set in the UARTE0 BAUDRATE register.
(UART0 BAUDRATE value is set)
How can I set the UARTE0 BAUDRATE register correctly?

"Ble_app_uart_c" UARTE0 BAUDRATE register setting is also wrong

  • Hi

    The baud rate of both UART and UARTE is configured to 115200 in the uart_init() function, which is the default baud rate in our nRF5 SDK examples. What value do you want to set the baud rate to? You can also check the sdk_config.h file and set the NRFX_UARTE_DEFAULT_CONFIG_BAUDRATE to the default baud rate configuration you like.

    Best regards,

    Simon

  • When used without changing the program, the set value of UART0 is set to UART0 and UARTE0.
    Why is the setting value of UART0 set to UART0 and UARTE0 in the program that uses UARTE0?

    How can I set the baud rate for both UARTE0 and UART0 correctly?

  • Hi

    As you can see in the main.c file of the ble_app_uart example, the application checks if you're using UART or UARTE, and sets the baud rate accordingly.

    #if defined (UART_PRESENT)
            .baud_rate    = NRF_UART_BAUDRATE_115200
    #else
            .baud_rate    = NRF_UARTE_BAUDRATE_115200
    #endif

    I'm afraid I don't understand what you mean in your last reply, but you can set it by using any of the baud rate values defined in nrf_drv_uart.h and replacing it with the baud rate you want to use in your application.

    Best regards,

    Simon

  • The following program sets "NRF_UART_BAUDRATE_115200" when "UART_PRESENT" is valid, and sets "NRF_UARTE_BAUDRATE_115200" otherwise.
    However, if “UART_PRESENT” and “UARTE_PRESENT” are enabled, set “NRF_UART_BAUDRATE_115200”.
    For “nRF52832”, “UART_PRESENT” and “UARTE_PRESENT” are valid and “UARTE0” is used, but “NRF_UART_BAUDRATE_115200” is set.
    -------------------------------------------------- -------------------------------------------------- -
    #if defined (UART_PRESENT)
    .baud_rate = NRF_UART_BAUDRATE_115200
    #else
    .baud_rate = NRF_UARTE_BAUDRATE_115200
    #endif
    -------------------------------------------------- -------------------------------------------------- -
    Is ".baud_rate = NRF_UARTE_BAUDRATE_115200" good without using a judgment statement?
    “Ble_app_uart_c” is “.baud_rate = NRF_UART_BAUDRATE_115200” without a judgment sentence. Is it OK to change to “.baud_rate = NRF_UARTE_BAUDRATE_115200”?

  • Hi

    If your application is only going to use UARTE, there should not be any problems using just the NRF_UARTE_BAUDRATE_115200 to set the baud rate. Seeing as the two baud rates are the same in the example, it won't matter which of them are set, as the .baud_rate value is the same.

    Best regards,

    Simon

Related