RP2040 GPIO Speed - Page 1
Forum section: electronics / projects

author: deadly_penguin
author_rank: Contributor
timestamp: December 15, 2022, 05:19:24 pm
content: As part of a project I'm working on I'm designing a pulse generator with widths from ~5ns to ~200ns, and one option I'm looking at is to use the PIO from an over-clocked 2040 to generate these.But, I can't find any details on the GPIO rise/fall times, output impedance, etc. for either the 2040 chip or Pico board.So, before I try and scrounge a really fast scope and grab a Pico, has anyone else measured these? Or have I been totally stupid and just missed them?

author: SiliconWizard
author_rank: Super Contributor
timestamp: December 15, 2022, 07:38:31 pm
content: I looked in the latest version of the datasheet, and I can confirm it's not specified.All I can say is that you can toggle pins running the PIO at the max specified clock (133 MHz), thus at ~66 MHz. While the RP2040 overclocks very well up to pretty high frequencies (near 400 MHz seems possible if you change wait states for Flash access, otherwise 250 MHz is absolutely no problem with standard values), I have no clue about GPIOs as there is no specification that I could find either.You can experiment, but keep in mind that, as with overclocking, your results may not be applicable outside of the few chips you'll test this on, as there is absolutely no guarantee.Actually, the electrical specs of the RP2040 are severely under-documented, while the rest of the documentation is pretty good.

author: pcprogrammer
author_rank: Super Contributor
timestamp: December 15, 2022, 08:27:11 pm
content: 5ns is a very short time for any micro controller. And you write that the pulse width needs to be variable between ~5ns to ~200ns, but not with what resolution.I'm not familiar with the RP2040, but have strong doubts it will be capable of this. Even with a mid range FPGA it might be problematic to make this with, for instance, a 1ns resolution.

author: DavidAlfa
author_rank: Super Contributor
timestamp: December 15, 2022, 08:39:24 pm
content: A 5ns pulse generator is hard thing to achieve almost with anything, even with a 1GHz cpu you'll rarely get so fast I/O.

author: deadly_penguin
author_rank: Contributor
timestamp: December 15, 2022, 09:40:19 pm
content: Quote from: pcprogrammer on December 15, 2022, 08:27:11 pmAh, yes, sorry - resolution isn't all that critical so long as it's reasonably consistent, but should be somewhere around the 5ns-10ns mark; 5ns is ~2 clock cycles at the absolute maximum the 2040 can be clocked at, so I think that the timing can be done with adequate granularity but it really depends how fast I can wiggle the pins.The other option I'm looking at is combining an old Jim Williams circuit (https://www.analog.com/media/en/technical-documentation/application-notes/an98f.pdf#page=8) with a digipot or two and a more reasonable-length pulse from a micro (~200ns).More consideration and testing is required I think...

author: hans
author_rank: Super Contributor
timestamp: December 15, 2022, 09:55:35 pm
content: There are MCUs that have fancy PLLs with polyphase clock outputs. STM32F334 is one example, but Microchip also hassome 16-bit PICsfor this. I'm not sure what theminimumpulse width is, but for sure the pulse width step resolution is sub-ns.Anyway far off-topic if you want to stick to the RP2040. All I can say is that even a very fast MCU (almost "MPU") like a STM32H7xx has real trouble achieving 5ns pulses. It has a risetime of 1.5ns on a 10pF VDD = 2.7-3.6V GPIO set to fastest speed. It's designed to run SPI or memory buses at up to 100MHz, which is still a period time of 10ns, so an eternity relatively speaking. I don't think the RP2040 stretches this far.10pF requires also quite careful design. Consider I/O pad capacitance of the MCU itself and the load (STM32H7xx: 5pF), and then the PCB trace itself (40mm^2 at 0.3mm distance: 5pF)Yes I think as well the Rp2040 electrical specs is undocumented, but I think this is quite commonplace for chips that have a really strong software/RTL sauce and less resources spent onto crazy analog stuff

author: dave j
author_rank: Regular Contributor
timestamp: December 15, 2022, 11:46:42 pm
content: Quote from: deadly_penguin on December 15, 2022, 05:19:24 pmSomeone was having trouble with PWM output from a RP2040 on the Raspberry Pi forum a while ago. Their problem turned out to be them being a newbie scope user and measuring things wrongly but as part of the investigationI measured the output of their program on my Rigol DS1102E.This screenshot:shows the shortest pulse you can get from a RP2040 clocked at 125MHz measured on a 100MHz bandwidth scope. The program outputs a PWM signal with one cycle high, two cycles low. I didn't try messing with the slew rate. You'll have to find someone with a faster scope to see if the chips can do better than that.

author: H713
author_rank: Regular Contributor
timestamp: December 18, 2022, 07:19:53 am
content: The scope image posted by Dave J is promising. What's there is close, especially considering that the scope (what probes are being used? How is the probe grounding done? 100 MHz isn't fast enough for this anyway) is making things considerably worse.Looking at things, you may need (or at least want) some "analog conditioning" at the output. Maybe some very fast schmitt trigger buffers to improve the rise / fall time.Still, 5ns is tough. This would be a tall order for a fast pulse generator like my Chronetics or EH Research, and something like my Tek 115 doesn't even get to try.The output amplifier is what makes or breaks the pulse generator. Doing 1 ns rise/fall times isn't too bad, trying to do 1 ns rise/fall, at 10 V driving a 50 ohm load is another story. Even if you limit that to 5 V into a 50 ohm load, it's no mean feat. You're designing a microwave power amplifier.

author: mino-fm
author_rank: Regular Contributor
timestamp: December 18, 2022, 03:23:24 pm
content: ~5ns: that's easy5.00 ns: this would be difficult.I think rise and fall times are nearly the same, so a simple buffer (74AUC1G04) would give fast edges and ~5ns pulse width. What about duty cycle, repetition rate?Fast pulses 5 ns, 10 ns, 15 ns,... could be formed by PIO changing wait states.Just do it!

author: mino-fm
author_rank: Regular Contributor
timestamp: January 03, 2023, 10:30:17 am
content: Today I'm able to show you a picture of PIOx_SMx generated signal running @200 MHz clock.Overshots and undershots are results of limited bandwidth of scope (300 MHz) and 10:1 probe.Timing of pulse - pause (1:4) is as expected.Changing PADS_BANK0->GPIOx_DRIVE from 0 - 3 will not effect rise/fall times but overshots and undershots.I think using PWM will show similar results.