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

UARTE1 using nrfx_uarte , only transmit 6 bytes , fails on 7th byte and transmit again, and able to read only 6 bytes in return.

Hi everyone

I have been trying to use UARTE1 + UART0 combination for a device that i am working on, I have implemented the UART0 using the nrfx_uart library and it works fine

Problem : 

1. nrfx_uarte peripheral gives me error interrupt on 7th byte and not transmit anything after that
2. only receive 6 bytes and no bytes after that , though there's data on the uart lines.

I am aware of the nrf_serial library , but that application does not suit the development that i am working on.
Can you please help me how can i get it working?

Here is the initalization i am using.

//Boolean flag to be set in interrupt handler;
static volatile bool uart_xfer_done;
//Uart instance to be used.
static const nrfx_uarte_t uart1 =
            NRFX_UARTE_INSTANCE (1); 

//uart event handler decalartion
static void  uart_event_handler(nrfx_uarte_event_t const * p_event,void * p_context);


void uart_lte_init(uint32_t rx_pin,uint32_t tx_pin,uint32_t baud_rate)
{


    nrfx_uarte_config_t nrf_uart1;
    nrf_uart1.pselrxd = rx_pin ;
    nrf_uart1.pseltxd = tx_pin;
    nrf_uart1.pselcts = NRF_UARTE_PSEL_DISCONNECTED;
    nrf_uart1.pselrts = NRF_UARTE_PSEL_DISCONNECTED;
    nrf_uart1.hwfc = NRF_UARTE_HWFC_DISABLED;
    nrf_uart1.parity = NRF_UARTE_PARITY_EXCLUDED;
    nrf_uart1.interrupt_priority = NRFX_UARTE_DEFAULT_CONFIG_IRQ_PRIORITY;
    nrf_uart1.p_context = NULL;
   
 switch(baud_rate)
    {
         case baud_rate_lte_1200:
              nrf_uart1.baudrate = NRF_UARTE_BAUDRATE_1200;
              break;

         case baud_rate_lte_2400:
              nrf_uart1.baudrate = NRF_UARTE_BAUDRATE_2400;
              break;

         case baud_rate_lte_4800:
              nrf_uart1.baudrate = NRF_UARTE_BAUDRATE_4800;
              break;

         case baud_rate_lte_9600:
              nrf_uart1.baudrate = NRF_UARTE_BAUDRATE_9600;
              break;

         case baud_rate_lte_14400:
              nrf_uart1.baudrate = NRF_UARTE_BAUDRATE_14400;
              break;

         case baud_rate_lte_19200:
              nrf_uart1.baudrate = NRF_UARTE_BAUDRATE_19200;
              break;

         case baud_rate_lte_28800:
              nrf_uart1.baudrate = NRF_UARTE_BAUDRATE_28800;
              break;

         case baud_rate_lte_31250:
              nrf_uart1.baudrate = NRF_UARTE_BAUDRATE_31250;
              break;

         case baud_rate_lte_38400:
              nrf_uart1.baudrate = NRF_UARTE_BAUDRATE_38400;
              break;

         case baud_rate_lte_56000:
              nrf_uart1.baudrate = NRF_UARTE_BAUDRATE_56000;
              break;

         case baud_rate_lte_57600:
              nrf_uart1.baudrate = NRF_UARTE_BAUDRATE_57600;
              break;

         case baud_rate_lte_76800:
              nrf_uart1.baudrate = NRF_UARTE_BAUDRATE_76800;
              break;

         case baud_rate_lte_115200:
              nrf_uart1.baudrate = NRF_UARTE_BAUDRATE_115200;
              break;

         default:
              break;


    }
    
    nrfx_uarte_init(&uart1,&nrf_uart1,uart_event_handler);

//enable the rx

    nrf_uarte_event_clear(uart1.p_reg, NRF_UARTE_EVENT_ERROR);
    nrf_uarte_event_clear(uart1.p_reg, NRF_UARTE_EVENT_RXDRDY);
    nrf_uarte_task_trigger(uart1.p_reg, NRF_UARTE_TASK_STARTRX);
    
    
   
}

Parents Reply
  • I cannot see where you call read_byte_lte() in that code. If you do not call this fast enough to keep up with the incoming data, you may also end up in this situation. Also, it looks like you trigger the STARTRX task manually in the code after init, without setting the buffer (as far as I can see from what you have posted). The STARTRX task will also be triggered inside nrfx_uarte_rx when you set the first buffer. Can you post a full minimal project that can be used to reproduce the issue you are seeing on a DK?

Children
No Data
Related