GPIO performance 100x slower compared to Raspberry Pi 3
#5
Right done a little more investigation

Ran a logic analyzer on the Raspberry Pi and the RockPro64  ... and they both test back good ... the only difference is the speed.

https://imgur.com/wBBCYEA  

Blinkt Initialization on the RockPro64 GPIO using SPI DAT = Pin 16\BCM23  CLK = Pin 18\BCM24

Looking into the source code of the Raspberry PI 3  their implementation of RPi.GPIO does not use the /sys/call/gpio interface.
The python GPIO library is a wrapper of a c library _GPIO.cpython-36m-aarch64-linux-gnu.so.

This library  writes directly to the GPIO device in the SOC

/dev/gpiomem
/dev/mem

The process appears to consist of writing to some memory address space (semaphores/registers) to control the GPIO.
This is obviously a lot quicker and deterministic than trying to write to a file in Python.

Python R64.GPIO takes 530us  to toggle a Clock cycle  /sys/class/gpio equates to SPI Clock of 1.8 KHz
Python RPI.GPIO takes  4us to to toggle a Clock cycle /dev/gpiomem equates to a SPI Clock of 0.25MHz

People have tested the Blinkt up to 4MHz and 10MHz ...  but there is not reports of a minimum clock speed!

Clearly the RockPro64 GPIO performance via Python R64\RP64.GPIO is just too slow to get teh SPI interface working.

I will have to see if the RK3399 has a faster way to program the GPIO

I will post my progress.


Messages In This Thread
RE: GPIO performance 100x slower compared to Raspberry Pi 3 - by axelf - 03-23-2019, 09:29 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  GPIO on the RockPro64 - all pins high? colinmarc 2 366 11-18-2022, 10:20 AM
Last Post: colinmarc
  GPIO Expander HAT for ROCKPro64 and Quartz64 CounterPillow 7 2,821 07-18-2022, 10:05 PM
Last Post: zer0sig
  Using GPIO interrupts antonlyap 3 2,559 06-30-2021, 01:32 PM
Last Post: antonlyap
  GPIO in sleep mode Mentaluproar 2 2,619 04-08-2019, 03:50 PM
Last Post: Mentaluproar

Forum Jump:


Users browsing this thread: 1 Guest(s)