BBS:      TELESC.NET.BR
Assunto:  Re: Baremetal programiing the Pimoroni Tiny2040 RGB LED
De:       Michael Schwingen
Data:     Sun, 18 Jan 2026 10:32:40 +0000
-----------------------------------------------------------
On 2026-01-17, Single Stage to Orbit  wrote:
>> I'd suggest to have a look at the manual and SDK and see how to do it
>> from C then hand translate the C code into ASM...
>
> I've found the following:
>
> https://github.com/thejpster/rp-hal-rp2350-public/blob/main/rp235x-hal/examples/pwm_blink.rs

Why not go to the primary source?

I believe the RP2xx0 datasheet has all you need in the PWM chapter (CH 4.5
for RP2040, or CH 12.5 for RP2350).

There is a list of registers with all the relevant bits explained.

> The funny thing is that the Pimoroni tiny2040 that I also have has a
> RGB LED on it, there's no data sheet for it but it appears to be
> reversed, in that all the GPIO pins attached to this LED are all active
> low, (i.e ~R GPIO18, ~B GPIO19, ~G GPIO20) so works in the opposite way
> to the LED on GPIO 25 on rp2040!

This is quite common - they probably used a 4-pin LED package with common
anode, so you have to drive the individual lines low to activate the LED. 
You could use 3 external inverters or transistors to make them active high,
but why bother (the parts cost money and take up PCB space) when all it
takes to fix this is a single line of code on the software side?

cu
Michael
-- 
Some people have no respect of age unless it is bottled.

--- PyGate Linux v1.5.2
 * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)

-----------------------------------------------------------
[Voltar]