Email or username:

Password:

Forgot your password?
Tube❄️Time

this is a graph showing the infamous GPIO bug in the new Raspberry Pi RP2350 microcontroller. the scale is not mA, it's actually uA (phew). but you won't believe what I went through to get this data! 🧵

59 comments
Tube❄️Time

first, since i always seem to do stuff the hard way, i designed a board from scratch for the 2350. i call it the Rotten Pi 2350[A] mostly because i threw it together in a huge hurry two weeks ago.

orange circuit board with colorful headers, a USB connector, and a RP2350 chip in the middle. a sticker at the bottom proclaims "A2" referring to the chip revision.
Tube❄️Time

(i did the layout on a Twitch stream but I forgot to turn on VoD, sorry about that.)

Tube❄️Time

then, i built my own curve tracer on a breadboard. i'm driving a sawtooth waveform from my Rigol scope through a 1K sense resistor, and this chip amplifies the voltage drop and runs it into channel 2. channel 1 goes to the downstream side of the 1K resistor so the voltage is accurate.

LM363 chip on a breadboard with minimal circuitry around it
Tube❄️Time

i have a pico 2 that i loaded with the "debugprobe" app and connected it to the Rotten Pi. i need to do this to directly program the GPIO control registers.

Tube❄️Time

here is the complete configuration. the curve tracer is tied to GPIO0 and, using the debugprobe, i can turn the pullup or pulldown on and off and observe the results on the scope.

a big mess of wires on my bench. there's a Pico 2, a Rotten Pi, a breadboard, and so many wires
Tube❄️Time

when you power up the chip without loading any software, the pulldown resistor is turned on by default so you can see it sinking current here. there's a very odd peak as you cross above VDDIO + 0.3V which makes me think there is an internal diode. above that, i think the fault tolerant circuit kicks in and the current goes back down again.

Tube❄️Time

if you turn on the pulldown, the whole curve shifts up a bit, which is expected. the "glitch" is still there, trying to source current, but part of that current is canceled out by the pulldown.

graph with pullups/pulldowns turned off
graph with the pulldown turned on
Tube❄️Time

if you turn on the pullup resistor, it shifts the whole curve down (also expected). the flat part is the measurement limit of my quick-and-dirty curve tracer, not the chip.

Tube❄️Time

well this is weird, you can turn on the pullup and pulldown at the same time! you get this strange effect where the pulldown takes effect at low voltages and the pullup takes effect at higher voltages, after the glitch. i wonder if this is related. 🤔

Tube❄️Time

the glitch is affected by the Schmitt trigger setting. this tells me that whatever circuit is sourcing current out of the pin depends on the state of the input *after* the first input buffer stage.

graph with no Schmitt trigger. the left edge of the glitch is fuzzy but pretty much in a constant spot.
graph with the Schmitt trigger turned on. the glitch has two distinct left edges, presumably one for rising and the other for falling.
Tube❄️Time replied to Tube❄️Time

when i turn off the IE bit (input enable), the glitch goes away completely and the pullup/pulldown modes behave correctly. when both pullup and pulldown are turned on, the pulldown takes priority.

graph showing a flat response (no current) for input disabled and pullup/pulldown disabled.
graph showing a pullup sourcing current for low voltages and decreasing as the voltage on the pin approaches 3.3V, then it begins to sink current.
graph showing the pulldown sinking current and saturating at around 60uA.
Tube❄️Time replied to Tube❄️Time

so with VCCIO running at 1.8V, the glitch is only around 30uA. in general, the lower the VCCIO, the smaller the glitch.

Tube❄️Time replied to Tube❄️Time

anyway i did this whole experiment because i'm investigating the 5V tolerance. the little spike at VCCIO+0.3V is my current focus. note that the leakage current goes up to about 3uA on the other side of the spike.

doragasu replied to Tube❄️Time

@tubetime Quite interesting stuff. They removed the mention to 5V tolerance from the datasheet IIRC, so maybe they're not very convinced it will work.

doragasu replied to Tube❄️Time

@tubetime Oh you're right. They removed some references though (about that and the 10 uA DVDD sleep mode)

Tube❄️Time replied to Tube❄️Time

here's the voltage sweep around the little spike and all the way up to 6.4V (!) you can see the ESD clamp kicking in at around 6V. it is a Zener-style clamp, so it doesn't depend on VCCIO.

Tube❄️Time replied to Tube❄️Time

the trick to this measurement is to set the voltmeter in high impedance mode (1GOhm) instead of the usual 10Mohm mode which would pull too much current and throw off the measurement

Tube❄️Time replied to Tube❄️Time

oh this is odd, when VCCIO=1.8V and the pullup is on, the GPIO pulls 150uA at 3.8V but then it drops again. (abs max is 3.63V so we are in uncharted waters)

trilader replied to Tube❄️Time

@tubetime They are, in fact, not in uncharted since you just posted a chart?

Tube❄️Time replied to Tube❄️Time

I'm going to leave it this way at least overnight and see how it goes. 5V on GPIO0 with no voltage on VDDIO (which is sitting at around 150mV due to some back bias leakage)

Rotten Pi board with an attached 7805 regulator and a 9V battery
Rue Mohr replied to Tube❄️Time

