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

Uart baud rate 512

Is it possibe to configure uart with baud rate of 512 on nrf52832?

I tried to configure the uart with this baud rate, but I am not able to get the uart communication working

Parents
  • Sorry about digging up an old post here.

    With regards to the values in the UART_BAUDRATE register I have a hard time match the "actual rate" in the nrf52_bitfields.h with the formula given.

    #define UART_BAUDRATE_BAUDRATE_Baud921600 (0x0EBED000UL) /*!< 921600 baud (actual rate: 941176) */

    0x0EBED000 * 16000000 / 2^32 = 921585

    Did I miscalculate or misunderstand anything?

    Thx,

    -Magnus

  • There is a 2% error in the documented baud rate for 921600 baud:

    // Quoted values from nRF52832 v1.4 datasheet - 16 correct, 10 incorrect
    static BaudCheck_t BaudCheck[] = {
    //  -------Documentation---------   -------Calculated---------
    //  Register    Required   Actual    Register    Actual    Ok?      Index
    //  ==========  ========   ======   ==========   ======   ====      =====
       {0x0004F000,     1200,    1205,  0x0004F000,    1205, " Ok"},  //  0
       {0x0009D000,     2400,    2396,  0x0009D000,    2395, " Ok"},  //  1
       {0x0013B000,     4800,    4808,  0x0013B000,    4806, " Ok"},  //  2
       {0x00275000,     9600,    9598,  0x00275000,    9597, " Ok"},  //  3
       {0x003AF000,    14400,   14401,  0x003B0000,   14404, "  -"},  //  4
       {0x004EA000,    19200,   19208,  0x004EA000,   19195, " Ok"},  //  5
       {0x0075C000,    28800,   28777,  0x0075F000,   28793, "  -"},  //  6
       {0x009D0000,    38400,   38369,  0x009D5000,   38406, "  -"},  //  7
       {0x00EB0000,    57600,   57554,  0x00EBF000,   57601, "  -"},  //  8
       {0x013A9000,    76800,   76923,  0x013A9000,   76797, " Ok"},  //  9
       {0x01D60000,   115200,  115108,  0x01D7E000,  115203, "  -"},  // 10
       {0x03B00000,   230400,  231884,  0x03AFB000,  230392, "  -"},  // 11
       {0x04000000,   250000,  250000,  0x04000000,  250000, " Ok"},  // 12
       {0x07400000,   460800,  457143,  0x075F7000,  460800, "  -"},  // 13
       {0x0F000000,   921600,  941176,  0x0EBEE000,  921600, "  -"},  // 14
       {0x10000000,  1000000, 1000000,  0x10000000, 1000000, " Ok"},  // 15
    // Extra and changed values from nRF52840 Product Specification
       {0x003B0000,    14400,   14414,  0x003B0000,   14404, " Ok"},  // 16
       {0x0075F000,    28800,   28829,  0x0075F000,   28793, " Ok"},  // 17
       {0x00800000,    31250,   31250,  0x00800000,   31250, " Ok"},  // 18
       {0x009D5000,    38400,   38462,  0x003B0000,   38406, " Ok"},  // 19
       {0x00E50000,    56000,   55944,  0x00E56000,   55999, "  -"},  // 20
       {0x00EBF000,    57600,   57762,  0x00EBF000,   57601, " Ok"},  // 21
       {0x01D7E000,   115200,  115942,  0x01D7E000,  115203, " Ok"},  // 22
       {0x03AFB000,   230400,  231884,  0x03AFB000,  230392, " Ok"},  // 23
       {0x075F7000,   460800,  470588,  0x075F7000,  460800, " Ok"},  // 24
       {0x0EBED000,   921600,  941176,  0x0EBEE000,  921600, "  -"}}; // 25
    #define NUM_BAUD_TESTS (sizeof(BaudCheck)/sizeof(BaudCheck[0]))
    

    This link shows my calculations: uart-baud-rate-generator which can be used to get 512 baud

    Updated for v1.7 datasheet framing-error-and-noisy-data-when-using-uarte-at-high-baud-rate

  • Thanks a lot. so if I understand your tables I have calculated correctly and the Nordic quoted numbers in the code and Product Specification differ from our understanding.

    It would be interesting to get a background to the numbers in the Product Specification.

    Would also be interesting to know why the register numbers for UART and UARTE differs in the Product Specification.

    Thanks,

    -Magnus

Reply Children
Related