Jump to content

Nano pi DUO GPIO PL11


projetoarduino

Recommended Posts

Hello.

 

I am trying read to directly access GPIO PL11 (IRTX) from nano Pi DUO without success, other pins with this same code work very well.

 

Via Userspace work well

 

echo "363" > /sys/class/gpio/export

echo "in" > /sys/class/gpio/gpio363/direction

 

cat /sys/class/gpio/gpio363/value Then i receive 0 or 1 (This proves that hardware is ok.)

 

My example code

To compile

gcc gpio_lib.c simple_gpio.c -o blink

#include <stdlib.h>
#include <stdio.h>

#include "gpio_lib.h"



int main()
{
	sunxi_gpio_init();
	//gpio_PA3
	sunxi_gpio_set_cfgpin(SUNXI_GPA(4), SUNXI_GPIO_OUTPUT);
	sunxi_gpio_set_cfgpin(SUNXI_GPL(11), SUNXI_GPIO_INPUT);


	while(1) {
		unsigned int b = sunxi_gpio_input(SUNXI_GPL(11));
		printf("%x\n", b);
	    sunxi_gpio_output(SUNXI_GPA(4), 1);
	    sleep(1);
	    sunxi_gpio_output(SUNXI_GPA(4), 0);
	    sleep(1);
	}
	return 0;
}

 

gpio_lib.c

gpio_lib.h

simple_gpio.c

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