GPIO

Table of contents
No headers

This is a simple custom gpio interface and gpio driver.

You may find the component by cloning this git repo,

git://sopc.et.ntust.edu.tw/git/openip.git

  

I have updated the neek_ocm_spi example hardware design in the nios wiki. I used a custom gpio core to control led0 and i2c ports on NEEK. The gpio core is also available on the openip.git of sopc server. It is simpler than altera PIO, and uses less LE. You can control quite a lot of port pins (tens or hundreds) in a single instance, much more than 32 as Altera PIO. It was designed exactly for the Linux GPIO driver. It does not support interrupts. I don't really think button switches need interrupts as the input layer support polling. I have tried directional buttons as gpio mouse like that of iPod.

I also tried i2c rtc on NEEK. You can add a four pin header to the i2c port on the NEEK, as pointed out in the nios wiki. Then you can connect a simple Maxim DS1338 chip with battery. It is not difficult. And it is very nice to have correct time mark on your local storage, be it mtd or sd card.

The WM8731 is on the i2c bus, with alsa soc driver in the mainline kernel. Though the support of nios2/neek is still on the wish list.

http://www.nioswiki.com/@api/deki/files/115/=neek_ocm_spi.zip

You will need to modify the gpio pins on arch/nios2/kernel/config.c for your custom boards.

1. enable gpio support

Processor type and features -->
    *** Platform drivers Options ***
[*] GPIO interface

2. LEDs with gpio,

Device Drivers -->
[*] LED Support  --->
[*]   LED Class Support
[*]   LED Support for GPIO connected LEDs

You may use sysfs to control the LED on/off, see,

http://www.avrfreaks.net/wiki/index....ion:Linux/LEDs

  

  

Heart beat LED on LED0 of NEEK, you can have a blinking LED with the rate changed according to CPU loading.

[*]   LED Trigger support
[*]     LED Heartbeat Trigger

3. i2c gpio support

There are three I2C buses on NEEK.

0 - WM8731, ADV7180
1 - 24LC00
2 - LCD

It takes much less LE to use gpio than the opencore i2c, just around 8 LE for each i2c port.

[*] I2C -->
I2C Hardware Bus support -->
[*] GPIO-based bitbanging I2C

i2c /dev entries driver
rtc-ds1307 0-0068: rtc core: registered ds1307 as rtc0
rtc-ds1307 0-0068: 56 bytes nvram
i2c-gpio i2c-gpio.0: using pins 7 (SDA) and 6 (SCL, no clock stretching)
at24 1-0050: 16 byte 24c00 EEPROM (writable)
i2c-gpio i2c-gpio.1: using pins 1 (SDA) and 0 (SCL, no clock stretching)
i2c-gpio i2c-gpio.2: using pins 5 (SDA) and 4 (SCL, no clock stretching)

4. i2c eerom 24LC00 on NEEK, which stores the board id and mac addr.

[*] Misc devices  --->
      EEPROM support  --->
[*] I2C EEPROMs from most vendors

/> hexdump /sys/class/i2c-adapter/i2c-1/1-0050/eeprom
   0: 10 10 00 07 ED 08 01 C3-0F 6A 0F 09 00 84 00 94 .........j......

5. i2c rtc external ds1338 added to NEEK

[*] Real Time Clock  --->
[*]   Set system time from RTC on startup and resume
(rtc0)  RTC used to set the system time
[*]   /dev/rtcN (character devices)
[*]   Dallas/Maxim DS1307/37/38/39/40, ST M41T00

rtc-ds1307 0-0068: setting system clock to 2009-05-02 19:24:37 UTC (1241292277)

You can enable the hwclock in busybox. And "hwclock -w" to write system time to rtc.

6. gpio mouse, not enough button switches on NEEK, you will need custom hardware.

    Input device support  --->
[*]   Mice  --->
[*]   GPIO mouse

input: gpio_mouse as /class/input/input0

You may enable the "evtest, event test" from misc apps, to test the gpio mouse (or other input devices)

