I wonder how you can achieve that a GPIO pin accuratly toggles according to a certain pattern. This pattern is fully variable (no PWM) and is stored in memory.
My conclusion of this is:
- The pin has to be set/reset by hardware, not in an ISR
- DMA is needed for data transport
What I have in mind:
- Upcounting Timer
- DMA Channel for updating ARR with pattern data
- Compare Channel for toggling pin
- Second DMA Channel for updating the compare channel register with same pattern data at the same time
Could that work? Or is there an easy way to do this?
If this works, could I use a second compare and a third DMA channel to toggle another pin invert to the first one?
Facts and requirements:
- A 72 Mhz Crystal drives the STM32
- Minimum pulse is 10 us
- Tolerarable Jitter is less than 100 ns
- Duration of longest ISR is greater than 100 ns