2013-08-12 01:56 AM
I have set up a stm3220G dev board as a slave using the
uint32_t CPAL_I2C_Listen(CPAL_InitTypeDef* pDevInitStruct) function to deal with any IC2 data being sent to the device.I need to use the Dual address functionality eg Write to one address to do XYZthen another address to do ABCIt seems that the value in OAR2 is being ignored unless void I2C_OwnAddress2Config(I2C_TypeDef* I2Cx, uint8_t Address) function from stm32f2xx_ic2.c is put after /* If Dual Address Mode Option Bit Selected */ if ((pDevInitStruct->wCPAL_Options & CPAL_OPT_I2C_DUALADDR) != 0) { /* Enable Dual Address Mode */ __CPAL_I2C_HAL_ENABLE_DUALADDR(pDevInitStruct->CPAL_Dev); /* Configure OAR2 */ __CPAL_I2C_HAL_OAR2_CONF(pDevInitStruct->CPAL_Dev, (uint8_t)(pDevInitStruct->wCPAL_Options & 0x000000FE));in the cpal lib file cpal_i2c.c
has anyone else come accross this ? Before adding the code from stm32f2xx_i2c.c there would never be an interrupt when the second address was either written or read from.2013-08-14 02:54 AM
another thing to look for
/* Update CPAL_State to CPAL_STATE_READY */ pDevInitStruct->CPAL_State = CPAL_STATE_READY; } #endif /* CPAL_I2C_MASTER_MODE */ rather than /* Update CPAL_State to CPAL_STATE_READY */ pDevInitStruct->CPAL_State = CPAL_STATE_READY; #endif /* CPAL_I2C_MASTER_MODE */ }