cancel
Showing results for 
Search instead for 
Did you mean: 

I3C HAL_I3C_Ctrl_MultipleTransfer_IT read/write data

Goldberg
Associate II

Hello,

Currently I implement a I3C function of mass readback data from the target device.

I use the HAL_I3C_Ctrl_MultipleTransfer_IT, the mass write data into target  device that is worked.

But readback data operation is not worked well.

If it readback data under 16 bytes, it is worked.

Therefore, readback data above 16 bytes, that data is limited in 16 bytes.

For example, the first operation that it is setup to readback 32 bytes data, but the waveform shows the readback data is 16 bytes.

Goldberg_0-1733076118892.png

 

And repeat again the same read data operation, it is stucked. 

Goldberg_1-1733076179559.png

If any specific setting is needed to modify to unlock the  read data 16 bytes limitation?

on the controller side, function as below:

void HXREG_READ(uint8_t cas_ID, uint32_t datalenght)
{
uint32_t ctrlread_buffer[0xF];
 
I2C_TxBuffer[0]=cas_ID;
 
// Configure private messages
aPrivateDescriptor[0].TargetAddr = TARGET1_DYN_ADDR;
aPrivateDescriptor[0].TxBuf.pBuffer = I2C_TxBuffer;
aPrivateDescriptor[0].TxBuf.Size = 1;
aPrivateDescriptor[0].RxBuf.pBuffer = NULL;
aPrivateDescriptor[0].RxBuf.Size = 0;
aPrivateDescriptor[0].Direction = HAL_I3C_DIRECTION_WRITE;
 
aPrivateDescriptor[1].TargetAddr = TARGET1_DYN_ADDR;
aPrivateDescriptor[1].TxBuf.pBuffer = NULL;
aPrivateDescriptor[1].TxBuf.Size = 0;
aPrivateDescriptor[1].RxBuf.pBuffer = I2C_RxBuffer;
aPrivateDescriptor[1].RxBuf.Size = datalenght; 
aPrivateDescriptor[1].Direction = HAL_I3C_DIRECTION_READ;
 
// Configure transfer structure
I3Ctransfer.CtrlBuf.pBuffer = ctrlread_buffer;
I3Ctransfer.CtrlBuf.Size = 2;
I3Ctransfer.TxBuf.pBuffer = I2C_TxBuffer;
I3Ctransfer.TxBuf.Size = 1;
I3Ctransfer.RxBuf.pBuffer = I2C_RxBuffer;
I3Ctransfer.RxBuf.Size = datalenght; 
 
// Add descriptors to frame
HAL_I3C_AddDescToFrame(&hi3c1, NULL, aPrivateDescriptor, &I3Ctransfer, I3Ctransfer.CtrlBuf.Size, I3C_PRIVATE_WITHOUT_ARB_RESTART);
 
// Start the transfer
HAL_StatusTypeDef status = HAL_I3C_Ctrl_MultipleTransfer_IT(&hi3c1, &I3Ctransfer);
if (status != HAL_OK) {
    Error_Handler();
}
 
// Wait for transfer to complete
while (HAL_I3C_GetState(&hi3c1) == HAL_I3C_STATE_BUSY_TX_RX) {
    // Optionally, handle other tasks
}
}

 

1 ACCEPTED SOLUTION

Accepted Solutions
Goldberg
Associate II

Hello Imen.D.

I found out the solution.

Firstable, it must to be set "SETMWL" and "SETMRL"  commands.

To setup the write/read length, and then count of read back data that is correct.

Thanks,

 

View solution in original post

3 REPLIES 3
Imen.D
ST Employee

Hello @Goldberg ,

Please refer to the STM32H5 errata sheet, in the limitation related to "I3C controller: unexpected read data bytes during a legacy I2C read".

ImenD_0-1733077800423.png

When your question is answered, please close this topic by clicking "Accept as Solution".
Thanks
Imen

Hello Imen.D,

I could not find the clue from the errata.

Even the fuction changed to HAL_I3C_Ctrl_Receive_DMA, the readback data that is also limited in 16 bytes.

The phenomenon is the same as last post.

My request is that I3C can mass read data up to 2K bytes in one operation.

Any specific setting is needed to modify to extend the  read data more than 16 bytes in one operation?

Thanks for your reponse.

 

Goldberg
Associate II

Hello Imen.D.

I found out the solution.

Firstable, it must to be set "SETMWL" and "SETMRL"  commands.

To setup the write/read length, and then count of read back data that is correct.

Thanks,