cancel
Showing results for 
Search instead for 
Did you mean: 

CPAL library - Errors on the DualAddress code

dcurran2
Associate II
Posted on August 12, 2013 at 10:56

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 XYZ

then another address to do ABC

It 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.  

  

1 REPLY 1
dcurran2
Associate II
Posted on August 14, 2013 at 11:54

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 */  

      }