@tubetime shouldn't the protection diodes bring it almost all the way up?

Tube❄️Time replied to Rue
Tube❄️Time replied to Tube❄️Time

the results? a *very slight* change in the curve trace. but it's basically identical, you could handwave this away with a temperature difference between the two sets of measurements.

curve trace with VCCIO=3.3V, no pullups or pulldowns
curve trace with pulldown turned on. VCCIO=3.3V
curve trace with pullup turned on, VCCIO=3.3V.
Tube❄️Time replied to Tube❄️Time

somewhat more concerning is that the threshold (vih) of the pin has shifted up by about 50mV. ~1.36V -> 1.41V. EDIT: i measured it again with the curve tracer instead of directly with the voltmeter/ammeter combo, and it appears to be identical to the other GPIO pins. it's tricky to measure the threshold with the source current bug affecting the measurement.

Tube❄️Time replied to Tube❄️Time

hmm, there does seem to be an effect on the Schmitt trigger circuit. GP0 has a lower falling threshold than the other pins when Schmitt trigger mode is turned on.

Tube❄️Time replied to Tube❄️Time

i'm thinking about the effects of hot carrier injection (HCI), which usually causes the threshold voltages to shift. then there's also negative bias temperature instability (NBTI). both of these could cause timing issues.

Tube❄️Time replied to Tube❄️Time

to sum up the results so far: beating the crap out of this GPIO pin, taking it up to over 6V, letting it sit at 5V for 24h, etc, has resulted in a tiny shift in the falling threshold with Schmitt trigger mode turned on. no functional changes.

Tube❄️Time replied to Tube❄️Time

the next step is to write a little PIO program to copy the input state of the pin to another GPIO configured as an output. and then i can start measuring timing.

or maybe copy the state of two pins so i can do a side-by-side comparison.

Tube❄️Time replied to Tube❄️Time

the program is written:
wait 1 pin 0
set pins, 1
wait 0 pin 0
set pins, 0

Tube❄️Time replied to Tube❄️Time

and the propagation delay data is in. i increased persistence. as expected, the variation in the delay is approximately 6.6ns which is one sysclk cycle. this is the synchronization time. minimum delay is 36.4ns which seems long--i'm going to try and figure out why.

Tube❄️Time replied to Tube❄️Time

ahh, they have a 2-flop synchronizer on each input to the pio. but there's a way to disable them on a per-pin basis.

11.5.6.3. Input Synchronisers To protect PIO from metastabiltes, each GPIO input is equipped with a standard 2-flipflop synchroniser. This adds two. ycles of latency to input sampling, b the benefit i that state machines can perform an I PIIS at any point, and wil see only a clean high or low level, not some intermediate value that could disturb the state machine circuitry. This s ‘absolutely necessary for asynchronous interfaces such as UART RX. Itis possible to bypass these synchronisers, on a per-GPIO basis. This reduces input latency, but it then up o the user to guarantee that the state machine does not sample its inputs at inappropriatetimes. Generallythis s only possible for Synchronous interfaces such as SPI. Synchronisers are bypassed by setting the corresponding bt in INPT_SYHC_B1PASS. © WARNING

‘Sampling a metastable input can lead to unpredictable state machine behaviour. This should be avoided.
Tube❄️Time replied to Tube❄️Time

23.6ns minimum delay now. that's 2 clock cycles removed. hmm.

Tube❄️Time replied to Tube❄️Time

i halved the sysclk, so now we have a variability of 13.2ns and a minimum delay of 35.2ns.

Tube❄️Time replied to Tube❄️Time

did a little math and it looks like there is a 2 sysclk delay plus the input propagation delay and output propagation delay. the prop delays total about 8.8ns.

Tube❄️Time replied to Tube❄️Time

hmm so i understand why there is 1 sysclk delay because it takes a cycle to go from the WAIT instruction to the SET instruction. but why 2 sysclk delays?

Tube❄️Time replied to Jeff

@jhaluska you better, your name is on the back.

emily, cat snuggler replied to Tube❄️Time

@tubetime excellent, this means we can work around this by running it at 0V

LouD

@tubetime
I use my Flipper Zero for that, the CMSIS-DAP app does SWD and Uart at the same time, very ideal. Saves me hooking up multiple adapters.

Tube❄️Time

@grishka the connector is terrible, the PCB layout tolerances are really tight, and the connector is hard to solder.

Andy

@tubetime @grishka I'm glad someone finally said it. Micro B forever

Ian Scott :apple_inc: 🐙

@tubetime lol at "magical misery inductor." it's such a weirdly precious part they want you to use.

Tube❄️Time

@polpo i'm not using their recommended part, this is just a plain old inductor from Mouser.

Phil M0OFX

@tubetime I just noticed the text, "Fake DVI - not HDMI for legal reasons". Shared it with some friends and we're all chuckling at that one!

Miles Goodhew

@tubetime All the spite dripping off those stencils! :chef_kiss:

Daniel Marks

@tubetime I made this layout you might be interested in, which is designed to be assembled by JLCPCB
github.com/profdc9/PicoAlt2

doragasu

@tubetime Loving the silk screen of all your PCBs XD. I'm wondering why the "USB-C sucks" though.

Go Up