2025-10-07 10:32 AM
Hi ST team,
I’ve been testing I3C Target mode on STM32H563 using CubeH5 HAL.
In mixed write/read transactions such as:
the Target cannot know in advance how many bytes the controller will write before RESTART.
However, HAL requires me to specify a fixed length when calling:
and later, at frame completion (FCF), the driver checks:
In real usage, the controller might send only one byte (e.g. a register offset) before RESTART.
This causes HAL_I3C_ERROR_SIZE even though the transfer is perfectly valid.
Is this strict == Size check intentional?
It seems unrealistic for Target side to know the controller’s write length.
Can HAL provide a “short frame allowed” option,
where the driver still calls TgtRxCpltCallback() and reports actual bytes received (e.g. through LL_I3C_GetXferDataCount()),
instead of treating it as an error?
If this is not supported, what is the recommended method for handling variable-length or “write-then-read” transactions in Target mode?
This limitation currently forces developers to:
either modify HAL to remove that equality check,
or catch HAL_I3C_ERROR_SIZE in ErrorCallback and treat it as a “normal short write”,
both of which are quite awkward.
MCU: STM32H563ZI
CubeH5 version: [your CubeIDE version, e.g. v1.5.0 / HAL v1.2.0]
HAL function: HAL_I3C_Tgt_Receive_IT
Firmware mode: Target
Error code observed: HAL_I3C_ERROR_SIZE
Allow HAL_I3C_Tgt_Receive_IT() to handle shorter-than-expected writes gracefully,
e.g. by adding a configurable flag such as:
or by reporting actual count via a callback parameter.
Thanks in advance!
This would make the HAL usable in real-world variable-length I3C Target designs.