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

Receiving only one char through uart interrupt in Serial_uartes

Hi there,

I'm using nrf52840 DK and Custom board, SDK 15.1.0, Segger Embedded Studio(SES v5.20)

my issue is when i receive data from uart interrupt based on serial uartes example, i can only receive one char at a time. that means if i store that data in a char variable and should add to the char array then its works fine, but i want to read the complete data on single shot, so how can i do that,? i'm i doing anything wrong.

void GSM_InterruptHandler(nrf_serial_t const *p_serial, nrf_serial_event_t event)
{
static uint8_t index1=0;
char bb;
switch (event)
  {
    case NRF_SERIAL_EVENT_RX_DATA:
      if((nrf_serial_read(&serial0_uarte, &bb, sizeof(bb), &readed_size, 500))==NRF_SUCCESS)
      {
      gsm_d.RxBuf[index1++] = bb;
      rx_done = true;
      }
      break;
    case NRF_SERIAL_EVENT_TX_DONE:
      tx_done = true;
      break;
    case NRF_SERIAL_EVENT_DRV_ERR:
      APP_ERROR_CHECK(nrf_serial_uninit(&serial0_uarte));
      APP_ERROR_CHECK(nrf_serial_init(&serial0_uarte, &m_uarte1_drv_config, &serial0_config));
      break;
    case NRF_SERIAL_EVENT_FIFO_ERR:
      break;
    default:
      break;
  }
}

Im reading the rx buff like this, but its triggers multiple times for every rx event, and i need like this

case NRF_SERIAL_EVENT_RX_DATA:
      if((nrf_serial_read(&serial0_uarte, &gsm_d.RxBuf, sizeof(gsm_d.RxBuf), &readed_size, NRF_SERIAL_MAX_TIMEOUT))==NRF_SUCCESS)
      {
      rx_done = true;
      }
      break;

so please help me

Thanks in advance

Best Regards

Raj

Parents Reply
  • Hi Rajender, I am back from vacation and will look into this tomorrow. I suspect that the issue is that GSM_InterruptHandler might have higher priority than UART interrupt and is triggering faster than the byte received inthe UART RX FIFO. Or the uart traffic is slower than the frequency of the GSM interrupt frequency?

    if none is the case, then we need to debug as to why you are not able to receive multiple received bytes from FIFO.

    Before i can try to dig more into the nrf_serial library, could you tell me 

    1) GSM interrupt frequency
    2) UART characters on the RX line in single transaction (logic analyzer snapshots would be helful)
    3) UART and GSM interrupt priority

Children
Related