2017-10-13 9:02 AM
Can someone explain me how to use the 'PeriphInc' in the DMA_InitTypeDef.
I understood that it can read several address (is that right ?), but where I write the start and end adress ?
Solved! Go to Solution.
2017-10-13 2:44 PM
It is pretty simple, but they both need to be within the addressable space of the processor.
An SPI based peripheral is going to get accessed by repetitive reads of &SPI1->DR, an address that ISN'T incrementing.
If the registers in the accelerometer are 16-bit and there are 3 of them, you'd program the DMA to transfer 6-bytes, and you'd be dependent on the external device to 'auto increment' its internal register address.
2017-10-13 10:04 AM
Hi
alexandre.julien
,Taking the example of STM32CubeF7, I checked the
(Description of STM32F7 HAL and Low-layer drivers) where I found following description (p275):uint32_t DMA_InitTypeDef::PeriphInc Specifies whether the Peripheral address register should be incremented or not. This parameter can be a value of DMA_Peripheral_incremented_mode
Please refer to the description of this structure in order to know more about all the fields.
-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.
2017-10-13 1:26 PM
Yes I already read it but in fact, I don't understand what it means. Does it means that I can do multiple reads on several address ? If so, how can I write the start and end adress ?
2017-10-13 2:12 PM
You define the direction of the transfer, and the length in transfer units.
You specify the source and destination addresses using HAL_DMA_Start(), which is the peripheral depends on the direction. It will be the source address in the 'from peripheral' case.
2017-10-13 2:24 PM
Sorry but I still don't get it.
For example :
If I want to do multiple reads (I have an accelerometer and I want to read x,y,z values),
Do I need to configure several DMA or is it possible to do it with only one ?
2017-10-13 2:44 PM
It is pretty simple, but they both need to be within the addressable space of the processor.
An SPI based peripheral is going to get accessed by repetitive reads of &SPI1->DR, an address that ISN'T incrementing.
If the registers in the accelerometer are 16-bit and there are 3 of them, you'd program the DMA to transfer 6-bytes, and you'd be dependent on the external device to 'auto increment' its internal register address.
2017-10-13 2:52 PM
Thank you, that's the answer I was waiting for !