2023-07-27 08:00 AM
I'm trying to to generate a PWM signal on a GPIO without PWM capability on a STM32F47. To achieve this, I want to have a timer triggered DMA transfer to the GPIO BSRR register.
Looking at the bus matrix, it seems that I need to use the DMA2 controller to transfer memory to the GPIO registers, because the GPIOs are on the AHB1 bus. Is this correct?
If I want to use the DMA2 controller, I guess I need to look at the streams in the DMA2 request mapping. From there it seems that I can only use TIM1 and TIM8 to trigger DMA transfers to the GPIO peripherals. Is this correct - or do I have more flexibility?
Solved! Go to Solution.
2023-07-27 08:28 AM
Yes and yes, you are limited to TIM1/8. Other timers are on a different bus.
2023-07-27 08:28 AM
Yes and yes, you are limited to TIM1/8. Other timers are on a different bus.
2023-07-28 12:21 AM
Thanks, I managed eventually. This was one of the pitfalls I fell into, the other one was having the memory address in the CCM memory instead of SRAM1/SRAM2.
Another question (or should I open another ticket?): I have the timer in upcounting mode and trigger a DMA request and use a circular buffer as source memory which "encodes" the duty cycle. Could I also trigger DMA with the timer in PWM mode? I would need to transfer data to the BSRR on the counter overflow and on the capture/compare. Would I need to set up two DMA streams, one for the TIM8_UP and one for TIM8_CHX?
2023-07-28 02:27 AM
> I would need to transfer data to the BSRR on the counter overflow and on the capture/compare. Would I need to set up two DMA streams, one for the TIM8_UP and one for TIM8_CHX?
Yes. But why?
JW
2023-07-28 03:17 AM
Because the pin I want to use can't be PWM'ed, so I need softPWM. And setting up the Timer as PWM and trigger a DMA transfer for high and low makes more sense to me than running over a circular buffer.
2023-07-28 04:43 AM - edited 2023-07-28 04:45 AM
That makes sense.
Which pin, exactly?
JW
2023-07-28 04:51 AM
PE8. Which I am aware that it can be used as TIM1_CH1N. But the problem is that TIM1 is already used to generate another PWM, so I can't use the TIM1_CH1N alternate function on PE8.