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

nrf_libuarte_async TX issue

Basically, I cannot do continuous TX with nrf_libuarte_async:
Here is simple reproduce:
    static uint8_t text[] = "===TICK===\r\n";
    static uint8_t text_size = sizeof(text);
    static uint8_t text2[] = "+++TOCK+++\r\n";
    static uint8_t text2_size = sizeof(text2);
    while (true)
    {
        err_code = nrf_libuarte_async_tx(&libuarte, text, text_size);
        for (size_t i = 0; i < 1000000; i++)
        {
        }
        err_code = nrf_libuarte_async_tx(&libuarte, text2, text2_size);
        for (size_t i = 0; i < 10000000; i++)
        {
        }
    }
It only output ===TICK=== and no +++TOCK+++
Here is what I've tried:
1. I can confirm that NRF_LIBUARTE_ASYNC_EVT_TX_DONE event has been triggered during the for loop in between
2. If I increase the delay by for loop, both data got through
3. both calls returns 0x00 (SUCCESS)
4. If I put a breakpoint in between, of the NRF_LIBUARTE_ASYNC_EVT_TX_DONE  event, it works
5. I've tried in another project with RTOS and use osDelay to test the gap needed for second transmission, it seems ~300 ms is needed.
help please....
Parents
  • OK... problem solved.

    This is wrong way to prepare test data:

    static uint8_t text[] = "UART example started.\r\n Loopback:\r\n";
    static uint8_t text_size = sizeof(text);
    

    (this is in the libuarte example code!)

    Basically, the sizeof(text) will include the '\0' which is 0x00 as part of the buffer. Then UART will send the 0x00 to the terminal.

    My serial terminal (like others) don't like 0x00 showing in ascii view.

    But this is a ascii message... very misleading example.....

    Anyway, problem solved.

Reply
  • OK... problem solved.

    This is wrong way to prepare test data:

    static uint8_t text[] = "UART example started.\r\n Loopback:\r\n";
    static uint8_t text_size = sizeof(text);
    

    (this is in the libuarte example code!)

    Basically, the sizeof(text) will include the '\0' which is 0x00 as part of the buffer. Then UART will send the 0x00 to the terminal.

    My serial terminal (like others) don't like 0x00 showing in ascii view.

    But this is a ascii message... very misleading example.....

    Anyway, problem solved.

Children
No Data
Related