Genwolf
Posts: 4
Joined: Wed Jan 15, 2020 6:56 pm

Maximum GPIO frequency from kernel space

Wed Jan 15, 2020 7:15 pm

Hello,
I know that frequencies higher than 20MHz are imposible on the gpios from user space. Is that different when using the gpios from kernel space? Could I achieve higher stable frequencies for interfacing with a ADC for example?

User avatar
joan
Posts: 14763
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

Re: Maximum GPIO frequency from kernel space

Wed Jan 15, 2020 8:51 pm

I've seen people claim more than 20 MHz from user land.

Define stable frequency.

User avatar
HermannSW
Posts: 2040
Joined: Fri Jul 22, 2016 9:09 pm
Location: Eberbach, Germany
Contact: Website Twitter YouTube

Re: Maximum GPIO frequency from kernel space

Thu Jan 16, 2020 12:06 am

Genwolf wrote:
Wed Jan 15, 2020 7:15 pm
I know that frequencies higher than 20MHz are imposible on the gpios from user space.
Not true, 50MHz PWM even on Pi Zero is clean, verified with 400Msps logic analyzer:
https://www.raspberrypi.org/forums/view ... 3#p1087893
Image


It was my first contact with Joan's pigpio library three years ago, especially the pigs command.
Until I last year used pigpio library a lot (C interface as well as pigs) for v1 camera global external shutter work.
I used single digit µs length (5000lm) led flashes, with pigpio waveforms:
Image

pigs command for 50MHz:
http://abyz.me.uk/rpi/pigpio/pigs.html#HP

Code: Select all

pigs hp 12 50000000 500000

125MHz is possible as well, but more than 400Msps logic analyzer (I don't have) is needed to verify cleanly:
Image
⇨https://stamm-wilbrandt.de/en/Raspberry_camera.html

https://github.com/Hermann-SW/Raspberry_v1_camera_global_external_shutter
https://stamm-wilbrandt.de/github_repo_i420toh264
https://github.com/Hermann-SW/fork-raspiraw
https://twitter.com/HermannSW

Genwolf
Posts: 4
Joined: Wed Jan 15, 2020 6:56 pm

Re: Maximum GPIO frequency from kernel space

Thu Jan 16, 2020 8:06 am

joan wrote:
Wed Jan 15, 2020 8:51 pm
I've seen people claim more than 20 MHz from user land.

Define stable frequency.
The frequency at which i can read the actual states of the gpios without any interuptions for relatively long time (let's say 5 minutes).

Genwolf
Posts: 4
Joined: Wed Jan 15, 2020 6:56 pm

Re: Maximum GPIO frequency from kernel space

Thu Jan 16, 2020 8:10 am

HermannSW wrote:
Thu Jan 16, 2020 12:06 am
Genwolf wrote:
Wed Jan 15, 2020 7:15 pm
I know that frequencies higher than 20MHz are imposible on the gpios from user space.
Not true, 50MHz PWM even on Pi Zero is clean, verified with 400Msps logic analyzer:
https://www.raspberrypi.org/forums/view ... 3#p1087893
Image


It was my first contact with Joan's pigpio library three years ago, especially the pigs command.
Until I last year used pigpio library a lot (C interface as well as pigs) for v1 camera global external shutter work.
I used single digit µs length (5000lm) led flashes, with pigpio waveforms:
Image

pigs command for 50MHz:
http://abyz.me.uk/rpi/pigpio/pigs.html#HP

Code: Select all

pigs hp 12 50000000 500000

125MHz is possible as well, but more than 400Msps logic analyzer (I don't have) is needed to verify cleanly:
Image
Do you know if this is true when reading the gpio as well?

User avatar
joan
Posts: 14763
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

Re: Maximum GPIO frequency from kernel space

Thu Jan 16, 2020 8:35 am

The Pi has limited hardware support for regular GPIO reads. You need hardware support as software based reads will be subject to Linux jitter.

I'm not sure if DPI would work. Perhaps SPI.

Genwolf
Posts: 4
Joined: Wed Jan 15, 2020 6:56 pm

Re: Maximum GPIO frequency from kernel space

Thu Jan 16, 2020 7:04 pm

joan wrote:
Thu Jan 16, 2020 8:35 am
You need hardware support as software based reads will be subject to Linux jitter.
What do you mean by hardware support ? Will there still be considerable jitter if i read the gpios from kernel (using DMA perhaps)?

User avatar
joan
Posts: 14763
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

Re: Maximum GPIO frequency from kernel space

Thu Jan 16, 2020 10:10 pm

I mean you need to use one of the Pi's hardware peripherals to guarantee accurate and regular timing.

DMA as used in pigpio sampling will not work faster than perhaps 2 MHz.

I don't know anything about the DPI hardware or how SPI might be used to capture such data.

Return to “Interfacing (DSI, CSI, I2C, etc.)”