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

UART Receice Data nrf52840

Hi everyone! I have probelem with receice data over UART. In the other MCU use core ARM as : STM32, NXP... when a byte is recieved, MCU has flag to notify. That is "interrupt". But in the NRF52, I can't see it. I always use "polling" mechanism to receive data. How can I use "interrupt" to receive data? thanks!!!

Parents
  • Thanks for your response. Can I use it as :

    void uart_callback_handle(app_uart_evt_t * p_event)
    {
        if (p_event->evt_type == APP_UART_COMMUNICATION_ERROR)
        {
            APP_ERROR_HANDLER(p_event->data.error_communication);
        }
         if (p_event->evt_type == APP_UART_FIFO_ERROR)
        {
            APP_ERROR_HANDLER(p_event->data.error_code);
        }
    		if( p_event->evt_type == APP_UART_DATA_READY)
    		{
    			while(app_uart_get(&data)!=NRF_SUCCESS) {};
    			data_arr[index]=data;
    			index++;
    				if(index==10)
    				{index=0;xong=1;}
    		}		 
    }
    
Reply
  • Thanks for your response. Can I use it as :

    void uart_callback_handle(app_uart_evt_t * p_event)
    {
        if (p_event->evt_type == APP_UART_COMMUNICATION_ERROR)
        {
            APP_ERROR_HANDLER(p_event->data.error_communication);
        }
         if (p_event->evt_type == APP_UART_FIFO_ERROR)
        {
            APP_ERROR_HANDLER(p_event->data.error_code);
        }
    		if( p_event->evt_type == APP_UART_DATA_READY)
    		{
    			while(app_uart_get(&data)!=NRF_SUCCESS) {};
    			data_arr[index]=data;
    			index++;
    				if(index==10)
    				{index=0;xong=1;}
    		}		 
    }
    
Children
Related