ADICUP3029/AD5940 I2C issues

Dear Analog (),


I am using the AD5940_BIOZ-2Wire example with the evaluation board for AD5940 (+ADICUP3029). I am attempting to write I2C commands to an external GPIO expander, but the code gets stuck. 

Initially I set up an I2C handle inside AD5940Main.c as seen below:

  /* Setup I2C */
  /* device handle */
  ADI_I2C_HANDLE i2cDevice;
  
  //Dont use pinmux since i2c pins are already defined in adi_i2c_v1.c
  //adi_initpinmux();
  
  /* check set speed API */
  if(ADI_I2C_SUCCESS == adi_i2c_Open(0, ADI_I2C_MASTER, &devMem, ADI_I2C_MEMORY_SIZE, &i2cDevice)){
    printf("I2C Open");
  }
  if(ADI_I2C_SUCCESS == adi_i2c_SetBitRate(i2cDevice, 400)){
    printf("I2C BitRate Set");  // top-end
  }
  if(ADI_I2C_SUCCESS == adi_i2c_SetHardwareAddress(i2cDevice, 0x20)){
    printf("I2C Addr Set");
  }

This code completes, but when I just after attempt to write on I2C using: adi_i2c_Write(i2cDevice, (unsigned char*)&Regs->Output, 1); this function gets stuck in I2C_BlockingIO() in adi_i2c_v1.c on this line:

/* Pend for the semaphore */
PEND_EVENT(DATA,ADI_I2C_ERR_RTOS);

I don't know where this semaphore would've been defined earlier in the code since the only place I can find where it otherwise could've been defined is in adi_i2c_Open(), also in adi_i2c_v1.c:

#if(ADI_CFG_ENABLE_RTOS_SUPPORT == 1)
/* create a semaphore for buffer management */
CREATE_SEM(drv->pData,ADI_I2C_ERR_RTOS);
#endif

I don't have ADI_CFG_ENABLE_RTOS_SUPPORT defined in the IAR Linker. I've tried simply out-commenting the PEND_EVENT, after which the code runs, but no data is seen on SDA or SCL.

Any suggestions on solving the issue much appreciated!

Thanks,

Andreas



Edited problem title to reflect updated problem description
[edited by: andyy at 10:07 PM (GMT 0) on 6 Dec 2018]
Parents Reply Children