my program is getting stuck in assert_nrf_callback while using nrf_drv_twi_tx function

Hi,
I'm using nrf52832 custom board and 14.2 SDK, S132.

In my program I'm using SAADC, PWM, I2C along with softdevice and PID.  my device is working fine for some time but after certain time (10-15 sec) of running it's going to assert_nrf_callback because of  nrf_drv_twi_tx. below function is creating issue after working for sometime  :

ret_code_t ltc2631_set_voltage(uint16_t val)
{
    /* Shift parameter val to get 2 8-bits values. */
    uint8_t reg[3] = {LTC2631_DAC_ADDRESS,
                      (val>>8), (val)};

    /*uint8_t reg[3] = {LTC2631_DAC_ADDRESS,
                      (0), (0)};*/
    m_xfer_done = false;

   
    ret_code_t err_code = nrf_drv_twi_tx(&m_twi, LTC2631_BASE_ADDRESS, reg, sizeof(reg), false);
    if (err_code != NRF_SUCCESS)
    {
      NRF_LOG_INFO("error Erase bonds!");
        return err_code;
    }
  
    //NRF_LOG_INFO("success Erase bonds!");
   
    while (m_xfer_done == false);

    return NRF_SUCCESS;
    
}

while debugging I saw if val (argument in above code ) value is lower device is running properly for more time. I'm using LTC2631 DAC IC (want to gain  0 - 1.2V output voltage by giving 0-20000 digital value).

Note:

1: TWI is working fine but after giving some command to device and calling above function it's getting stuck and calling assert_nrf_callback which i'm not able to see in NRF_LOG_INFO.

2: if I disable above function device is working as expected.

Parents Reply Children
Related