Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 8093

Other RP2040 boards • Re: can QSPI_SS be used to drive a led

$
0
0
I don't really understand but you're saying it won't work ?
It should work as an LED.

If using a reasonable value of resistor and placing it close to the flash chip (as equally applies to an ordinary boot button) then it shouldn't impair the operation of the flash.

However, it is unlikely to work as a button to force entry to boot mode.



The point here is that the bootrom samples the pin early in the boot sequence to determine bootrom mode vs normal boot. It does this by making the pin an input and activating a weak pull-up - if the external circuit pulls it down to a 0 level then bootrom mode is entered.

There is already a compromise with the simple boot button - ideally you'd pull the pin all the way down to zero volts to guarantee a logic '0' is read; however, that would be a short-circuit if the button remains pressed after the chip has turned the pin back into an output. There's also the concern that, when the flash is in operation, these are very high speed signals and the extra length of wire/PCB track leading to the button would cause reflections and corrupt the signal. Both these issues are solved by placing a resistor in series with the button, close to the flash/CPU: the resistor needs to be large enough that only a trivial current flows through it when the flash is being accessed, making the added wire/button "invisible" to the main circuit, but the resistor also needs to be small enough that it brings the pin close enough to zero for a reliable reading when the button is pressed and the input being sampled (must be less than 0.8V to meet datasheet spec). In the latter situation, you have the on-chip pullup resistor (uncertain value, between 50K and 80K) pulling up, and your external resistor pulling down. With external resistor of 1K and the 50K worst-case on-chip that gives you 3.3 * (1/51) = 0.064V, comfortably meeting the 0.8V spec. For the high speed operation, PCB track characteristic impedance is typically around 50 ohm, so 1K in parallel with this is large enough to be "invisible".

Now, in your proposed circuit you have reduced the resistor to 600R (not sure where you are going to find one, maybe you meant 620R), and have added an LED in series.

The drop from 1K to 620 isn't going to make a huge difference to the high speed behaviour - it's a bit worse, but still not too bad. However, the calculation for the pull-down-to-zero case is completely different. An LED doesn't behave like a resistor - it requires a significant voltage before any significant current flows at all (approx 2V for a red LED - look up the Vf value in your LED datasheet). So now we have three things in series: the 50K of the on-chip pullup, the 820R external resistor, and the LED. The voltage on the pin will be a shade over 2V, certainly not low enough to read as logic '0'.

You could potentially add your LED in parallel with the button rather than in series with it - this would be 'normally on' rather than on only when you pressed the button, but would at least work. You could even use it as an error indicator: while it would be mostly-on, pulsing with flash activity during normal use, you could have a loop in RAM that displayed blink codes on it for fatal error conditions.

If doing this, I'd stick with 1K as the resistor value - with a modern high-efficiency red LED, 1K (and so about 1mA current) is sufficient as an indicator and avoids excessive loading on the RP2040 pin.

I can't se any way to make this work as you intended - LED only lit if the button pressed. Fundamentally, if the button is doing its job and putting the RP2040 into boot mode then there is by definition less than 0.8V available and that isn't enough to light a LED.

You could wire the LED from 3.3V to the button in parallel with the bootrom connection (the LED having its own separate series resistor to set the brightness). That would give you an LED that's normally off, lights brightly while the button is pressed (irrespective of what the RP2040 us up to), and with the button released glows dimly when the flash is being accessed or when the RP2040 deliberately drives the pin low. Resistor values are going to be a compromise between being too bright when the button is pressed vs being too dim when driven by the RP2040. I think I'd go with 560R in series with the LED and the usual 1K connection to the QSPI_SS pin - that gives you 1.5K in series with the LED when driven by the RP2040 which will be dim but probably still enough to be easily visible with a decent LED. Maybe even both as 1K would be good.

Statistics: Posted by arg001 — Sat Feb 21, 2026 11:20 am



Viewing all articles
Browse latest Browse all 8093

Trending Articles