daveythacher / LED_Matrix_RP2040

GNU General Public License v3.0
1 stars 2 forks source link

Add support for traditional PWM for small panels. #1

Closed daveythacher closed 1 year ago

daveythacher commented 1 year ago

Add support for traditional PWM for small panels with reduced color depth. Panels smaller than 32x32 with no more than 10-bit contrast in single scan.

daveythacher commented 1 year ago

This is possible because of the RP2040's CPU enabling processing on the panel. Sending bit planes would consume too much bandwidth for traditional PWM. Using BCM would save bandwidth, but in certain cases BCM is not recommended. The difference is (2^x)/x.

daveythacher commented 1 year ago

This is mostly in there. No testing done, but the concept is there. The CPU is likely stressed more with this approach, I have not fully tested the exact limits. May just close this out without it.

Simple change since BCM was already using traditional PWM period. The operation is like BCM, the lower (1 << PWM_bits) - 1 bitplanes are sent while the last one is zero. The only difference is increase computation and memory consumption for one rising edge per period. This should help with duty cycle or brightness on displays with a small amount of capacitance on the column traces.

There is probably not enough memory or computaton in the RP2040 for scrambled PWM and because of this the frame latency should always be good. (Serial bandwidth divided by memory means good frame latency.) Note the point of this change is to reduce rising edges, which scrambled PWM would increase. Therefore I cannot justify adding scrambled PWM on this device. This can be found on GEN 2 and GEN 3 drivers, support will be there instead of GEN 1. GEN 2 can only use it in low multiplex.

Serial interface targets a FPS of 30, which is plenty for 100Hz min refresh. The traditional PWM/BCM syncs on 10mS edges while frames arrive on 33mS edges. Scrambled PWM is not required. If we were doing 60-120 FPS this would be worth it. Again UART and CPU may not be rated for this in an economical way. This project does scale well beyond certain displays and the RP2040 is the only reason this many features exist at this price point.

daveythacher commented 1 year ago

Scrambled-PWM makes sense for hardware. Larger notions of PWM bits aka GEN 2 and GEN 3 panels. It allows you to escape the GCLK sequence. Then come back later on. VSYNC is global reset command. So the prediction of this is an increase in refresh rate.

It is used to promote a single data unit with variable PWM bits using the same hardware. GEN 1 does this in software so there is no real need. S-PWM is for hardware PWM.