Thanks @hzeller, I didn’t even think about that as I was fixated on getting the mirroring ‘for free’ like I do with smartmatrix (however it outputs its bitplanes, using mirror out of a panel, really does work, no refresh speed lost).
When you say “it might cost some refresh rate”, I’m confused: isn’t it guaranteed to divide the speed by 2?
Not necessarily, only when clocking in the data is the vastly dominant part of the time spent. Typically though, that is waiting for the longest pulse, so the data clocking would otherwise be idle. But in a long output enable pulse,
you can clock in more data while the pulse is still ongoing. Longer panels tend to be more dominated by the clock time.
In your case you use a very few pwm bits, and you have a long panel (in terms of data to be pushed) so you probably spend most/all your time clocking data, so in your particular case you probably will see about half speed.
If you try this with the standard pwm bits, you see that your refresh will go down a smaller fraction.
Now, when you say PWM is not possiible, I’m confused:
Let’s say we have 4bpp, with PWM I can have 16 interrupts of the same length (let’s say 1ns) and a value of 15/15 means you keep the LED on all 16 times. If you want 9/15, you keep it on 9 interrupts out of 15 and so forth.
Mmh, so yes it could work for smaller PWM bits on also smaller panels.
Clocking in the data is the dominant time you spend. Let’s take your 128x64 panel above.
Say we can get data 25Mhz clock speed on a panel with 128 pixels across: then clocking in one row is about 128/25Mhz = 5.12μs.
That is essentially now your led-pwm-lsb-nanoseconds … 5120ns.
(The way the panels are constructed, we can in the meantime output-enable the previous clocked in row, so we don’t loose
any time now switching it on. good.)
For 7 bit, you have to clock that in 128 times, so about 655μs. For the usual 11 bits, that would be 10.5ms.
Now you have to do that 32 times (if your panel is 64 pixel high), so about 20ms total time or 48Hz refresh on 7 bit (335ms; 3Hz refresh on 11 bit…)
So even with only 7 bit, it would already create an unusable frame-rate, let alone 11 bit… With only 4 bits however, you could reach about 380Hz, which might be doable.
The advantage is now, that all timing pulses are the same length, so if you chain things the way you’d like to do, showing the previous data in the shift register will not result in color artifacts.
Anyway, unless you really show line-graphics and no images, low PWM bits are not resulting in a good image.
BCM saves interrupts because the first interrupt is 8ns, the 2nd one 4ns, the 3rd one 2ns, and the last one 1ns, and you can still get all 4 bits of resolution, which is what you do.
But what’s wrong with going back to 16 interrupts of 1ns per scan instead of 4 interrupts or 8, 4, 2, and 1ns?
(Note the dominant time is clocking in the data, so 5120ns is now your LSB)
As shown above, with very few bits (<< 7), it might result in an ok refresh rate, but with a image-quality usable 11 bits, you have (2048-11)x the load…
Doing that would ensure that the bits shifted out look just as good on chained panels, and still keep the original 400Hz refresh rate.
Well, with your example above with the 7 bit setting you’d get 48Hz, not 400Hz. But that would stay constant, indeed
I agree though that it’s a non trivial code change that would probably only be useful to me
Code change is probably not too hard, but it is so limited in use (small panels, low bit count), that I am not sure if it is worthwhile.
It might result in brighter panels overall though, as now our lsb nanoseconds is 5120ns, so less switching issues and less super-short pulses on OE.
One problem with this however will be, that you now use 100% CPU all the time, which will not make the kernel happy (and result in regular glitches).
In the other case, we have a time to relax at least in the msb-ish bit planes as we then dominate in waiting.
The only thing I’m confused about is that SmartMatrix on teensy/ESP32 does BCM I’m pretty sure, and yet its output can be chained into another panel and looks just about as good.
They might not overlap clocking in data with pulse output from the previous row, which might result in slightly more viewable result, albeit slower refresh.