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
  • Hello,

    Is the driver configured to operate in blocking or non-blocking mode (see Basic usage)? Also, have you checked if nrf_drv_twi_tx() returns with an error code?

    Thanks

    Vidar

  • I'm using LTC2631, 12 bit DAC IC for write operation using using below code:

    #define LTC2631_BASE_ADDRESS    0x73      //!< LTC2631 base address  //0010000

    #define LTC2631_DAC_ADDRESS     0x30  //!< LTC2631 write-to-dac register
    #define LTC2631_EEPROM_ADDRESS  0x60        //!< LTC2631 write-to-eeprom register

    #define RDY_BIT_POS             0x07        //!< Position of RDY bit



      /* Shift parameter val to get 2 8-bits values. */
        uint8_t reg[3] = {LTC2631_DAC_ADDRESS,
                          (val>>4), (val<<4)};
    
        /*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;

    Could you please tell me if I'm missing something here


      

Reply
  • I'm using LTC2631, 12 bit DAC IC for write operation using using below code:

    #define LTC2631_BASE_ADDRESS    0x73      //!< LTC2631 base address  //0010000

    #define LTC2631_DAC_ADDRESS     0x30  //!< LTC2631 write-to-dac register
    #define LTC2631_EEPROM_ADDRESS  0x60        //!< LTC2631 write-to-eeprom register

    #define RDY_BIT_POS             0x07        //!< Position of RDY bit



      /* Shift parameter val to get 2 8-bits values. */
        uint8_t reg[3] = {LTC2631_DAC_ADDRESS,
                          (val>>4), (val<<4)};
    
        /*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;

    Could you please tell me if I'm missing something here


      

Children
No Data
Related