Jump to content

Rock64 GPIO using Pine64-CPP


Jeff R

Recommended Posts

Armbianmonitor:

I'm trying to run the example.cpp that comes with Pine64-CPP  but I am throwing segmentation faults.

 

The man-setup() call initialzes the board with the following if statement in the setup() function in gpio.cpp

    if((uint64_t)gpio_mem % PAGE_SIZE)

and the  this->gpioMap = statement that uses SUNXI_GPIO_BASE

  

 

In the example code, I initialize the pin with

   man->pinMode (PI_GPIO_24, OUTPUT);

 

The pinMode function in gpio.cpp, launches _setPullupdn with gpio=78 and pud = 1.  As expected

Inside _setPullupdn,  the following is set

     bank= 2

     index = 0

    offset = 28

 

The segmentation fault seems to come from this line:   
   regval = *(&pio->PULL[0] + index);

 

I have a 4 GB Rock64 running the latest Armbian desktop from this site.

 

sudo cat /sys/kernel/debug/gpio   gives me


GPIOs 0-31, platform/pinctrl, gpio0:
 gpio-0   (                    |vcc_host_5v         ) out hi    
 gpio-2   (                    |?                   ) out lo    
 gpio-30  (                    |vcc_sd              ) out lo    

 

GPIOs 32-63, platform/pinctrl, gpio1:
 gpio-50  (                    |mdio-reset          ) out hi  

 

GPIOs 64-95, platform/pinctrl, gpio2:

 

GPIOs 96-127, platform/pinctrl, gpio3:

 

GPIOs 510-511, platform/rk8xx-gpio, rk8xx-gpio, can sleep:
 gpio-510 (                    |?                   ) out lo    
 gpio-511 (                    |?                   ) out lo   

 

 

Anyone have any thoughts?

Thanks.

 

 

Link to comment
Share on other sites

So, I never resolved the problems with the Pine64-CPP library but I found an alternate.

 

First, I used bash scripts to make sure the Rock64 was working, and I had the right pin addresses.
       https://github.com/Leapo/Rock64-BashGPIO

I used the table table from this website to correctly identify the gpio indices.
        https://github.com/Leapo/Rock64-R64.GPIO...GPIO-Modes
        I used the items from the column labeled GPIO# (ROCK)

 

Lastly, I used the GPIO Class from the following.
      https://github.com/halherta/RaspberryPi-GPIOClass-v2

Even though it is was created for the Raspberry Pi, I found that it correctly manipulated the files in /sys/class/gpio on my Rock64.

Note: I have only tested the GPIO read function, since that is what I'm trying to do for my project.

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines