Skip to main content
arnold_w
Senior II
March 2, 2022
Question

Use HAL_I2C_Master_Receive_DMA when the receive size is contained in the first received byte?

  • March 2, 2022
  • 1 reply
  • 785 views

I'm working with the Nucleo-64 development board with an STM32L476 microcontroller. I wish to receive data over I2C using DMA with the function HAL_I2C_Master_Receive_DMA. However, to use that function I need to specify the parameter Size, and I don't know that until I have received the first byte. Does anybody know how I can solve this?

This topic has been closed for replies.

1 reply

TDK
March 2, 2022

If they can be split into two transactions, read one byte then call HAL_I2C_Master_Receive_DMA with the data. Otherwise, you'll need to use the sequential receive functions. See instructions under "*** Interrupt mode or DMA mode IO sequential operation ***" in the HAL I2C source file.

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