PINE64
Question on the RockPro64 RK3399 GPIOs... - Printable Version

+- PINE64 (https://forum.pine64.org)
+-- Forum: ROCKPRO64 (https://forum.pine64.org/forumdisplay.php?fid=98)
+--- Forum: RockPro64 Hardware and Accessories (https://forum.pine64.org/forumdisplay.php?fid=102)
+--- Thread: Question on the RockPro64 RK3399 GPIOs... (/showthread.php?tid=7355)



Question on the RockPro64 RK3399 GPIOs... - Faradn - 04-06-2019

Are the (4) groups of GPIOs A, B, C, D in the same 32-bit register?
Example:
GPIO1
3
1 0
[----D----][----C----][----B----][----A----]
7 4 1
I can toggle GPIO1A1, 4, 7 on/off but not GPIO1Bs.

TIA,
/Faradn

...Any way to set a fixed width font in this BBS?


RE: Question on the RockPro64 RK3399 GPIOs... - axelf - 04-08-2019

How are you planning on controlling the GPIO Devices ? Via the legacy /sys/class/gpio driver ?

I am currently trying to write a GPIO kernel driver to the new standard. There are a lot of anomalies in the documentation but I am composing a complete spreadsheet of the PMU/GRF Registers if thats how you where planning on doing it ?

I am almost finished.

There are 5 GPIO Banks supporting a total of 122 GPIO's only a few of which can be accessed by user space;
They all have PAD designation A,B,C,D each with its own IOMUX Register

gpio0 Allocated to PMU Registers as can be used for wake-up.
gpio1 Allocated to PMU Registers as can be used for wake-up.
gpio2 GRF Registers and used for SPI/12C/PMW etc as well as exposed GPIO
gpio3 GRF Registers and used for SPI/12C/PMW etc as well as exposed GPIO
gpio4 GRF Registers and used for SPI/12C/PMW etc as well as exposed GPIO


RE: Question on the RockPro64 RK3399 GPIOs... - Faradn - 04-10-2019

Howdy,

Not using the /sys/class file IO method.
I'm mmap-ing the RK3399's IO and using address offsets
to read/write the IO. I've got the GPIO, I2C, SPI, 
I2S, & UART all mapped out. Whatever's available at
the 40-pin GPIO header is accessible via mmap'd IO.

Basically it's the methods used in the BCM2835 Library
for low-level IO. I've just translated the methods to 
work for an RK3399 instead of a BCM2835/7 that's used in 
a Pi 2/3B. 
https://www.airspayce.com/mikem/bcm2835/

So far so good...the methods work fine, I just can't get
GPIO3D[0]..[7] and GPIO4C[3]..[5] & GPIO4D[1]..[4]
to toggle. I'll have to check the schematic to verify
they're not used by any other devices.

/Faradn


RE: Question on the RockPro64 RK3399 GPIOs... - axelf - 04-14-2019

(04-10-2019, 06:02 PM)Faradn Wrote: Howdy,

Not using the /sys/class file IO method.
I'm mmap-ing the RK3399's IO and using address offsets
to read/write the IO. I've got the GPIO, I2C, SPI, 
I2S, & UART all mapped out. Whatever's available at
the 40-pin GPIO header is accessible via mmap'd IO.

Basically it's the methods used in the BCM2835 Library
for low-level IO. I've just translated the methods to 
work for an RK3399 instead of a BCM2835/7 that's used in 
a Pi 2/3B. 
https://www.airspayce.com/mikem/bcm2835/

So far so good...the methods work fine, I just can't get
GPIO3D[0]..[7] and GPIO4C[3]..[5] & GPIO4D[1]..[4]
to toggle. I'll have to check the schematic to verify
they're not used by any other devices.

/Faradn
I attach the spreadsheet ... its WIP as There are still a couple of anomalies that I am still looking into.


RE: Question on the RockPro64 RK3399 GPIOs... - Faradn - 04-17-2019

A momentous achievement!
Thank you.
Attached is what i"ve gleaned so far from 
theRK3399 Technical Reference Manual.


Now how to translate PI2/3B (BCM2835/7) GPIO pin numbers
to RK3399 GPIO pin numbers. Along with a function select
method.
/Faradn


RE: Question on the RockPro64 RK3399 GPIOs... - Gienek - 09-02-2019

Hello,
I have been busy with the same problem for some time - Handling the GPIO pins directly in C.
According to my experience two steps are critical for enabling a pin:
-      Set the relevant multiplexer to GPIO function
-      Enable GPIO clock of this GPIO section. On my board, only GPIO1 is enabled by default. Maybe used for some other functions. Others require enabling.
Then, you need to set pin direction, according to intended usage as input or output.
While playing with GPIO on this board, I have met a problem of avoiding race conditions at some operations. Notable, when setting pin output state. So, I had to solve this in more systematic way, and finally written a small library of functions to operate GPIO on ROCKPro64. It is still in experimental phase and documentation is very ‘sparse’, but you may look in this coding, if you would like to see how I propose to operate GPIO. It is attached below.
I will be grateful for advices how to make it better!
Best regards,
Gienek.

.tar   GPIOsrc.tar (Size: 180 KB / Downloads: 426)