From nobody Tue Nov 18 06:12:19 2025 X-Original-To: freebsd-hackers@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4d9Z5p0wLdz6GVDy for ; Tue, 18 Nov 2025 06:12:30 +0000 (UTC) (envelope-from freebsd-hackers-freebsd-org952@ketas.si.pri.ee) Received: from mail.ketas.si.pri.ee (d004-fea2-0bff-021e-13e8-8437-07d0-2001.dyn.estpak.ee [IPv6:2001:7d0:8437:13e8:21e:bff:fea2:d004]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4d9Z5m6VQnz3vbb for ; Tue, 18 Nov 2025 06:12:28 +0000 (UTC) (envelope-from freebsd-hackers-freebsd-org952@ketas.si.pri.ee) Authentication-Results: mx1.freebsd.org; dkim=pass header.d=ketas.si.pri.ee header.s=ketas-si-pri-ee-20240416002854-4096 header.b=RsZe6T8H; dmarc=pass (policy=reject) header.from=ketas.si.pri.ee; spf=pass (mx1.freebsd.org: domain of freebsd-hackers-freebsd-org952@ketas.si.pri.ee designates 2001:7d0:8437:13e8:21e:bff:fea2:d004 as permitted sender) smtp.mailfrom=freebsd-hackers-freebsd-org952@ketas.si.pri.ee X-Original-To: freebsd-hackers@freebsd.org DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=ketas.si.pri.ee; s=ketas-si-pri-ee-20240416002854-4096; t=1763446340; bh=MWR7IAoFwhcl1aMNcEJS90PplZ3dTcEnSW4emR+yOwI=; h=Date:From:To:Subject:In-Reply-To:References; b=RsZe6T8HNZLR+6f3Zj7H1Mp1yeNgO1Qfbm+vofNysHnvXfuq+DOQw0CVy9wQhliPr hPzQOr08veHi+0Njy/KJdYQJj+6ehxtz6eUIImwLJGOf/1pCGZc+L2p1Kfm2/EaXtK BFtHfDfQ4X+an0oGtvNn6a54vyhzOij86iaMbPQrMrBu47z9ogOw9vqDJWWursSHoN sAg+1C3wZzH8J9ePrEYGRGDAJ68xksfQR/I1PKGj0rm+hP5yQEG6cl+P17mh6/sTyH DfEX5/Dg2UEGBbhpsdjMN6cgP9JYPqJPob05VY+d6Gg+cW5enSzYDDcFkbmcXNK0gg iICtgMeAVF6HteEL99Tz9RGTNmWm+wDJ4t0jo5Mc7VihWd4WDBrWChDNBCZ3jIQRG6 KqvQ6D7Cj73SNoSRWeP7sTYj4UYvoLGfzyx94lUnY+LQM0598lSvK0R23OX3WYuAKQ 3zTRPJwOB92D486nBJX37xQnR+xP87a1wGHidH7vziwIhpPr9sKcmDmVbCIeOxuEFn N32siEwCUrQlPduUzHipnRJQc/NIg/75NJU6Pw1VCQ8TBvF1Z9hRP8hZBxmDh2N2G4 0CkrF6FuT2PQNqoPm+IFG62DJ78rzzsmFbm43DDvScuJYHfwNPaRy7mDOOGHcRImlY SL8bCvGtqZ+bIh4meNLo/R/c= Received: from ehlo.thunderbird.net (0115-0000-0000-0000-13c8-8437-07d0-2001.dyn.estpak.ee [IPv6:2001:7d0:8437:13c8::115]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mail.ketas.si.pri.ee (Postfix) with ESMTPSA id 229EA5C531A for ; Tue, 18 Nov 2025 08:12:20 +0200 (EET) Date: Tue, 18 Nov 2025 08:12:19 +0200 From: Sulev-Madis Silber To: freebsd-hackers@freebsd.org Subject: Re: addressable led driver User-Agent: K-9 Mail for Android In-Reply-To: References: <4DE06290-81C0-4D21-8919-5A39B1DB3949@dons.net.au> Message-ID: <677E3CFD-91A4-4A46-AC15-1CAD49F891F5@ketas.si.pri.ee> List-Id: Technical discussions relating to FreeBSD List-Archive: https://lists.freebsd.org/archives/freebsd-hackers List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-hackers@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spamd-Bar: / X-Spamd-Result: default: False [-0.75 / 15.00]; HFILTER_HOSTNAME_5(3.00)[d004-fea2-0bff-021e-13e8-8437-07d0-2001.dyn.estpak.ee]; NEURAL_HAM_MEDIUM(-0.99)[-0.995]; NEURAL_HAM_SHORT(-0.99)[-0.990]; NEURAL_HAM_LONG(-0.97)[-0.970]; DMARC_POLICY_ALLOW(-0.50)[ketas.si.pri.ee,reject]; R_DKIM_ALLOW(-0.20)[ketas.si.pri.ee:s=ketas-si-pri-ee-20240416002854-4096]; ONCE_RECEIVED(0.20)[]; R_SPF_ALLOW(-0.20)[+ip6:2001:7d0:8437:1300::/56]; MIME_GOOD(-0.10)[text/plain]; RCVD_COUNT_ONE(0.00)[1]; MIME_TRACE(0.00)[0:+]; RCVD_VIA_SMTP_AUTH(0.00)[]; RCPT_COUNT_ONE(0.00)[1]; RCVD_TLS_ALL(0.00)[]; MID_RHS_MATCH_FROM(0.00)[]; MLMMJ_DEST(0.00)[freebsd-hackers@freebsd.org]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; ARC_NA(0.00)[]; TO_DN_NONE(0.00)[]; PREVIOUSLY_DELIVERED(0.00)[freebsd-hackers@freebsd.org]; TO_MATCH_ENVRCPT_ALL(0.00)[]; DKIM_TRACE(0.00)[ketas.si.pri.ee:+] X-Rspamd-Queue-Id: 4d9Z5m6VQnz3vbb On November 17, 2025 7:54:56 PM GMT+02:00, Tomek CEDRO wrote: >On Fri, Nov 14, 2025 at 4:31=E2=80=AFAM Daniel O'Connor wrote: >> > On 14 Nov 2025, at 11:27, Sulev-Madis Silber wrote: >> > i want to create a proper driver together with userland tools to cont= rol all addressable leds directly from fbsd >> > >> > they all have different cursed protocols that don't fit spi at all >> > most popular is ws1812 which would mean if you want actual spi it wou= ld be clockless and this all kind of sucks >> > >> > i found gpiospi=2Ec which is entirely undocumented=2E unsure how to g= et it working, i tried and failed >> >> gpiospi=2Ec does bit banging - I think you will struggle to meet the ti= ming requirements for WS2812 with it unless you do something horrible like = disable all IRQs, send the bit stream and then enable them again=2E >> >> What actual SoC do you have? >> >> For example, the Beaglebone has PRUs which are simple coprocessors whic= h can do this sort of bit banging (I have done it in Linux using LEDScape)= =2E >> >> If you don=E2=80=99t have something like that then SPI is probably the = most reliable but be aware that you have to care a lot about the clock spee= d it uses so if the SoC changes clock speed for power saving it might make = your clock speed wrong (I ran into this in the RPi4 for I2C)=2E > >Yup, very hard to accomplish these timings for WS2812B with GPIO on >MCU, especially when some sort of RTOS + SDK is in use=2E Usually SPI or >RMT peripheral is used to generate these pulses with correct timings=2E >The smallest and cheapest MCU is AtTiny series but not much >peripherals=2E Also note that "bare" WS2812B needs 5V on the data line, >but WS2812B-MINI works with 3=2E3V data logic :-) > >On the other hand I found some "AURA LED Controller" on my >motherboard=2E It shows up as the USB Device: > >% usbconfig -d1=2E2 dump_device_desc >ugen1=2E2: at usbus1, cfg= =3D0 >md=3DHOST spd=3DFULL (12Mbps) pwr=3DON (16mA) > > bLength =3D 0x0012 > bDescriptorType =3D 0x0001 > bcdUSB =3D 0x0200 > bDeviceClass =3D 0x0000 > bDeviceSubClass =3D 0x0000 > bDeviceProtocol =3D 0x0000 > bMaxPacketSize0 =3D 0x0040 > idVendor =3D 0x0b05 > idProduct =3D 0x19af > bcdDevice =3D 0x0100 > iManufacturer =3D 0x0001 > iProduct =3D 0x0002 > iSerialNumber =3D 0x0003 > bNumConfigurations =3D 0x0001 > >Maybe this is the best generic way to support these leds over USB and >let some dedicated hardware (i=2Ee=2E STM/ESP/whatever has USB) do the >rest? And maybe there is already some standard protocol? > >-- >CeDeROM, SQ7MHZ, http://www=2Etomek=2Ecedro=2Einfo > judging from https://openrgb-wiki=2Ereadthedocs=2Eio/en/latest/asus/ASUS-Aura-USB/ these are simply uc's but yeah i can't choose one=2E there are tons of them=2E all that hw is to= o complex but i don't want to buy anything ready made either unfortunately if i want to max out the ws2812 features i need beefy uc=2E = likely over usb=2E and run into same issues there too with having to use dm= a and whatever=2E it's fast enough data that one needs that eh=2E together = with pcb, that uc costs some fraction of full sbc cost but that's fine=2E o= r maybe it's because bigger socs have gotten so powerful and cheap i wonder if i could use something with some actual open rtos in it so it w= ould be understandable=2E or i could use some of that existing led driving = code that's around what i image i will be doing is like make_data > frame=2Ecurr cp -a frame=2Ecurr frame=2Eout led_bitbanger --data frame=2Eout --device /dev/ws2812 --0-bit-high-time 35= 0ns or so unfortunately in order able to get so simple, there needs to be ton of com= plex stuff below it=2E i image dma memory update part being like cp here if all hw would come equipped with realtime cores as standard issue, it wo= uld be easy i guess and likely would also need my first actual scope or logic analyzer so i ca= n actually see what's on lines=2E dso138 doesn't help also, i tried to get hw spi working in h3 but apparently it won't work=2E = if it would even help me=2E like unsure what speed uart apparently won't support those speeds after trial i actually have mpsse hw around, provided this possibly fake device even w= orks as specified otherwise i have to get uc of some kind i don't know after all eh while there, i found https://cpldcpu=2Ecom/2021/02/27/the-transistorpixel/ https://github=2Ecom/cpldcpu/Gen2-Addressable-RGB/blob/main/docs/Gen2_ARGB= _protocol_analysis=2Emd and others so in the end i need uc after all system layout ideas i got from https://bitlair=2Enl/Projects/Ohm_led_strip_sleeves it was also awesome to look irl there they didn't have any local code at all=2E init / no signal was low i= ntensity white in the end i did write ws2801 controlling code but now i have issue where = i can't simply control it with ways i'm used to i heard about bad methods like disabling interrupts=2E what would it do? w= ould it freeze the system for a moment? i mean there is nothing important r= unning in that anyway=2E unless this also makes ssh unusable=2E all the eve= n cheapest socs have multiple cores, so why it can't be running on it's own= core? that would make my life simpler by not using extra hw=2E bbb actuall= y allows it but somehow we don't like it here anymore yes, using uc makes me absolutely free=2E i can choose uc i want and conne= ct it where i want, as usb and serial are everywhere=2E to be honest i coul= d just use ethernet enabled uc but that doesn't feel so cool actually many those custom solutions pass the official stage lighting stan= dards in fps=2E which is logical as dmx was never meant for this i actually don't have much interest in spending time sequencing stuff eith= er kind of like, i want to run things on them=2E put them eg on a tree outsid= e, connect them up, not having to think how many leds each controller got o= n it=2E tho, have to put power there according to led consumption=2E then t= ake editor and start playing with values=2E like what happens if i send eve= ry 10th led an increasing value from 0 to 255, then decreasing from 255 to = 0=2E update 60 times per second something like that