Gelöst: I2C 4x20 LCD Display am Cubietruck - Funktioniert nicht

Begonnen von Spezialtrick, 02 Juni 2015, 19:45:44

Vorheriges Thema - Nächstes Thema

Spezialtrick

Guten Abend!

Ich würde an meinem Cubietruck gerne ein 4x20 LCD Display am i2c Bus betreiben. Auf dem Cubietruck läuft das aktelle Igor Image.

Leider ist es mir bisher alleine nicht gelungen etwas sinnvoll auf das Display zu bringen. Zudem bringe ich die LCD Beleuchtung max zum flackern.
Diese Schritte habe ich bisher durchgeführt:

1) i2c Bus im fex/bin-Skript aktiviert
2) i2c-dev wird beim Starten des Systems geladen
3) Display wie folgt verbunden:
    - GND mit GND
    - 5V mit 5V
    - SDA mit PB19
    - SCL mit PB18
4) Cubietruck neugestartet
5) Display mit i2cdetect -y sunxi-i2c.1 gesucht und gefunden:

root@cubietruck:~# i2cdetect -y sunxi-i2c.1
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- 27 -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- -- 


6) Lcdproc und Treiber installiert:

sudo apt-get install lcdproc lcdproc-extra-drivers

7) Display in /etc/LCDd.conf konfiguriert:

# LCDd.conf -- configuration file for the LCDproc server daemon LCDd
#
# This file contains the configuration for the LCDd server.
#
# The format is ini-file-like. It is divided into sections that start at
# markers that look like [section]. Comments are all line-based comments,
# and are lines that start with '#' or ';'.
#
# The server has a 'central' section named [server]. For the menu there is
# a section called [menu]. Further each driver has a section which
# defines how the driver acts.
#
# The drivers are activated by specifying them in a driver= line in the
# server section, like:
#
#   Driver=curses
#
# This tells LCDd to use the curses driver.
# The first driver that is loaded and is capable of output defines the
# size of the display. The default driver to use is curses.
# If the driver is specified using the -d <driver> command line option,
# the Driver= options in the config file are ignored.
#
# The drivers read their own options from the respective sections.



## Server section with all kinds of settings for the LCDd server ##
[server]

# Where can we find the driver modules ?
# IMPORTANT: Make sure to change this setting to reflect your
#            specific setup! Otherwise LCDd won't be able to find
#            the driver modules and will thus not be able to
#            function properly.
# NOTE: Always place a slash as last character !
DriverPath=/usr/lib/lcdproc/

# Tells the server to load the given drivers. Multiple lines can be given.
# The name of the driver is case sensitive and determines the section
# where to look for further configuration options of the specific driver
# as well as the name of the dynamic driver module to load at runtime.
# The latter one can be changed by giving a File= directive in the
# driver specific section.
#
# The following drivers are supported:
#   bayrad, CFontz, CFontz633, CFontzPacket, curses, CwLnx, ea65,
#   EyeboxOne, g15, glcdlib, glk, hd44780, icp_a106, imon, imonlcd,
#   IOWarrior, irman, joy, lb216, lcdm001, lcterm, lirc, lis, MD8800,
#   mdm166a, ms6931, mtc_s16209x, MtxOrb, mx5000, NoritakeVFD, picolcd,
#   pyramid, sed1330, sed1520, serialPOS, serialVFD, shuttleVFD, sli,
#   stv5730, svga, t6963, text, tyan, ula200, xosd
Driver=hd44780

# Tells the driver to bind to the given interface
Bind=127.0.0.1

# Listen on this specified port; defaults to 13666.
Port=13666

# Sets the reporting level; defaults to 2 (warnings and errors only).
#ReportLevel=2

# Should we report to syslog instead of stderr ? [default: no; legal: yes, no]
#ReportToSyslog=yes

# User to run as.  LCDd will drop its root privileges, if any,
# and run as this user instead.
User=nobody

# The server will stay in the foreground if set to true.
#Foreground=no

# Hello message: each entry represents a display line; default: builtin
Hello="  Cubietruck"
Hello="   is starting!"

# GoodBye message: each entry represents a display line; default: builtin
GoodBye="Cubietruck"
GoodBye="   is shuting down!"

# Sets the default time in seconds to displays a screen.
WaitTime=10

# If set to no, LCDd will start with screen rotation disabled. This has the
# same effect as if the ToggleRotateKey had been pressed. Rotation will start
# if the ToggleRotateKey is pressed. Note that this setting does not turn off
# priority sorting of screens. [default: on; legal: on, off]
#AutoRotate=no

