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

  • I think this is because the timing of the end of the judgment is wrong. Does he use interrupt or polling to judge? How should I modify this discriminant condition.

  • Hi Lurn,

    There is not much to go on here. Can you elaborate a bit more? How exactly do you doing things in your implementation, and what exactly happens in the failing case? And what is the difference between the failing case (with FreeRTOS) and without it?

    Generally FreeRTOS does not interfere directly with UART, but it is tempting to think that there could be some issue with priorities, perhaps the application now is doing more or for some reason is not able to service UART related interrupts fast enough, but I don't know enough of your application to be more specific.

  • Sorry for my unclear description.

    I use the example uarte code in FreeRTOS, just modify here

        nrf_libuarte_async_config_t nrf_libuarte_async_config = {
                .tx_pin     = TX_PIN_NUMBER,
                .rx_pin     = RX_PIN_NUMBER,
                .baudrate   = NRF_UARTE_BAUDRATE_921600,
                .parity     = NRF_UARTE_PARITY_EXCLUDED,
                .hwfc       = NRF_UARTE_HWFC_DISABLED,
                .timeout_us = 2,
                .int_prio   = APP_IRQ_PRIORITY_HIGH,
                .pullup_rx  = 1
        };

    I change the int_prio from APP_IRQ_PRIORITY_LOW to APP_IRQ_PRIORITY_HIGH.

    the question is when I use FreeRTOS,when I'm done sending the data, I should receive the data immediately, the log should like that,  (the ->◇ is send data, <- Diamonds is receive data).

    But now, I get a wrong state, I only receive some data after I send it several times

    BR,

    Lurn

  • Hi Lurn,

    Which example are you referring to? Can you specify exactly? And can you upload your full modified example here along with instructions on how to reproduce so that I can test on my end?

  • you can try to  use the examples/peripheral/libuarte and blinky_rtc_freertos, and just send data(you can send anything such as abc etc.) every 4ms.

    and now I change the timeout_us to 0.

        nrf_libuarte_async_config_t nrf_libuarte_async_config = {
                .tx_pin     = TX_PIN_NUMBER,
                .rx_pin     = RX_PIN_NUMBER,
                .baudrate   = NRF_UARTE_BAUDRATE_921600,
                .parity     = NRF_UARTE_PARITY_EXCLUDED,
                .hwfc       = NRF_UARTE_HWFC_DISABLED,
                .timeout_us = 0,
                .int_prio   = APP_IRQ_PRIORITY_HIGH,
                .pullup_rx  = 1
        };

    At first I can receive the data immediately, after a short time, I receive some data after send it several times again.

    BR,

    Lurn

     

Related