2025-10-22 2:12 PM
the sample code I2C_TwoBoards_ComDMA for the STM32H563 EVB.
On the host side, if the command length is unknown and may vary from one to three bytes, how can I modify the following function to handle a variable-length transfer based on I2C received size of bytes instead of a fixed size?
HAL_StatusTypeDef HAL_I2C_Slave_Receive_DMA(I2C_HandleTypeDef *hi2c, uint8_t *pData, uint16_t Size)
Thanks
2025-10-22 2:41 PM
Use the largest size you will support and process/ignore the AF error when it happens if you receive fewer than that amount. The rest of the data will still be there.