# If yes, the the serverscreen will be rotated as a usual info screen. If no,
# it will be a background screen, only visible when no other screens are
# active. The special value 'blank' is similar to no, but only a blank screen
# is displayed. [default: on; legal: on, off, blank]
ServerScreen=no

# Set master backlight setting. If set to 'open' a client may control the
# backlight for its own screens (only). [default: open; legal: off, open, on]
#Backlight=open

# Set master heartbeat setting. If set to 'open' a client may control the
# heartbeat for its own screens (only). [default: open; legal: off, open, on]
#Heartbeat=open

# set title scrolling speed [default: 10; legal: 0-10]
#TitleSpeed=10

# The "...Key=" lines define what the server does with keypresses that
# don't go to any client. The ToggleRotateKey stops rotation of screens, while
# the PrevScreenKey and NextScreenKey go back / forward one screen (even if
# rotation is disabled.
# Assign the key string returned by the driver to the ...Key setting. These
# are the defaults:
#ToggleRotateKey=Enter
#PrevScreenKey=Left
#NextScreenKey=Right
#ScrollUpKey=Up
#ScrollDownKey=Down


## The menu section. The menu is an internal LCDproc client. ##
[menu]
# You can configure what keys the menu should use. Note that the MenuKey
# will be reserved exclusively, the others work in shared mode.

# Up to six keys are supported. The MenuKey (to enter and exit the menu), the
# EnterKey (to select values) and at least one movement keys are required.
# These are the default key assignments:
#MenuKey=Escape
#EnterKey=Enter
#UpKey=Up
#DownKey=Down
#LeftKey=Left
#RightKey=Right


### Driver sections are below this line, in alphabetical order  ###

## Hitachi HD44780 driver ##
[hd44780]

# Select what type of connection. See documentation for types.
ConnectionType=i2c

# Port where the LPT is. Usual value are: 0x278, 0x378 and 0x3BC
Port=0x27

# Device of the serial interface [default: /dev/lcd]
Device=/dev/i2c-1

# Bitrate of the serial port (0 for interface default)
Speed=0

# If you have a keypad connected.
# You may also need to configure the keypad layout further on in this file.
Keypad=no

# Set the initial contrast (bwctusb and lcd2usb) [default: 500; legal: 0 - 1000]
#Contrast=0

# Set brightness of the backlight (lcd2usb only) [default: 0; legal: 0 - 1000]
#Brightness=1000
#OffBrightness=0

# If you have a switchable backlight.
Backlight=yes

# If you have the additional output port ("bargraph") and you want to
# be able to control it with the lcdproc OUTPUT command
#OutputPort=no

# Specifies if the last line is pixel addressable (yes) or it controls an
# underline effect (no). [default: yes; legal: yes, no]
#Lastline=yes

# Specifies the size of the LCD.
# In case of multiple combined displays, this should be the total size.
Size=20x4

# For multiple combined displays: how many lines does each display have.
# Vspan=2,2 means both displays have 2 lines.
#vspan=2,2

# If you have an HD66712, a KS0073 or another 'almost HD44780-compatible',
# set this flag to get into extended mode (4-line linear).
#ExtendedMode=yes

# In extended mode, on some controllers like the ST7036 (in 3 line mode)
# the next line in DDRAM won't start 0x20 higher. [default: 0x20]
#LineAddress=0x10

# Character map to to map ISO-8859-1 to the LCD's character set
# [default: hd44780_default; legal: hd44780_default, hd44780_euro, ea_ks0073,
# sed1278f_0b, hd44780_koi8_r, hd44780_cp1251, hd44780_8859_5, upd16314 ]
# (hd44780_koi8_r, hd44780_cp1251, hd44780_8859_5 and upd16314 are possible if
# compiled with additional charmaps)
CharMap=hd44780_default

# If your display is slow and cannot keep up with the flow of data from
# LCDd, garbage can appear on the LCDd. Set this delay factor to 2 or 4
# to increase the delays. Default: 1.
DelayMult=4

# Some displays (e.g. vdr-wakeup) need a message from the driver to that it
# is still alive. When set to a value bigger then null the character in the
# upper left corner is updated every <KeepAliveDisplay> seconds. Default: 0.
#KeepAliveDisplay=0

# If you experience occasional garbage on your display you can use this
# option as workaround. If set to a value bigger than null it forces a
# full screen refresh <RefreshDiplay> seconds. Default: 0.
RefreshDisplay=0

# You can reduce the inserted delays by setting this to false.
# On fast PCs it is possible your LCD does not respond correctly.
# Default: true.
DelayBus=true

