Difference between revisions of "RPi/de"

From GIMX
Jump to: navigation, search
Line 81: Line 81:
 
"Advanced Options", "Serial", "No", "Finish"
 
"Advanced Options", "Serial", "No", "Finish"
 
</pre>
 
</pre>
Die Standardkonfiguration erlaubt keine hohen baudrates.<br />
+
Die Standardkonfiguration erlaubt keine hohe Baudrate.<br />
Hohe baudrates durch das anpassen von /boot/config.txt aktivieren:
+
Hohe Baudrate durch das anpassen von /boot/config.txt aktivieren:
 
<pre>
 
<pre>
 
sudo nano /boot/config.txt
 
sudo nano /boot/config.txt
 
</pre>
 
</pre>
Folgende zeile am schluss der Datei hinzufügen:
+
Folgende Zeile am Schluss der Datei hinzufügen:
 
<pre>
 
<pre>
 
init_uart_clock=8000000  
 
init_uart_clock=8000000  

Revision as of 16:38, 29 December 2016

Other languages:
Deutsch • ‎English • ‎français

Warnung: RPi Unterstützung sollte als experimentell betrachtet werden.Es kann zu Problemen kommen, wenn GIMX auf dem RPi ausgeführt werden soll.

GIMX läuft unter verschiedenen Linux Geräten und der Raspberry Pi ist einer davon !

Hardware Empfehlungen

Nutze nur einen USB HUB wenn am RPi keine resp. zu wenige Ports verfügbar sind.
Es ist empfehlenswert einen USB HUB mit externer Stromversorgung zu nutzen.

Firmware aktualisierung

Erste Firmwares hatten Probleme mit den USB Ports, deshalb ist es empfehlenswert die Firmware Updates vor der Nutzung von GIMX durchzuführen.
Die Firmware zu aktualisieren kann auch hilfreich sein, wenn geplant ist ein Logitech Force Feedback Wheel einzusetzen (Das uhid Kernel Modul fehlte in früheren Firmwares).
Folgende befehle ausführen (Terminal/SSH):

sudo rpi-update
sudo reboot

Falls Probleme mit der aktuellsten Firmware auftreten, sollte diese installiert werden:

sudo rpi-update 771a503cfc2a1130e2df2a4ddfc45ffa0f592b3f
sudo reboot

Getestete RPi Firmware:

pi@raspberrypi ~ $ uname -a
Linux raspberrypi 4.1.21+ #873 Mon Apr 11 18:00:37 BST 2016 armv6l GNU/Linux

USB Adapter mithilfe der On-Board UART Schnittstelle

Hardware Anforderungen

ACHTUNG DIES IST EINE ÜBERSETZUNG - Bei unklarheiten das Original in Englisch durch lesen!

Das On-Board UART läuft mit Spannungen von 0V/3.3V, das AVR USB-Board muss mit einer Spannung von 5V und 16MHz laufen (Spannungen von 3.3V würden nur mit 8MHz arbeiten).
Das direkte Verbinden der RPi mit dem AVR USB-Board könnte die Hardware beschädigen! Eine günstige Lösung ist es einen Spannungsteiler zu verwenden:

  • Beide GNDs verbinden
  • Es ist sicher den TXD Pin der RPI mit dem Rx Pin vom AVR USB-Board zu verbinden (Die GIMX Firmware konfiguriert den Rx Pin als eingabe)
  • Um den Tx pin vom AVR USB-Board zum RXD pin der RPi zu verbinden, muss man die Spannung von 0..5V auf 0..3.3V anpassen.

Dies kann mit einem Spannungsteiler gemacht werden:

Resistive_divider.png

Vin ist der TX Pin vom AVR USB-Board, Vout ist der RXD Pin der RPi, R1=2.2kΩ , R2=3.3kΩ

  • Keine anderen Pins verbinden !

Software Einstellungen

Standardmässig ist der RPi UART als Serielle Konsole konfiguriert.
Deaktivierung der Seriellen Konsole mittels raspi-config:

