09-02-2019, 03:01 AM
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.
GPIOsrc.tar (Size: 180 KB / Downloads: 433)
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.
GPIOsrc.tar (Size: 180 KB / Downloads: 433)