NRF52832 FreeRTOS+UARTE not worked

Hi everyone:

I want to use UARTE on my FreeRTOS, but when I used the example(examples/peripheral/libuarte) in rtos, something went wrong.

First of all, I tested the example, and it looks like good. When I send slowly, the uart log is here.

and when I send quickly(every 4ms), the uart log is that.

But when I use the UARTE in FreeRTOS, It looks OK when sending slowly, but when I send it every 4ms(I need this frequency), the result is here.

I don't know what's wrong.

Best regards, 

Lurn

  • Hi Einar,

    Did you find anything in my application?

    I can't find the reason for this question.

    BR,

    Lurn

  • Hi Lurn,

    I have not tested your application on my end, but I have had a closer look, and the UART related code seems good to me.

    The screenshot you showed where many Z characters were received seems to indicate that there is no data loss, though - only that you got two events for what I assume conceptually was one transaction? You will get data when there is a timeout (packet boundary) or when the Rx buffer is full. What happens if you adjust the timeout here in your uart_init() function?

    Einar

  • I modify the timeout to 10 or 100 or 1000, it looks like same..

    timeout is 100us in this logs.

     

  • here is no data loss, though - only that you got two events for what I assume conceptually was one transaction

    Yes, I think so, the data is not lost, just became two parts.

    You will get data when there is a timeout (packet boundary) or when the Rx buffer is full.

    I think it's really about Rx buffer, cause when I change the buffer size from 256 to 64 the data was be split earlier.

    NRF_LIBUARTE_ASYNC_DEFINE(libuarte, 0, 0, 0, NRF_LIBUARTE_PERIPHERAL_NOT_USED, 64, 3);

    But, the rx buffer was cleared everytime I received data.

    I used that nrf_libuarte_async_rx_free(p_libuarte, p_evt->data.rxtx.p_data, p_evt->data.rxtx.length);

    Do you have any other solution?

    And I have another question that I need a frequency of 500 times per second, but when I test the application,I don't think it can reach this frequency. Because I get the logs in 9 second, it just 260 times data. Also I will check the sender frequency, and I hope you can give me some suggestions.

    BR,

    Lurn

  • After my test, Here is 3 questions.

    I send 32 bytes, the data head is A5 C5, and print 34 bytes so the last two data should be 0.

    (uint8_t data_array[256] = {0};)

    1. When the sender sending data slowly, about 25 times per second, logs looks like that.

    After receiving several pieces of data, one of it was split into two parts

    2. When the sender sending data quickly, (250 times per second), data will be lost, Only 30 pieces of data are received per second.

    3. When the sender sending data quickly, (250 times per second), logs looks like that.

    There is an exception in the data format,

    Hope you can give me some suggestions.

    BR,

    Lurn

Related