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

Receiving 1024 byte of data continuously over TWIS i2c slave

Hi All,

I have a device configured as i2c master, The device is sending 1024 byte of data to NRF52832 DK continuously in form of 255-bytes packet. But I observed that I am able to receive only 1 packet of 255 bytes all other packets get missed and the event does not trigger for the rest of the packet. I2c master device is sending 1024 byte of data continuously with an interval of 20 secs. So each time I only receive 1st packet all other packets get missed. following is the event handler

 static void twis_event_handler(nrf_drv_twis_evt_t const * const p_event)
  {
     
      switch (p_event->type)
      {
      case TWIS_EVT_READ_REQ:
        if (p_event->data.buf_req)
        {
           nrf_drv_twis_tx_prepare(&m_twis, tx_buffer, TWIS_MAX_LENGHT);
        }
        break;
      case TWIS_EVT_READ_DONE:
          memset(tx_buffer, 0x00, sizeof(tx_buffer));
      case TWIS_EVT_WRITE_REQ:
          nrf_drv_twis_rx_prepare(&m_twis, rx_buffer, sizeof(rx_buffer));
          break;
      case TWIS_EVT_WRITE_DONE:
            handleCommand(rx_buffer[0]);
            memset(rx_buffer, 0x00, TWIS_MAX_LENGHT);
            break;
                          

      case TWIS_EVT_READ_ERROR:
      case TWIS_EVT_WRITE_ERROR:
      case TWIS_EVT_GENERAL_ERROR:
          m_error_flag = true;
          break;
      default:
          break;
      }
  }

Can any help me to solve this issue, Why data get missed and how can i receive the data successfully.

Thanks and Regards,

Pradeep

Parents Reply Children
Related