2015-04-16 08:05 AM
Hello,
I'm relatively new to the STM32F4 family but have worked with other microcontrollers in the the past. I'm trying to use DMA to send 8bits of data at a time from a memory array to a GPIO (GPIO_C) using DMA with TIM4 as a trigger. I've played around with the DMA MEM to DAC example. What I'm confused by is: 1) Peripheral (GPIO_C) address. According to the datasheet GPIOC base addr = 0x40020800. GPIOx_ODR has offset of 0x So the peripheral address is0x40020814? 2) How do I DMA 8bits at a time to a 32bit GPIOC_ODR register? GPIOC_ODR is a 32 bit register with only the lower 16 being used. How do I write to lowest 8bits? Or bits 8..15? DMA Init has settings for chunk size.DMA_InitStructure.DMA_PeripheralDataSize = DMA_MemoryDataSize_Byte;
DMA_InitStructure.DMA_MemoryDataSize = DMA_MemoryDataSize_Byte;
But how do I define which portion of the 32bit register will receive the 8bits?
Thank you,
Boris.
2015-04-16 08:27 AM
DMA_InitStructure.DMA_PeripheralDataSize = DMA_MemoryDataSize_Byte; // Peripheral Size!
It's a small endian system writing at +0 gets bits 0..7, +1 8..15You could also use BSRR for dispersed bits.I believe I've posted several DMA to/from GPIO examples, with internal TIM, and external.