Failed to use I2C DMA for STM32F072
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-08-08 2:55 AM
Issue description as below:
1. STM32F072+STM32CUBEMX+FREERTOS+I2C1 DMA
2. I2C1 was set for rx DMA
2. I use HAL_I2C_Mem_Read_DMA() for external device memory reading and it retured HAL_OK,but no data written to DMA buffer , DMA1_Channel2_3_IRQHandler for i2c1 DMA was not entered
3. Then I tried HAL_I2C_Mem_Read() and it read data successfully
4. I have tried HAL_I2C_Mem_Read_DMA() for STM32F105 and data can be read successfully.
My question:
1. why i2c dma read faied to get data from i2c slave for stm32f072?
2. what else should be done for stm32f072 i2c dma read?
3. any difference of i2c usage between stm32f072 and stm32f105?
- Labels:
-
DMA
-
I2C
-
STM32F0 Series
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-08-09 12:39 AM - edited ‎2024-08-09 12:42 AM
Hello @supgz ,
Make sure to enable I2C1 with the right pin & configuration (e.g., PB6 for I2C1_SCL and PB7 for I2C1_SDA).
Enable DMA for both I2C1_RX and I2C1_TX. Enable FreeRTOS with the necessary settings (heap size, task priorities). Ensure that the interrupt handlers for I2C and DMA are properly set up.
Check I2C, clock Speed.
You can follow the I2C examples within STM32F072 device:
In order to make the program work, you must follow the instructions in the readme file.
Have a look at this article which describes general tips related to I2C on STM32 devices:
Thanks
Imen
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-08-11 7:34 PM
Hi Imen:
Thanks for your reply.
1. i2c can read successfully when not using DMA, so i2c hw and sw configuration is OK on stm32f072
2. i2c dma read also successfully on STM32F105, I can't get the difference of i2c dma usage between stm32f072 and stm32f105
