RPi5 gpio speed compared with RPi4
Hi,
I'm reading the GPIOs 10000000 times.
I'm using:
a) RPi4 using memory mapped io: *(gpio+13)&0xFFFFFFFFU using this
b) RPI5 using memory mapped io: gpio_get_all() using this
Here are the timings, for reading out 10000000 times:
a) RPi4: 0.154841 seconds
a) RPi5: 3.21899 seconds
So according to this... the RPi5 is 20 times slower than Rpi4, in reading gpios via memory mapped io.
Does this sound plausible?
I'm reading the GPIOs 10000000 times.
I'm using:
a) RPi4 using memory mapped io: *(gpio+13)&0xFFFFFFFFU using this
b) RPI5 using memory mapped io: gpio_get_all() using this
Here are the timings, for reading out 10000000 times:
a) RPi4: 0.154841 seconds
a) RPi5: 3.21899 seconds
So according to this... the RPi5 is 20 times slower than Rpi4, in reading gpios via memory mapped io.
Does this sound plausible?
- cleverca22
- Posts: 9593
- Joined: Sat Aug 18, 2012 2:33 pm
Re: RPi5 gpio speed compared with RPi4
the pcie link on the pi5 adds a lot of latency
if you want to poll things faster, then you need to rig up PIO and DMA to automate it and push things in larger bursts
if you want to poll things faster, then you need to rig up PIO and DMA to automate it and push things in larger bursts
Re: RPi5 gpio speed compared with RPi4
Sounds great!cleverca22 wrote: ↑Fri Oct 24, 2025 6:30 pmPIO and DMA to automate it and push things in larger bursts
Any pointers on how to do this? Any examples?
I'd need to trigger say 1000 reads of the following 8 GPIOs: 5, 6, 13, 19, 23, 24, 25, 26
and in the end get 1000 bytes.
And I need to be able to trigger this periodically, when necessary.
(Also: I wonder is the PIO can deliver bytes, or do shifts and masking necessary to obtain the bytes. Otherwise the PIO would have to deliver uint32_t via DMA... and I'd then do the shifts and masking later)
Thanks.
Return to "Interfacing (DSI, CSI, I2C, etc.)"
Jump to
- Community
- General discussion
- Announcements
- Other languages
- Deutsch
- Español
- Français
- Italiano
- Nederlands
- 日本語
- Polski
- Português
- Русский
- Türkçe
- User groups and events
- Raspberry Pi Official Magazine
- Using the Raspberry Pi
- Beginners
- Troubleshooting
- Advanced users
- Assistive technology and accessibility
- Education
- Picademy
- Teaching and learning resources
- Staffroom, classroom and projects
- Astro Pi
- Mathematica
- High Altitude Balloon
- Weather station
- Programming
- C/C++
- Java
- Python
- Scratch
- Other programming languages
- Windows 10 for IoT
- Wolfram Language
- Bare metal, Assembly language
- Graphics programming
- OpenGLES
- OpenVG
- OpenMAX
- General programming discussion
- Projects
- Networking and servers
- Automation, sensing and robotics
- Graphics, sound and multimedia
- Other projects
- Media centres
- Gaming
- AIY Projects
- Hardware and peripherals
- Camera board
- Compute Module
- Official Display
- HATs and other add-ons
- Device Tree
- Interfacing (DSI, CSI, I2C, etc.)
- Keyboard computers (400, 500, 500+)
- Raspberry Pi Pico
- General
- SDK
- MicroPython
- Other RP2040 boards
- Zephyr
- Rust
- AI Accelerator
- AI Camera - IMX500
- Hailo
- Software
- Raspberry Pi OS
- Raspberry Pi Connect
- Raspberry Pi Desktop for PC and Mac
- Beta testing
- Other
- Android
- Debian
- FreeBSD
- Gentoo
- Linux Kernel
- NetBSD
- openSUSE
- Plan 9
- Puppy
- Arch
- Pidora / Fedora
- RISCOS
- Ubuntu
- Ye Olde Pi Shoppe
- For sale
- Wanted
- Off topic
- Off topic discussion