cancel
Showing results for 
Search instead for 
Did you mean: 

Multiple reads using DMA

sincoon
Associate II
Posted on March 30, 2016 at 13:14

Does DMA has FIFO buffer of commands? My task is to read multiple bytes from different registers via I2C

alternately. Could I just write like this:

/*Somewhere in code....*/
HAL_I2C_Mem_Read_IT(&hi2c2,
(uint16_t) DEV_ADDRESS,
(uint16_t) REGISTER_1,
I2C_MEMADD_SIZE_8BIT,
(uint8_t *) buf_1,
6);
HAL_I2C_Mem_Read_IT(&hi2c2,
(uint16_t) DEV_ADDRESS,
(uint16_t) REGISTER_2,
I2C_MEMADD_SIZE_8BIT,
(uint8_t *) buf_2,
6);

And then catch callbacks. Or maybe there is prettier way to read from two registers? #dma
2 REPLIES 2
Posted on March 30, 2016 at 13:58

Doing chaining or scatter- gather operations with DMA would need to be managed in software.

I2C generally implements register auto incrementing in the device so that consecutive groups can be read or written in a burst.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Walid FTITI_O
Senior II
Posted on March 30, 2016 at 17:39

Hi sinitsin.artyom,

I suggest that you use the DMA burst for multiple DMA read. Check the relevant reference manual and try to run a DMA burst example in the

http://www.st.com/stonline/stappl/productcatalog/app?page=partNumberSearchPage&levelid=SC1169&parentid=1897&resourcetype=SW

library dedicated to your device.

-Hannibal-