Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 08 Dec 2025 03:34:14 +0200
From:      Sulev-Madis Silber <freebsd-hackers-freebsd-org952@ketas.si.pri.ee>
To:        freebsd-hackers@freebsd.org
Subject:   Re: addressable led driver
Message-ID:  <5466CDBA-3F6C-439B-96A8-C00B81DE65EB@ketas.si.pri.ee>
In-Reply-To: <CAFYkXjmGGZvktskrY8XRc20mtwyhTJrQpAf-82HjddvVg5Fxhw@mail.gmail.com>
References:  <BB74B308-9501-4DA0-89E9-4DA0AE553AA5@ketas.si.pri.ee> <4DE06290-81C0-4D21-8919-5A39B1DB3949@dons.net.au> <CAFYkXjnqqfmO7zWv4-diFa99ZsDc2Dor2DK4qowLzhh_=a=v8g@mail.gmail.com> <677E3CFD-91A4-4A46-AC15-1CAD49F891F5@ketas.si.pri.ee> <CAFYkXjmGGZvktskrY8XRc20mtwyhTJrQpAf-82HjddvVg5Fxhw@mail.gmail.com>

index | next in thread | previous in thread | raw e-mail

ok, in the end i decided to write my own control program in perl which feeds spi(8)

i also got 2 spi buses enabled on my h3, via fdt fiddling. one of which i used as that's what i have on headers on that custom dev carrier pcb of nanopi neo core

in the end i am indeed able to control addressable leds directly from embedded fbsd machine

so i postponed to uc approach so far. the atmega328p got is probably too weak for my use and maybe i need stm32* usb booting uc. same price

sor far all work except spi(8) has no stream mode and my attempts to implement it in it failed. i liked code quality in it, but i just don't know c enough

attempts to ioctl transfer data directly from (another) perl found hurdles of not able to get needed constants with needed values, despite .ph's exist and they do have them in them

so i went worst approach and just run spi(8) in a row as fast as it could. the perf is awful. the ability to get 4fps per 1000 leds is impressive. i also had sh in loop there. the data generator got impressively fast after few optimization runs. some of which were also powered by chatgpt, altho i later got better than those ideas. tools, right

wasn't able to find much useful spi(gen) examples

all attempts are in

http://ketas.si.pri.ee/misc/ws2812/

the code there actually works

maybe someone here wants to implement constant running mode in spi(8). i don't know what spi(8) is intended to. probably not what i do. however i imagine this stdio ipc way could also could be useful in other things that need constant spi comm. i never checked if i2c util would also need this. this could simplify usage from scripts like i do. maybe gpio also needs that. i recall writing small c wrappers which watched for interrupts on pins

i found also some python code for leds under fbsd that did spigen too. but having python also running somewhere is hmm. also need to somehow implement stdin there

so in the end i did almost accomplish my dream, wrote driver of a kind and even fade works. debugging was quite easy as i could keep scp'ing files to tmpfs and executing them


help

Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?5466CDBA-3F6C-439B-96A8-C00B81DE65EB>