I have a Framework 16 running Ubuntu 25.04 (Linux 6.14.0-15-generic, KDE Plasma 6.3.4).
I recently got an LED matrix module, and I have written a simple script that generates an image based on certain settings, and then sends it to the matrix with ./inputmodule-control_cli_linux led-matrix --image-bw led_image.png
. This works fine, but a minute later, the LEDs all turn off, which I don’t want them to do.
When they are lit, the system (reasonably) reports that it isn’t sleeping:
$ ./inputmodule-control_cli_linux led-matrix --sleeping
Currently sleeping: false
After they turn off, I was expecting it to tell me it had gone to sleep, but instead I get this:
$ ./inputmodule-control_cli_linux led-matrix --sleeping
thread 'main' panicked at 'Found no data!: Custom { kind: TimedOut, error: "Operation timed out" }', inputmodule-control/src/inputmodule.rs:446:14
note: run with RUST_BACKTRACE=1 environment variable to display a backtrace
This also makes the LEDs light up again.
Does anyone know why it might be turning off? What can I do to prevent this from happening?
Thanks.
The firmware expects something to keep writing to it. So your options are:
- modify the firmware to disable the 60 second sleep timer and flash it to the led matrix.
- keep sending the image to it on an interval to keep it awake using the same demo program.
- write a proper program to write to it how you want, instead of just using the demo program Framework gave us.
3 Likes
Thank you for this.
Can you expand on #3? Is there an API or documentation I can refer to?
1 Like
I think it’s all here:
I haven’t delved into them much as I have the RGB ones as well and prefer those. But a few people have written apps to use the gray-scale modules for system statistics and such.
2 Likes
Thanks for this. I don’t know if I’d say it’s all there, as almost every entry is simply TODO, but I managed to figure out enough to address the LEDs directly rather than creating a pixelart image and importing that, so that’s an improvement.
It still shuts off after a minute, though.
1 Like
Where did you find info on how to set the LEDs directly? I’ve looked all over, and I don’t see any info on that. I see some programs that address pixels directly, but I haven’t figured out how to reverse engineer them and get the command and parameters figured out.
The link that Jared Kidd provided gave me enough to start experimenting, in particular the details here. The key points here are commands 0x07
(StageCol) and 0x08
(FlushCols).
For StageCol
you want to send one byte defining the column you’re addressing (0x00
to 0x08
), and then 34 bytes defining the brightness of each LED from top to bottom.
Once that’s done for each column, calling FlushCols
will send that information to the LED matrix. Note that this wipes the data that has been staged, so if you stage one column, flush it, stage another and flush it again, it’ll only light LEDs in the second column.
There may well be a better way to do it, but that worked well enough for my purposes.
1 Like
I pushed the code I wrote to github.
The key points here are lines 38-58, which define each individual column and stage them; and 93, which sends the data to the LED matrix.
I strongly recommend having some kind of testing structure in place, so you can see what data is going to be sent without actually sending it, because sending values which are out of bounds (too many rows or columns, for example) will crash the matrix, and you’ll need to remove and re-seat it before trying again, which is tedious.
2 Likes
Thanks, that’s very helpful! I think this is exactly the info I needed to get started.
1 Like