Author Topic: STM32F0 timers and adjustable delay before DMA burst  (Read 3463 times)

0 Members and 1 Guest are viewing this topic.

Offline voltsandjolts

  • Supporter
  • ****
  • Posts: 3778
  • Country: gb
Re: STM32F0 timers and adjustable delay before DMA burst
« Reply #25 on: May 31, 2026, 01:12:46 pm »
 

Offline PsiTopic starter

  • Super Contributor
  • ***
  • Posts: 12634
  • Country: nz
Re: STM32F0 timers and adjustable delay before DMA burst
« Reply #26 on: May 31, 2026, 01:23:13 pm »
FFS, CubeMX you piece of shit.
Can the Cube.
Go bare metal ;D
https://github.com/ataradov/mcu-starter-projects

Yeah, it was only a test project to try out a few different ways of doing things and seeing what worked.
I was expecting cubemx would save time, i was wrong.
« Last Edit: June 02, 2026, 11:06:07 pm by Psi »
Greek letter 'Psi' (not Pounds per Square Inch)
 

Offline wek

  • Frequent Contributor
  • **
  • Posts: 591
  • Country: sk
Re: STM32F0 timers and adjustable delay before DMA burst
« Reply #27 on: June 02, 2026, 12:57:46 pm »
What is "10us burst of DMA to GPIO"?

JW
 

Offline PsiTopic starter

  • Super Contributor
  • ***
  • Posts: 12634
  • Country: nz
Re: STM32F0 timers and adjustable delay before DMA burst
« Reply #28 on: June 02, 2026, 11:11:42 pm »
What is "10us burst of DMA to GPIO"?

JW

A DMA copy Memory-to-GPIO with 10us of width between gpio pin state changes. (100khz DMA transfer).

(Its actually ended up being 35khz now, but yeah, that's what I was meaning when i said that)
Greek letter 'Psi' (not Pounds per Square Inch)
 

Online aeg

  • Frequent Contributor
  • **
  • Posts: 458
  • Country: us
Re: STM32F0 timers and adjustable delay before DMA burst
« Reply #29 on: June 03, 2026, 12:42:13 am »
When you say "burst" do you mean a single DMA transfer, just one write to the GPIO register?!
 

Offline PsiTopic starter

  • Super Contributor
  • ***
  • Posts: 12634
  • Country: nz
Re: STM32F0 timers and adjustable delay before DMA burst
« Reply #30 on: June 03, 2026, 09:08:03 am »
it's around 11 DMA writes to do burst of digital data I need on the gpio.

I currently have it working on STM32F072 more or less. There is some miner jitter which i think is just interactions with the bus when multiple DMA transfers want to happen at once but can't, so one has to wait.
I'm using all 7 DMA channels that the F0 has. 1 was already used for ADC, 4 are for DMA writes from 4 timers,  and 2 are used for a single byte DMA write on compare match to start 2 of the timers. The other 2 are started by an external link between CC output pin and edge detector trigger input pins.

Funny thing is you can't actually do it on the STM32F407 dev board i have because only 2 timers have access to GPIO via DMA.
(Only 1 of the DMA controllers has access to that bus).

But for now, it's working on the STM32F072 well enough for me to proceed to the next step.
I may come back to this later and try a different approach using 4 SPI outputs.
« Last Edit: June 03, 2026, 09:11:08 am by Psi »
Greek letter 'Psi' (not Pounds per Square Inch)
 

Offline pcprogrammer

  • Super Contributor
  • ***
  • Posts: 6102
  • Country: nl
Re: STM32F0 timers and adjustable delay before DMA burst
« Reply #31 on: June 03, 2026, 05:39:41 pm »
I may come back to this later and try a different approach using 4 SPI outputs.

That was my first thought when I read:

it's around 11 DMA writes to do burst of digital data I need on the gpio.

It needs 4 SPI interfaces of course, but has less traffic on the bus.

Offline PsiTopic starter

  • Super Contributor
  • ***
  • Posts: 12634
  • Country: nz
Re: STM32F0 timers and adjustable delay before DMA burst
« Reply #32 on: June 04, 2026, 03:20:05 am »
I may come back to this later and try a different approach using 4 SPI outputs.

That was my first thought when I read:

it's around 11 DMA writes to do burst of digital data I need on the gpio.

It needs 4 SPI interfaces of course, but has less traffic on the bus.

Yep but afaik no STM32 F0,F1,F2,F3 have 4 SPI outputs, would have to move to F4/F7/H7 which is kinda overkill unless its the only option

One DMA and 3 SPI might be an option though.

Also SPI makes it a bit more tricky. I want to generate 4 separate busts of digital data, however the first pulse is at a different voltage level to the rest.  Using DMA to GPIO makes it easy because I can use 8 GPIO outputs to generate 4 data bursts that can have two different voltage levels.  But I think I can probably use 4 compare outputs for the first pulse and SPI for the rest. So might be doable.
« Last Edit: June 04, 2026, 04:27:29 am by Psi »
Greek letter 'Psi' (not Pounds per Square Inch)
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf

 

-->