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

How to enable the uarte RXDRDY interrupt?

Hi, All!

I am using nRF52832, the uart0 tx/rx works well, but the uarte0 can send bytes, but can not receive any bytes. The code as follows, could you help me please?

   #define YTALK_PIN    28

    // gpio
    nrf_gpio_cfg_input(YTALK_PIN, NRF_GPIO_PIN_NOPULL);
    // uarte
    nrf_uarte_txrx_pins_set(NRF_UARTE0, NRF_UARTE_PSEL_DISCONNECTED, YTALK_PIN);
    nrf_uarte_baudrate_set(NRF_UARTE0, UARTE_BAUDRATE_BAUDRATE_Baud115200);
    nrf_uarte_configure(NRF_UARTE0, NRF_UARTE_PARITY_EXCLUDED, NRF_UARTE_HWFC_DISABLED);
    nrf_uarte_enable(NRF_UARTE0);
    
    nrf_uarte_event_clear(NRF_UARTE0, NRF_UARTE_EVENT_RXDRDY);
    nrf_uarte_int_enable(NRF_UARTE0, NRF_UARTE_INT_RXDRDY_MASK);
  
    nrf_uarte_rx_buffer_set(NRF_UARTE0, ytalk_rx_buffer, 10);
    nrf_uarte_task_trigger(NRF_UARTE0, NRF_UARTE_TASK_STARTRX); 


    NVIC_SetPriority(UART0_IRQn, configLIBRARY_LOWEST_INTERRUPT_PRIORITY);
    NVIC_ClearPendingIRQ(UART0_IRQn);
    NVIC_EnableIRQ(UART0_IRQn);

void UART0_IRQHandler(void)
{
    if(nrf_uarte_event_check(NRF_UARTE0, NRF_UARTE_EVENT_RXDRDY)) {
        nrf_uarte_event_clear(NRF_UARTE0, NRF_UARTE_EVENT_RXDRDY);
        nrf_gpio_pin_toggle(29);
        nrf_uarte_task_trigger(NRF_UARTE0, NRF_UART_TASK_STARTRX);
    }
}
    
  

Related