From nobody Mon Nov 17 17:54:56 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 4d9Fl844z6z6Gg1P for ; Mon, 17 Nov 2025 17:55:16 +0000 (UTC) (envelope-from tomek@cedro.info) Received: from mail-yw1-x112e.google.com (mail-yw1-x112e.google.com [IPv6:2607:f8b0:4864:20::112e]) (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 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "WR4" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4d9Fl74JmGz3mWk for ; Mon, 17 Nov 2025 17:55:15 +0000 (UTC) (envelope-from tomek@cedro.info) Authentication-Results: mx1.freebsd.org; dkim=pass header.d=cedro.info header.s=google header.b=OG1F3eHk; dmarc=none; spf=none (mx1.freebsd.org: domain of tomek@cedro.info has no SPF policy when checking 2607:f8b0:4864:20::112e) smtp.mailfrom=tomek@cedro.info Received: by mail-yw1-x112e.google.com with SMTP id 00721157ae682-71d6014810fso36686847b3.0 for ; Mon, 17 Nov 2025 09:55:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cedro.info; s=google; t=1763402110; x=1764006910; darn=freebsd.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=iHyOtho8dmvvGMjuw1e049sYk73Px2+M0vhp3nHZ7wo=; b=OG1F3eHkw7v0fYZnBM7ERsGImYGwXWGSPpuX+6ekKXYjnct4PWzof60ZkoRApJyIRn Fxt+jBhpcwhGn5/mPEHVJ0zEXZbmB+MGW77oylJ8kaCmWhClNEZTu11/PvQLAZYibk+m f6s+NGEN4IAdtW92ysOxoIbT0ZwjBOL6tFzSE2c+HOmhmsbsOTq1ZmydYM881PS6Rrrw u8CXDshCf/TQE2hnGI/W+mCZqs0+niIskhmsX5iIz+WY95Z/g0Ua93c8YvcLayMZJ1U6 mmmAEk9UL/S5XQw45LQ1t1zhDhM4pKs/KDNys+v05NpP/WbYCKfayztQq+D/R9P8e4k7 VZRw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1763402110; x=1764006910; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=iHyOtho8dmvvGMjuw1e049sYk73Px2+M0vhp3nHZ7wo=; b=CGZbfWQQligVU0T2rTs65ooUMV0qOb3NJCJpsioussazhd4+rrv65dG7E8feKL1tyd G7qUAIOyhucXBby2bTvxGrDqBwDUfcgeVfBANJGfzTVZIFrdt+Y/DoOQv9hh32hmHlWL wKOf9doZLtgWsgDpw0BPiEphTHi0A+YWoFCzIrLvqbBAIVu5cV+XC2TXA81HpwrUt2vH wfQbm1YrrGYQXM2SYu1iBLmvdfZk3Xp+ErMa81WRi9JNRJiRdDeJDnGOLx/VZIP9c5A7 kbh/yFeVA8Hm8qBkmIvI4l+SEwKNGuuu6v1bA415C0fd4NaF8Q+MIJTeRqFPFhW8aLZs wSww== X-Forwarded-Encrypted: i=1; AJvYcCUMbnaXIoxzE2IxI94nF5BGsypQKWUCHp82RM2hrVCTRYkrxzq1YdMFbwE78GwX5o336K9k62u3DLVDEDLDWaY=@freebsd.org X-Gm-Message-State: AOJu0YxQru5xYHri1N2Yo1Ay6XUaeFo1gtI2yLcR7uG88lg9QnDLUorQ WVxa5yWO5iDYOcrO/v+BkiAm+IbXilhn5kMoURh7ph762tgVTVZX19MrmQIifYjytM4rW7/oh84 n1oA= X-Gm-Gg: ASbGncv87zdOhDppl2tSzUvA/j3NHcfjka7n5sr3BsLG0dpB7ICx/iHB0IM2JL0u80N eRUnWsIl96Osmm+fK8uLN+VvFgiBCcLR1JN49I5ufSuS24S6orHzsGuhsYzuTaYSJoKr8a0JJVv TELR035UJDMLIg9WCG5GbEAo5zleizvcsgXcJWpr1zV4liEgRTLGAaytYSE3YoxVABMlIWS2EgL IinGYTigQqhNsFo41zOTlGCmnXYAL8dCBAz51M242GqYezHpmoWKkna9eHKlCv/vJeW2wx1QMDE WnnGZ556bT1F1t0QdeDzowMVbJ4ZUJLCTYrkB+SQHWgVUueQKT0YGn7nnq0K50Y1YSNDRkqixSp Ymi0AI/tKU58t9E8p9QEGoJqFH5fcqEmAukbo5HVbc0+co7ltTCVDQYZwpWdA1kcidpDV7iVL9B gGeG4ISQOl+dZYf1h02Nch2wjmyfzXByU7u3/hAytSZpq5iwfI+94PvA== X-Google-Smtp-Source: AGHT+IH+WI7+EQyjc9gGqb2AVC2VEFySo+1CmVfEHMsd96Fu8yMY/AlcUxBbJ6Epo4Dt3G1SAfxFhg== X-Received: by 2002:a05:690c:9c0e:b0:788:c07:25d0 with SMTP id 00721157ae682-78929e2fd08mr132860697b3.16.1763402109631; Mon, 17 Nov 2025 09:55:09 -0800 (PST) Received: from mail-yx1-f50.google.com (mail-yx1-f50.google.com. [74.125.224.50]) by smtp.gmail.com with ESMTPSA id 00721157ae682-78821e3d526sm43872557b3.21.2025.11.17.09.55.08 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 17 Nov 2025 09:55:08 -0800 (PST) Received: by mail-yx1-f50.google.com with SMTP id 956f58d0204a3-6420dc2e5feso719916d50.3 for ; Mon, 17 Nov 2025 09:55:08 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCX+A4Cnv75OhQQVR0jaBqbgupqNr26urDHf4ouy4Trf/oIab1Aqm+OUVvpF36eBcdHKrOFyGtN1Q24DtmSwAqc=@freebsd.org X-Received: by 2002:a05:690e:2418:b0:63f:b545:9960 with SMTP id 956f58d0204a3-641e74bc7c5mr8240616d50.11.1763402108335; Mon, 17 Nov 2025 09:55:08 -0800 (PST) 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 References: <4DE06290-81C0-4D21-8919-5A39B1DB3949@dons.net.au> In-Reply-To: <4DE06290-81C0-4D21-8919-5A39B1DB3949@dons.net.au> From: Tomek CEDRO Date: Mon, 17 Nov 2025 18:54:56 +0100 X-Gmail-Original-Message-ID: X-Gm-Features: AWmQ_bkaapr3zFOZIYbPuyjuAaUPbH8PDeBtg0xmmTtprFchKkuRwcVjEur_Sqo Message-ID: Subject: Re: addressable led driver To: "Daniel O'Connor" Cc: Sulev-Madis Silber , freebsd-hackers@freebsd.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spamd-Bar: --- X-Spamd-Result: default: False [-3.30 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; NEURAL_HAM_LONG(-1.00)[-1.000]; NEURAL_HAM_SHORT(-1.00)[-0.996]; R_DKIM_ALLOW(-0.20)[cedro.info:s=google]; MIME_GOOD(-0.10)[text/plain]; ARC_NA(0.00)[]; TO_DN_SOME(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[2607:f8b0:4864:20::112e:from,74.125.224.50:received]; RCVD_VIA_SMTP_AUTH(0.00)[]; MISSING_XM_UA(0.00)[]; MIME_TRACE(0.00)[0:+]; R_SPF_NA(0.00)[no SPF record]; MLMMJ_DEST(0.00)[freebsd-hackers@freebsd.org]; RCPT_COUNT_THREE(0.00)[3]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; DMARC_NA(0.00)[cedro.info]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCVD_TLS_LAST(0.00)[]; PREVIOUSLY_DELIVERED(0.00)[freebsd-hackers@freebsd.org]; RCVD_COUNT_THREE(0.00)[3]; DKIM_TRACE(0.00)[cedro.info:+] X-Rspamd-Queue-Id: 4d9Fl74JmGz3mWk 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 contro= l 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 would= be clockless and this all kind of sucks > > > > i found gpiospi.c which is entirely undocumented. unsure how to get it = working, i tried and failed > > gpiospi.c does bit banging - I think you will struggle to meet the timing= requirements for WS2812 with it unless you do something horrible like disa= ble all IRQs, send the bit stream and then enable them again. > > What actual SoC do you have? > > For example, the Beaglebone has PRUs which are simple coprocessors which = can do this sort of bit banging (I have done it in Linux using LEDScape). > > If you don=E2=80=99t have something like that then SPI is probably the mo= st reliable but be aware that you have to care a lot about the clock speed = it uses so if the SoC changes clock speed for power saving it might make yo= ur clock speed wrong (I ran into this in the RPi4 for I2C). Yup, very hard to accomplish these timings for WS2812B with GPIO on MCU, especially when some sort of RTOS + SDK is in use. Usually SPI or RMT peripheral is used to generate these pulses with correct timings. The smallest and cheapest MCU is AtTiny series but not much peripherals. Also note that "bare" WS2812B needs 5V on the data line, but WS2812B-MINI works with 3.3V data logic :-) On the other hand I found some "AURA LED Controller" on my motherboard. It shows up as the USB Device: % usbconfig -d1.2 dump_device_desc ugen1.2: 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.e. STM/ESP/whatever has USB) do the rest? And maybe there is already some standard protocol? -- CeDeROM, SQ7MHZ, http://www.tomek.cedro.info