2023-05-02 12:00 AM
I'm trying to create a Synchronous communication using a timer and GPIO.
I can toggle a pin-up to 1Mhz inside the main function, but if I try to toggle gpio inside the timer interrupt handler, the max toggle speed is around 300khz. Is there a reason for this behaviour or I'm doing something wrong?
2023-05-02 12:04 AM
Doing something wrong..
You can't interrupt at this speed, you saturate the MCU.
Use the TIM itself to toggle one of its TIMx_CHx pins, either in Toggle or PWM Output modes.
2023-05-02 12:20 AM - edited 2023-11-20 06:42 AM
I've got the same issue with the PWM channel mode... I'm not able to create a PWM faster than 100khz...
I need to create a sort of SPI without having even byte alignment...
The final speed must be 158khz, i need to toggle the data pin before the rising edge of clock.
Something similar to this... using synch serial hardware module, it generate the data not usefull during transmission.
I2C Module hardware protocol coded inside... Any tips?
2023-05-02 12:52 AM
Use DMA for high speed modulation.
For complex patterns at pins consider using TIM+DMA+GPIO to move pattern buffer to GPIO Bank. Either ODR or BSRR.
2023-05-02 03:15 AM
Have you got some example snippet from where i can start?