/> event_test /dev/input/event0
Input driver version is 1.0.0
Input device ID: bus 0x19 vendor 0x0 product 0x0 version 0x0
Input device name: "gpio_mouse"
Supported events:
  Event type 0 (Reset)
    Event code 0 (Reset)
    Event code 1 (Key)
    Event code 2 (Relative)
  Event type 1 (Key)
    Event code 272 (LeftBtn)
    Event code 273 (RightBtn)
    Event code 274 (MiddleBtn)
  Event type 2 (Relative)
    Event code 0 (X)
    Event code 1 (Y)
Testing ... (interrupt to exit)
Event: time 943920197.200302, type 2 (Relative), code 1 (Y), value -1
Event: time 943920197.200640, type 0 (Reset), code 0 (Reset), value 0
Event: time 943920197.210330, type 2 (Relative), code 1 (Y), value -1
Event: time 943920197.210668, type 0 (Reset), code 0 (Reset), value 0
Event: time 943920197.220348, type 2 (Relative), code 1 (Y), value -1
Event: time 943920197.220685, type 0 (Reset), code 0 (Reset), value 0
Event: time 943920197.230337, type 2 (Relative), code 1 (Y), value -1
Event: time 943920197.230674, type 0 (Reset), code 0 (Reset), value 0
Event: time 943920197.240338, type 2 (Relative), code 1 (Y), value -1
Event: time 943920197.240674, type 0 (Reset), code 0 (Reset), value 0
Event: time 943920197.250331, type 2 (Relative), code 1 (Y), value -1
Event: time 943920197.250668, type 0 (Reset), code 0 (Reset), value 0
Event: time 943920197.260345, type 2 (Relative), code 1 (Y), value -1
Event: time 943920197.260681, type 0 (Reset), code 0 (Reset), value 0
Event: time 943920197.270339, type 2 (Relative), code 1 (Y), value -1
Event: time 943920197.270677, type 0 (Reset), code 0 (Reset), value 0
Event: time 943920197.280332, type 2 (Relative), code 1 (Y), value -1

7. Dallas one-wire, I haven't tried on real boards yet.

[*] Dallas's 1-wire support  --->
1-wire Bus Masters  --->
[*] GPIO 1-wire busmaster


Retrieved from "http://www.nioswiki.com/GPIO"

Tag page
Viewing 1 of 1 comments: view all
Nice story about this.
Great Nice Pictures
causes back pain knee high shoes lizlange maternity fishing boats sale flu incubation period remedies sore throat cost breast implants muscle weight gain surgery breast reduction girls party ideas women laptop bags car brake parts continuing nursing education cost breast augmentation protein whey powder baby slings carriers bed bugs pictures bedding duvet covers phone pay as you go outdoor swing sets discount dinnerware sets coffee espresso machines salton yogurt maker hair color pictures pictures of haircuts asvab practice test herpes photos easy cooking recipes toy dog breeds herpes simplex 1 personalized dog tags stress fracture foot occupational therapy schools frontline plus cats fleas on humans physical therapy salary scabies pictures pictures of shingles what is blood pressure ibuprofen side effects pictures of ringworm gendongan bayi kain cukin ring sling pouch sling perlengkapan bayi selendang bayi nursing cover selendang baby perlengkapan bayi baru lahir bayi bayi lucu foto bayi parish vintage ebooks download tv series download manga free download make money online health information cell phone review disorders anxiety psat practice test blood preasure smart water filter filter pur water weight loss effects blood pressure side effects socks over knee socks dress Hot News Today Jual Beli Make Money Celebrity Gossip Kesehatan Alternatif Gosip Selebritis celebrity photos celebrity news hot celebrities celebrity blog kesehatan info kesehatan kesehatan kerja pelayanan kesehatan indonesia artis foto artis gambar artis selebriti iklan iklan gratis jual online handphone daily news breaking news local news online news food dehydrator tray massage chair ijoy homedics massage shiatsu evening gown dress evening wedding dress dry face skin gold toe sock window coverings blinds blinds for windows lip gloss cosmetics folding table chairs women high heels stockings high heels treatment of pain chlorine generation makeup lighted mirror pain management specialist lawn pest control garden pest control joint pain causes
Posted 16:08, 20 Jul 2010
Viewing 1 of 1 comments: view all
You must login to post a comment.
SourceForge.net