cancel
Showing results for 
Search instead for 
Did you mean: 

How to configure STM32H7 in I3C to support SETDASA in Legacy I2C speed

linglinqin
Associate II

In my test environment, STM32H7S3Z8T6 works as the I3C controller and talks to the STM32H5 (I2C slave). The goal is STM32H7 will send out the entire SETDASA bytes at Legacy I2C speed, once STM32H5 receives the I2C speed SETDASA bytes, it decodes the sequence using software, and then switch from I2C slave to I3C target. 

On I3C controller side (STM32H7), when I use the HAL availble CCC API below:

    if (HAL_I3C_AddDescToFrame(&hi3c1, &s_sdsCcc, NULL, &s_sdsXfer, 1U,
                               I3C_DIRECT_WITHOUT_DEFBYTE_STOP) != HAL_OK)
    {
        return HAL_ERROR;
    }

    i3c1_setdasa_result = (uint32_t)HAL_I3C_Ctrl_TransmitCCC(&hi3c1, &s_sdsXfer, I3C1_TIMEOUT_MS);
 

Once 0x7E broadcast addr ACKed by I2C slave, CCC (0x87) and the following address infomation will be sent only at I3C speed (which are controled by the hardware).

So, I switched to the following strategy using I2C private transfer under I3C mode:

 
    HAL_I3C_AddDescToFrame(&hi3c1, NULL, s_sdsI2cPriv, &s_sdsI2cXfer, 2U,
                                            I2C_PRIVATE_WITHOUT_ARB_RESTART);
    i3c1_setdasa_i2c_result = (uint32_t)HAL_I3C_Ctrl_Transmit(&hi3c1, &s_sdsI2cXfer, I3C1_TIMEOUT_MS);

But again, it turns out only 0x7E the broadcast address could be received by I2C slave. 

In order to make sure STM32H7 can support legacy I2C speed in I3C mode, what is the necessary configration during bus initialization?

 
    /**I3C1 GPIO Configuration
    PB8     ------> I3C1_SCL
    PB9     ------> I3C1_SDA
    */
    GPIO_InitStruct.Pin = GPIO_PIN_8|GPIO_PIN_9;
    GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
    GPIO_InitStruct.Pull = GPIO_PULLUP;
    GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
    GPIO_InitStruct.Alternate = GPIO_AF4_I3C1;
    HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);

Will the above configurations work?

 

Thanks!

 

 

0 REPLIES 0