cancel
Showing results for 
Search instead for 
Did you mean: 

Can DMA be used by an I2C slave to reply to an I2C bus read?

BCoch
Senior

I'm using STM32CubeMX (5.0.0) and Atollic TrueSTUDIO (9.2.0) to implement I2C slave functionality on an STM32F3 series microcontroller. I am able to get the DMA to work accepting bytes from an I2C write command, but can't seem to get the DMA to provide the data for an I2C read command.

I don't see any examples where DMA is used by the slave to provide transmit data. Is this possible, or is the I2C TX DMA only for master mode?

Thanks.

1 ACCEPTED SOLUTION

Accepted Solutions
Amel NASRI
ST Employee

Hello,

There are several I2C examples in the STM32CubeF3 package. DMA can be used either for data transmission or reception thanks to the 2 APIs:

  • HAL_I2C_Slave_Receive_DMA
  • HAL_I2C_Slave_Transmit_DMA

Both of them are already used in the example STM32Cube_FW_F3_V1.10.0\Projects\STM32303C_EVAL\Examples\I2C\I2C_TwoBoards_ComDMA.

A description of the example is provided in the readme.txt file.

There is no TrueSTUDIO dedicated example in the package, but it is easy (almost automatically done) to migrate the SW4STM32 project to TrueSTUDIO.

-Amel

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

View solution in original post

2 REPLIES 2
Amel NASRI
ST Employee

Hello,

There are several I2C examples in the STM32CubeF3 package. DMA can be used either for data transmission or reception thanks to the 2 APIs:

  • HAL_I2C_Slave_Receive_DMA
  • HAL_I2C_Slave_Transmit_DMA

Both of them are already used in the example STM32Cube_FW_F3_V1.10.0\Projects\STM32303C_EVAL\Examples\I2C\I2C_TwoBoards_ComDMA.

A description of the example is provided in the readme.txt file.

There is no TrueSTUDIO dedicated example in the package, but it is easy (almost automatically done) to migrate the SW4STM32 project to TrueSTUDIO.

-Amel

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

BCoch
Senior

Hi Amel,

Thanks very much for your answer. I had neglected to mention that I would prefer to use only the low level interface, but the high level examples at least indicate that it is possible, and should provide sufficient info.

Happy New Year!

Bruce.