Software: Difference between revisions

From Wiki-DB
Jump to navigationJump to search
No edit summary
No edit summary
 
(9 intermediate revisions by the same user not shown)
Line 1: Line 1:
   Im Folgenden werden die GPIOs aufgelistet, und deren Nummer, unter welcher Sie im Linux angeprochen werden können.
==GPIOs==
 
===Mapping===
   In the following sheet you can find the GPIOs and their linux-number
   [[File:GPIOs.jpg]]
   [[File:GPIOs.jpg]]


Folgendermaßen kann ein GPIO unter Linux angesteuert werden:
===Control===
 
How to control a GPIO:
 
:{| class="wikitable"
|1. <code>''cd /sys/class/gpio''</code>
|-
|2. create new directory: <code>''echo 44 >export  ''</code>
|-
|3. go into this directory: <code>''cd gpio44''</code>
|-
|4. show if GPIO is used as an input or an output: <code>''cat direction''</code>
|-
|5. change output to '1'=high: <code>''echo 1 >value''</code>
|-
|6. change GPIO to input: <code>''echo in >direction''</code>
|-
|7. show input value: <code>''cat value''</code>
|} 
 
==PLD==
 
===Development Software===
To write your own VDHL-code you can use the ispLEVER Classic Software from Lattice
([http://www.latticesemi.com/products/designsoftware/ispleverclassic/index.cfm?source=sidebar]
 
 
You also need a programmer (e.g. HW-USBN-2A from Lattice) to deploy the VHDL-Code on your PLD.
 
After installing the software and the drivers for your programmer you can start a new project.
===Programming example===
You can find a demo-project here:[[media:PLD-demo.zip]]
 
You have to download the *.jed-File with the programmer to your PLD.


   cd /sys/class/gpio
   In the constraint editor of ispLEVER you can define, which input X_VAR1 is.
   echo 44 >export              // lege GPIO A an, ein neues Verzeichnis wird erstellt
   In this example GPIO E is defined as X_VAR1. If you define GPIO E as an
   cd gpio44                    // wechsle in den neuen Ordner
   output and set GPIO E high, the PLD LED should flash red.
  cat direction                // zeigt an ob GPIO als Input oder Output verwendet wird
   [[File:VHDL-Code.jpg]]
  out
  echo 1 >value                // setzt den Ausgang auf '1' = high
  echo in >direction          // ändert den GPIO zum Input
  cat value                    // zeigt den Wert an, der am GPIO anliegt
   0                            // '0' = low

Latest revision as of 09:28, 8 August 2012

GPIOs

Mapping

 In the following sheet you can find the GPIOs and their linux-number
 

Control

How to control a GPIO:

1. cd /sys/class/gpio
2. create new directory: echo 44 >export
3. go into this directory: cd gpio44
4. show if GPIO is used as an input or an output: cat direction
5. change output to '1'=high: echo 1 >value
6. change GPIO to input: echo in >direction
7. show input value: cat value

PLD

Development Software

To write your own VDHL-code you can use the ispLEVER Classic Software from Lattice ([1]


You also need a programmer (e.g. HW-USBN-2A from Lattice) to deploy the VHDL-Code on your PLD.

After installing the software and the drivers for your programmer you can start a new project.

Programming example

You can find a demo-project here:media:PLD-demo.zip

You have to download the *.jed-File with the programmer to your PLD.

 In the constraint editor of ispLEVER you can define, which input X_VAR1 is.
 In this example GPIO E is defined as X_VAR1. If you define GPIO E as an
 output and set GPIO E high, the PLD LED should flash red.