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,

    I think something is wrong.

    On the previous basis I used two nRF device to test my code.

    No.1 use UARTE to receive data from PC and send the data to No.2 nRF device over esb.

    No.2  use esb to receive data and send it to PC over UART.

    When I tested it, I found that I can get the correct data from No.1 over esb, but when I send the data to PC over UART, Some data is wrong.

    You can see the uart print, at 00283232 the data I send is

    hex_str = '5AC48602030405060708090A0B0C0D0E0F0102030405060708090A0B0C0D0E0F'

    but I loss the '02 03 04 05'

    I can make sure that the data I received is correct. Because before I send it over UART, I print it by RTT, and it was ok.

        printf("data_array = ");
        for(int i = 0; i < index; i ++)
        {
            printf("%X,"data_array[i]);
        }
        err_code = nrf_libuarte_async_tx(&libuarte, data_array, index);
        if(err_code != NRF_SUCCESS)
            UART_PRINTF("nrf_libuarte_async_tx err_code = %d.", err_code);
        APP_ERROR_CHECK(err_code);

     Do you know what the problem is?

    BR,

    Lurn

  • Hi Lurn,

    Can you check the UART Tx line with a logic analyzer or similar to see if the data is actually sent over UART by the nRF (as the data is there it seems likely). If it is and the data seems valid there, but it is not received by the PC for some reason, then the question is why it was not received by the PC. As you are not using flow control, you could experience and should expect data loss in some situations if the other end is not ready to receive data for some reason.

    Einar

Related