2016-03-30 04:14 AM
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
2016-03-30 04:58 AM
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.2016-03-30 08:39 AM
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 library dedicated to your device. -Hannibal-