First, a bit of a tangent:
It might work since 746zg is very fast. Generally, you have here 3 levels of libraries. The lowest are ARM_LL (low level) that works on the registry level. To write code that you really need to look into datasheets and what registers do what. The fast lib for the example you linked in the original post was written this way.
on STM next level up are the HAL libraries - Hardware Abstraction Layer. Much simpler, but still powerful. The code uses LL in the background.
And then you have Mbed libraries, that use HAL in the background - even simpler, but slower, and less powerful. (I haven’t worked much with timers in Mbed, but an example is that STM supports level inversion on USART, Byte inversion, and some other features that are not supported in Mbed Serial).
What I see with the timers is, that generally on STM, not every pin is PWM capable. There is some select number of pins that are connected to the Timers, and those timers can output directly to the Pin.
What I think the Mbed does is have one timer, and use interrupts to toggle the digital out value of GPIO pins - this is slow. Using Timers the output is independent of Code execution, but using interrupts the code needs to halt every so often to change pin outputs.
But, Generally, for a 216 MHz device, you may be fine. If you want to dwell deeper here is a link General-purpose timer cookbook for STM32 microcontrollers.
Now, bask to this.
Few recommendations will help you debug.
- Your pulse width is larger than the period.
- Keep in mind that you don’t need “just” the pwm, you need to create the high-level signals with precise low-level pulses, like this.
And the zero position is important.
I would follow the bring up procedure from the video:
- Start without pixel drawing - just output the Hsync and Vsync and see if the monitor recognizes the resolution. One of the potential problems I see is that your Hsync and Vsync aren’t, well synced.
at the begging of the frame, they start both at zero, but one Vertical period is equal to 627.6515 Horizontal periods. that means that the first frame will start OK, at the beginning of the next one the Hline won’t be at zero, but at 0.6515 of the period - you need to sync them up at the beginning/end of the frame.
- Maybe start with a lower resolution first? just as a sanity check.
- Then start first changing the colors of the full-frame, each frame, then change the color of the lines and then change pixels.