sudo raspi-config 

Dann folgendes auswählen:

"Advanced Options", "Serial", "No", "Finish"

Die Standardkonfiguration erlaubt keine hohe Baudrate.
Hohe Baudrate durch das anpassen von /boot/config.txt aktivieren:

sudo nano /boot/config.txt

Folgende Zeile am Schluss der Datei hinzufügen:

init_uart_clock=8000000 

Neustart um die Änderungen wirksam zu machen:

sudo reboot

GIMX installation

wget https://gimx.fr/download/gimx-raspbian -O gimx.deb
sudo dpkg -i gimx.deb
sudo apt-get -f install

If you get a "Dependency is not satisfiable: ..." error message, upgrade Raspbian:

sudo apt-get update && sudo apt-get upgrade

Stop/disable triggerhappy service

Triggerhappy is a daemon that opens every input device for reading, and that consumes a few percent of the CPU time.

It seems a good idea to stop it while running GIMX.

To stop triggerhappy:

sudo service triggerhappy stop

To disable triggerhappy:

sudo update-rc.d triggerhappy disable

Run GIMX

Read the Quick start page to learn how to run GIMX through the GUI.
A good idea is to run GIMX directly from a terminal, without starting a graphical session, which can be done over the network, using a ssh client, or you can #Autostart GIMX at boot without GUI
Ideally, GIMX should be launched without using the Ethernet port (because it is connected on the USB bus).
More details on command line options on this page.

Autostart GIMX at boot without GUI

Simply create a file /etc/systemd/system/gimx.service (as root) with the following content:

[Unit]
Description=GIMX  
After=syslog.target network.target

[Service]
User=pi  
Type=simple  
ExecStart=/usr/bin/gimx -p /dev/ttyUSB0 -c LogitechDrivingForceGT_G29.xml --nograb  
Restart=always  
RestartSec=5

[Install]
WantedBy=multi-user.target

Replace ttyUSB0 with your device and LogitechDrivingForceGT_G29.xml with your mapping file (which should be available in the pi home directory as /home/pi/.gimx/config/LogitechDrivingForceGT_G29.xml)

Run

sudo systemctl daemon-reload

to notify systemd about the new file and

sudo systemctl enable gimx && sudo systemctl start gimx

to enable the gimx service start at boot and start it in the same line.

Notify when GIMX is running using a led

In order to have a proper confirmation about if the gimx service is up and running, you can add a simple python script that turns a led on if the gimx service is running.

The file will be located at /home/pi/blink.py:

#!/usr/bin/python
import os  
import time  
import RPi.GPIO as GPIO

led = 23  
button = 18  
GPIO.setmode(GPIO.BCM)  
GPIO.setup(led, GPIO.OUT)  
GPIO.setup(button, GPIO.IN, pull_up_down = GPIO.PUD_UP)

def Shutdown(channel):  
  GPIO.output(led, True)
  time.sleep(0.2)
  GPIO.output(led, False)
  time.sleep(0.2)
  GPIO.output(led, True)
  time.sleep(0.2)
  GPIO.output(led, False)
  os.system("sudo shutdown -h now")

GPIO.add_event_detect(18, GPIO.FALLING, callback = Shutdown, bouncetime = 2000)

while True:  
  found = False
  time.sleep(5)
  pids = [pid for pid in os.listdir('/proc') if pid.isdigit()]
  for pid in pids:
    try:
      cmd = open(os.path.join('/proc', pid, 'cmdline'), 'rb').read()
      if "gimx" in cmd:
        found = True
    except IOError: # proc has already terminated
      continue
  if found == True:
    GPIO.output(led, True)
  else:
    GPIO.output(led, False)

As a bonus, you can add a button so when it is pressed, there is a little blink effect, and the pi is shutted down.

PiButtonLed.png

To start at boot, simply add it to the pi user crontab (crontab -e) as

@reboot python /home/pi/blink.py &