cancel
Showing results for 
Search instead for 
Did you mean: 

How to handle the difference size in I2C DMA slave receiving.

NT1
Visitor

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

 

 

 

1 REPLY 1
TDK
Super User

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.

If you feel a post has answered your question, please click "Accept as Solution".