# If you have a keypad you can assign keystrings to the keys.
# See documentation for used terms and how to wire it.
# For example to give directly connected key 4 the string "Enter", use:
#   KeyDirect_4=Enter
# For matrix keys use the X and Y coordinates of the key:
#   KeyMatrix_1_3=Enter
#KeyMatrix_4_1=Enter
#KeyMatrix_4_2=Up
#KeyMatrix_4_3=Down
#KeyMatrix_4_4=Escape

# EOF


8) LCDd gestartet:

/etc/init.d/LCDd start


Leider löst dies nur ein flackern der Displaybeleuchtung im Sekundenbereich aus, danach geht diese aus und im Display ist nur blickendes Kästchen zu erkennen. Habe ich irgendetwas falsch gemacht?
FHEM - Debmatic - Zigbee2MQTT - Homekit

LuckyDay

was heißt denn bei dir
ZitatAuf dem Cubietruck läuft das aktelle Igor Image.

Kernel 3.4.107 oder 4.0.4
Wheezy, Jessie or Ubuntu?
No audio driver, IR, NAND, BT, HW video, I2C and SPI untested on 4.0 or higher

Kann dir gerade aber nicht helfen, das Thema an sich aber schon :)

Spezialtrick

Oh sorry.  ;D

Debian Whezzy mit dem Kernel 3.4.107.
FHEM - Debmatic - Zigbee2MQTT - Homekit

Spezialtrick

FHEM - Debmatic - Zigbee2MQTT - Homekit

avrnet

#4
Hi,

das Problem liegt an der Belegung der I2C Erweiterungsplatine. Diese ist leider nicht nach dem lcdproc Standard aufgebaut.

Da diese Erweiterungsmodule super günstig in der Bucht zu bekommen sind und ich hier einige von rumfliegen habe,
habe ich kurzerhand die Quellsourcen von lcdproc angepasst und das HD44780-I2C Modul (hd44780.so) neu kompiliert.

Kopiere dir die hier angehängte "hd44780.so" nach /usr/lib/lcdproc und schon sollte dein Display mit der I2C Erweiterungsplatine laufen.
Der Pfad könnte evt. auch ein anderer sein, man findet diesen für sein System in der "LCDd.conf" unter "DriverPath=............."

have fun

(//)

Spezialtrick

#5
Das ist ja wie Weihnachten und Ostern an einem Tag. :D

Vielen Danke für die Datei. Ich werde es morgen Abend ausprobieren.

Könntest du Vl. auch deine LDCd.conf posten?

EDIT:

Ich habe es doch sofort versucht und leider funktioniert es weiter hin nicht. Beim Booten leuchtet die LCD-Beleuchtung noch, dann fängt diese an nach gewisser Zeit an zu flackern und geht schließlich aus. Auf dem Display ist dann nur noch ein blickendes Rechteck zuerkennen.

Mein Display sieht auch etwas anders aus als deins. Klappt es denn trotzdem?



FHEM - Debmatic - Zigbee2MQTT - Homekit

Spezialtrick

Hallo avrnet,

mit der neuen Datei, die du hochgeladen hast funktioniert es einwandfrei.

Vielen Dank!
FHEM - Debmatic - Zigbee2MQTT - Homekit


Spezialtrick

Hast du noch einen Tipp für mich, wie ich beispielsweise Systemwerte wie CPU Auslastung etc anzeigen lassen kann? :)
FHEM - Debmatic - Zigbee2MQTT - Homekit

avrnet

Man benötigt einen Client zb. (lcdproc) der den Server (LCDd) mit Daten füttert.
Die Config für lcdproc findet man unter /etc/lcdproc.conf

- "LCDd" ist ein Serverdaemon der die Initialisierung des Displays übernimmt und anfragen von Clients entgegen nimmt und verarbeitet.
- "lcdproc" ist eine Clientanwendung, die den Server mit Daten für das Display füttert.

Das ganze System ist Netzwerkfähig (sogar Internetfähig bei entsprechenden Portforwarding im Router),
sprich man startet den Server auf der Hardware an der das Display angeschlossen ist
und kann von jedem beliebigen Linux Rechner der im Netzwerk hängt, Statusinformationen auf dem Display des Servers anzeigen lassen.

Spezialtrick

Ok. Ich werde mich mal daran versuchen.

Nochmals vielen Dank für deine Hilfe!
FHEM - Debmatic - Zigbee2MQTT - Homekit

Hackbard

SSSUUUPPPEEERR
Mensch, wie lange versuche ich jetzt exakt dieses dämliche LCD ans laufen zu bringen!
Nun geht es dank euch auch bei mir !  DDDAAANNKEEE  @ ALL

Super klasse. Mensch freu ich mich! =)