cancel
Showing results for 
Search instead for 
Did you mean: 

STM32H503 I2C communication speed on I3C bus.

GH502
Visitor

Hello!

I connect one I2C target and one I3C target device both to PB6/PB7,  which is configured to be "mixed I3C and I2C bus" through STM32CubeIDE.

I3C parameter configuration is as below:

/* USER CODE END I3C1_Init 1 */

hi3c1.Instance = I3C1;

hi3c1.Mode = HAL_I3C_MODE_CONTROLLER;

hi3c1.Init.CtrlBusCharacteristic.SDAHoldTime = HAL_I3C_SDA_HOLD_TIME_1_5;

hi3c1.Init.CtrlBusCharacteristic.WaitTime = HAL_I3C_OWN_ACTIVITY_STATE_0;

hi3c1.Init.CtrlBusCharacteristic.SCLPPLowDuration = 0x18; // 5MHz

hi3c1.Init.CtrlBusCharacteristic.SCLI3CHighDuration = 0x18;

hi3c1.Init.CtrlBusCharacteristic.SCLODLowDuration = 0x7b; //1MHz

hi3c1.Init.CtrlBusCharacteristic.SCLI2CHighDuration = 0x7b;

hi3c1.Init.CtrlBusCharacteristic.BusFreeDuration = 0x69;

hi3c1.Init.CtrlBusCharacteristic.BusIdleDuration = 0xf6;

 

The problem I encountered is :

I3C devices works ok, but I2C device SCL frequency is same as I3C device, so I get wrong data when reading the I2C device , because SCL frequency is 5MHz, it is too fast for I2C device. I want the I2C device works at a lower speed, which is 1MHz in my case.

Below is the I2C waveform.

GH502_0-1762333926524.png

I use I3C API while comunicating with I2C device when reading one byte, as below code:

 

I3C_PrivateTypeDef aPrivateDescriptor[2] = {

{0x76, {aTxBuffer, 1}, {NULL, 0}, HAL_I3C_DIRECTION_WRITE},

{0x76, {NULL, 0}, {aRxBuffer, 1}, HAL_I3C_DIRECTION_READ}};

 

/* Prepare context buffer with the different parameters */

aContextBuffers.CtrlBuf.pBuffer = aControlBuffer;

aContextBuffers.CtrlBuf.Size = 2;

aContextBuffers.TxBuf.pBuffer = aTxBuffer;

aContextBuffers.TxBuf.Size = 1;

aContextBuffers.RxBuf.pBuffer = aRxBuffer;

aContextBuffers.RxBuf.Size = 1;

 

// Add descriptors to frame

HAL_I3C_AddDescToFrame(&hi3c1, NULL, aPrivateDescriptor, &aContextBuffers, aContextBuffers.CtrlBuf.Size, I3C_PRIVATE_WITHOUT_ARB_RESTART);

 

// Start the transfer

status = HAL_I3C_Ctrl_MultipleTransfer_IT(&hi3c1, &aContextBuffers);

if (status != HAL_OK) {

Error_Handler();

}

What might be the promblem ? Is it because I use the wrong API to communicate with I2C device ?

Is it possible to make my I2C device to work at  a lower speed?  

Thanks for any advice.

 

 

 

 

 

 

 

 

0 REPLIES 0