-
Hi, Consider the following code
As you can see, the 2 GPIOPins, depending on some state variables ( When I run this on a Pi4 (@1500Mhz) my app failed due to timings. So I put the measurement around and found that these two SetMode() calls take 2 microseconds. When I run this on a Pi5 (@2400Mhz) this takes even 6 to 7 microseconds. Is this reasonable? Is my measurement correct? The alternative code works only on the Pi4:
With this code (on the Pi4) the time is <= 1 microsecond. I must be wrong somehow - I can't believe that the Pi5 is so much slower doing SetMode() on GPIOPins. And even 2 usecs for the Pi4 is unreasonable long... any feedback is appreciated! thanks, pottendo |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 11 replies
-
Hi,
It's also interesting to see that the two subsequent SetMode() calls are significant different in their execution time - as the Read/Write access is. |
Beta Was this translation helpful? Give feedback.
-
Please set the second parameter of |
Beta Was this translation helpful? Give feedback.
-
Hi, Here's the result for Pi5:
One can see that the SetMode is down to 2usecs. and here the very same test on a Pi4:
confirmed now that the Pi4 is faster in these operations. and finally a Pi3 (32 bit) - a bit on steroids, config.txt:
even faster than the Pi4:
for the sake of completeness, no real difference observed using 64bit on a Pi3, same config.txt:
I'll not spend too much time to tweak my application - Pi5 is not the target platform for this anyway - however it's not intuitive for the average user, that GPIO performance on the newest model is significantly lower than on previous models. The target applications for Pi5s are not necessarily the embedded realtime apps - same for Pi4s - they get way to hot anyway! ;-) Any comments are welcome - you may close this discussion as well. bye, pottendo |
Beta Was this translation helpful? Give feedback.
-
Hi,
To notice: SetModeAll() is behaving well on the Pi5, whereas on the other Pis it's really poor in comparison to the other functions on the same machine. Your latest improvements are significant - now al GPIO funs are faster than Read()! SetMode on Pi3/4 is very poor in comparison with the direct register access on these machines - maybe I'm doing things wrong here? The difference is huge. The tests can be found on the bye, pottendo |
Beta Was this translation helpful? Give feedback.
hi,
here's the update - with enhanced measurement accuracy
Pi3: