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

  • The BAUDRATE register of UART0 and the BAUDRATE register of UARTE0 exist separately.
    The values of NRF_UART_BAUDRATE_115200 and NRF_UARTE_BAUDRATE_115200 are different.
    Set NRF_UART_BAUDRATE_115200 in BAUDRATE register of UART0,
    Setting NRF_UARTE_BAUDRATE_115200 in the UARTE0 BAUDRATE register changes the contents of the UART0 BAUDRATE register to NRF_UARTE_BAUDRATE_115200.
    Is there a way to set them separately?

  • yokokawa said:
    The values of NRF_UART_BAUDRATE_115200 and NRF_UARTE_BAUDRATE_115200 are different.

     If you take a look in the nrf_uart.h header file, you can see that if UARTE is defined/present, then NRF_UART_BAUDRATE_115200 = UARTE_BAUDRATE_BAUDRATE_Baud115200. And in nrf_uarte.h you can see that NRF_UARTE_BAUDRATE_115200 = UARTE_BAUDRATE_BAUDRATE_Baud115200. So no, they are not different when using UARTE in your application.

    I'm having some trouble understanding what the problem is, to be honest. Could you please try to explain what you're struggling with, as it seems to me that your baud rate is 115200 (which is the correct default baud rate) both for using UART and UARTE.

    Best regards,

    Simon

  • The baud rate value setting differs between UART0 and UARTE0.
    (See nrf52_bitfields.h)
    UART0 : UART_BAUDRATE_BAUDRATE_Baud115200 = 0x01D7E000
    UARTE0: UARTE_BAUDRATE_BAUDRATE_Baud115200 = 0x01D60000

    The SDK example programs Ble_app_uart and Ble_app_uart_c use the "UARTE0" function.
    But I found "UART0" baud rate value is set. Why? Is this a mistake?
    Is it okay to change the baud rate setting of function uart_init() to UARTE0 setting (UARTE_BAUDRATE_BAUDRATE_Baud115200 = 0x01D60000)?

  • Hi

    Thank you for clarifying, and sorry that I missed that. The reason these baud rates are different is that they are different modules, and require different baud rates to work properly. Anyway, I think you're mistaken with regards to the which modules these examples are using, as they're both using the UART register, which is why it makes sense that they both use the UART baud rate. It is possible to switch and use UARTE instead, but in that case, the code in ble_app_uart switches automatically to the correct baud rate and header files.

    Please tell me if anything is unclear, or how you can see that UARTE is the module that is used in the example.

    Best regards,

    Simon

  • This screen is a screen where the UART transmission is executed using Ble_app_uart_c of SDK sample program and the transmission program used is confirmed.
    ① Function name (nrfx_uarte_tx)
    UARTE is used.
    (2) UART0 baud rate setting
    UART0 baud rate parameter is set
    (3) UARTE0 baud rate setting
    The parameters are different.
    (UART0 baud rate parameter is set.)

    I am using UARTE, but the baud rate parameter of UARTE0 is not set correctly.

Related