2018-05-31 01:48 PM
Hello, first of all pardon my ignorance, I'm a little new to STM32 development. We are working on a project on an STM32F769, and my EE has asked me to generate a fairly fast (20mhz) clock output on a specific pin (PD2). None of the 'alternate functions' of this pin relate to a timer (e.g., some examples route a PWM out of a certain GPIO via alternate function), so I think that means I need to handle an interrupt and toggle the output, right? Or is there another way to route a signal out a specific GPIO via hardware?
If/when i handle it in software (handle the timer interrupt and toggle the output), it's so fast that I'm afraid I'm going to load my CPU. Are there any best practices out there to avoid this?
Thanks for any advice.
#gpio #timers #stm32f72018-05-31 01:55 PM
20 MHz is too high for interrupts. What is the purpose of doing this? Is it required in the final application or just to test something? Or work through a design issue while you respin the board properly?
I'd probably use TIM+DMA+GPIO to bang a pattern &GPIOD->BSRR (0x00000004, 0x00040000, repeating)
Could you just find 20 MHz some place else and use wire?
2018-05-31 02:00 PM
The plan is to eliminate the need for this in final, but he is not 100% confident it can be eliminated.
So that would be, configure a DMA stream to write from memory to peripheral, iterate between two patterns in memory written to the output register? That's ingenious... however wouldn't it also write to all other pins on the same port? Pretty sure we couldn't have that, we are very tight on GPIO.
2018-05-31 02:23 PM
Ok I lit a fire. Got him to switch to PA2 (with a slight mod), which has an alternate function for TIM2_CH3. Thanks so much Clive One.
2018-05-31 04:03 PM
BSRR is Bit Set Reset Register, not the ODR, you can direct the signal to a single bit with a 32-bit wide pattern, the DMA is circular and thus repeating.
>>That's ingenious...
I'm an EE that does CS
2018-05-31 04:07 PM
>>The plan is to eliminate the need for this in final, but he is not 100% confident it can be eliminated.
I'd light a fire to make sure it got fixed. Heck use a 20 MHz HSE and push out of PA8, or a small 20 MHz XO and share output.
What's special about PD2? Find an LED you're driving with a GPIO/TIM pin and redeploy it