This shows you the differences between two versions of the page.
tutorials:common:gpio_on_lubuntu [2014/07/01 16:01] allen |
tutorials:common:gpio_on_lubuntu [2014/07/01 20:03] (current) allen [Cubieboard pin] |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | ===== Cubieboard pin ==== | + | ==== Cubieboard pin ==== |
Cubietruck [[http://docs.cubieboard.org/a20-cubietruck_gpio_pin]] | Cubietruck [[http://docs.cubieboard.org/a20-cubietruck_gpio_pin]] | ||
Line 6: | Line 6: | ||
Fex Guide [[http://linux-sunxi.org/Fex_Guide]] | Fex Guide [[http://linux-sunxi.org/Fex_Guide]] | ||
+ | |||
+ | A10 Datasheet [[http://dl.linux-sunxi.org/A10/A10%20Datasheet%20-%20v1.21%20(2012-04-06).pdf|A10 Datasheet(For Pin multiplexing reference)]] | ||
+ | |||
+ | A20 Datasheet [[http://dl.cubieboard.org/software/ubuntuone/public/cubieboard/docs/A20_user manual V1.0 20130322.pdf|A20 user manual V1.0 20130322.pdf(datasheet)]] | ||
+ | |||
+ | |||
Line 183: | Line 189: | ||
data = *(unsigned int *)(ptr+0x10c); | data = *(unsigned int *)(ptr+0x10c); | ||
for(i=0;i<1000;i++){ | for(i=0;i<1000;i++){ | ||
- | data |= 1<<20; //green led | + | data |= 1<<20; //green led connect PH20 |
*(unsigned int *)(ptr+0x10c) = data; | *(unsigned int *)(ptr+0x10c) = data; | ||
usleep(100000); | usleep(100000); | ||
Line 197: | Line 203: | ||
</code> | </code> | ||
+ | save as test.c,then | ||
+ | <code> | ||
+ | $sudo apt-get install gcc build-essential | ||
+ | $gcc test.c -o test | ||
+ | $./test & | ||
+ | |||
+ | |||
+ | </code> | ||
+ | The green LED is blinking in cycle time.You can modify the ''data |= 1<<20;'' and ''data &= ~(1<<20);'' to use PH15 like ''data |= 1<<15;'' and ''data &= ~(1<<15);''.If you have used a led connect VCC and PH15 port,the led is going to blink in cycle time.\\ | ||