User avatar
0xFF
Posts: 202
Joined: Tue Nov 20, 2012 7:52 pm
Location: Poland

Re: 20x2 I2C OLED character display and XBMC = nothing (solv

Thu Dec 18, 2014 7:44 am

I pushed patched hd44780.so driver to my github repo.

solaar1974
Posts: 5
Joined: Wed Dec 17, 2014 7:26 pm

Re: 20x2 I2C OLED character display and XBMC = nothing (solv

Thu Dec 18, 2014 7:31 pm

Everything works fine! Thank you very much for your help. Without you, I would not have coped with this problem. Good luck and thanks again !!! )))))

solaar1974
Posts: 5
Joined: Wed Dec 17, 2014 7:26 pm

Re: 20x2 I2C OLED character display and XBMC = nothing (solv

Mon Dec 22, 2014 10:29 pm

There is one more question:
How to set up on this screen display Cyrillic (Russian) character?
In Charmap from AndyPI

hd44780-charmap.h

Code: Select all

       120, 121, 122, 123, 124, 125, 126, 127,
        /* #128 */
        128, 129, 130, 131, 132, 133, 134, 135,
        136, 137, 138, 139, 140, 141, 142, 143,
        144, 145, 146, 147, 148, 149, 150, 151,
        152, 153, 154, 155, 156, 157, 158, 159,
        /* #160 */
        160,  33, 236, 237, 164,  92, 124, 167,
         34, 169, 170, 171, 172, 173, 174, 175,
        223, 177, 178, 179,  39, 228, 247, 165,
         44, 185, 186, 187, 188, 189, 190,  63,
        /* #192 */
         65,  65,  65,  65, 225,  65,  65,  67,
         69,  69,  69,  69,  73,  73,  73,  73,
         68, 238,  79,  79,  79,  79, 239, 120,
         48,  85,  85,  85, 245,  89, 240, 226,
        /* #224 */
         97,  97,  97,  97, 225,  97,  97,  99,
        101, 101, 101, 101, 105, 105, 105, 105,
        111, 238, 111, 111, 111, 111, 239, 253,
         48, 117, 117, 117, 245, 121, 240, 255
};

/*
 * Table for HD44780 controller with ROM mask supporting
 * the european charset (ROM code A02).
 *
 * Replacements:
 * 160 => 32, 168 => 34, 180 => 39, 184 => 44
 */
const unsigned char HD44780_euro_charmap[] = {
        /* #0 */
          0,   1,   2,   3,   4,   5,   6,   7,
          8,   9,  10,  11,  12,  13,  14,  15,
         16,  17,  18,  19,  20,  21,  22,  23,
         24,  25,  26,  27,  28,  29,  30,  31,
        /* #32 */
         32,  33,  34,  35,  36,  37,  38,  39,
         40,  41,  42,  43,  44,  45,  46,  47,
         48,  49,  50,  51,  52,  53,  54,  55,
         56,  57,  58,  59,  60,  61,  62,  63,
        /* #64 */
         64,  65,  66,  67,  68,  69,  70,  71,
         72,  73,  74,  75,  76,  77,  78,  79,
         80,  81,  82,  83,  84,  85,  86,  87,
         88,  89,  90,  91,  92,  93,  94,  95,
        /* #96 */
         96,  97,  98,  99, 100, 101, 102, 103,
        104, 105, 106, 107, 108, 109, 110, 111,
        112, 113, 114, 115, 116, 117, 118, 119,
        120, 121, 122, 123, 124, 125, 126, 127,
        /* #128 */
        128, 129, 130, 131, 132, 133, 134, 135,
        136, 137, 138, 139, 140, 141, 142, 143,
        144, 145, 146, 147, 148, 149, 150, 151,
        152, 153, 154, 155, 156, 157, 158, 159,
        /* #160 */
         32, 161, 162, 163, 164, 165, 166, 167,
         34, 169, 170, 171, 172, 173, 174, 175,
        176, 177, 178, 179,  39, 181, 182, 183,
         44, 185, 186, 187, 188, 189, 190, 191,
        /* #192 */
        192, 193, 194, 195, 196, 197, 198, 199,
        200, 201, 202, 203, 204, 205, 206, 207,
        208, 209, 210, 211, 212, 213, 214, 215,
        216, 217, 218, 219, 220, 221, 222, 223,
        /* #224 */
        224, 225, 226, 227, 228, 229, 230, 231,
        232, 233, 234, 235, 236, 237, 238, 239,
        240, 241, 242, 243, 244, 245, 246, 247,
        248, 249, 250, 251, 252, 253, 254, 255
};

/*
 * Electronic Assembly's KS0073 based LCDs table
 * http://www.lcd-module.de/eng/pdf/doma/dip204-4e.pdf
 *
 * This map is more similar to a ISO-8859-15, but with fractions from
 * ISO-8859-1 (0xBC, 0xBD).
 *
 * ~ (126) is mapped to right arrow, even though it exists, for
 * compatibility with some clients. 127 is left arrow.
 *
 * There's no backtick, substituded with '.
 *
 * | is substituted with another similar charachter as the code is
 * used by some serial drivers.
 *
 * Charset of the display offers a nice set of icons, they are mapped
 * from 128 to 159. I mapped these intervals to, in order: 16-28,
 * 140-151, 180-182, 187, 207, 222, 224.
 *
 * (C) 2006 Pillon Matteo <[email protected]>
 *
 */
const unsigned char EA_KS0073_charmap[] = {
        /* #0 */
          0,   1,   2,   3,   4,   5,   6,   7,
          8,   9,  10,  11,  12,  13,  14,  15,
         16,  17,  18,  19,  20,  21,  22,  23,
         24,  25, 223, 225,  28,  29,  30,  31,
        /* #32 */
         32,  33,  34,  35,  36,  37,  38,  39,
         40,  41,  42,  43,  44,  45,  46,  47,
         48,  49,  50,  51,  52,  53,  54,  55,
         56,  57,  58,  59,  60,  61,  62,  63,
        /* #64 */
         64,  65,  66,  67,  68,  69,  70,  71,
         72,  73,  74,  75,  76,  77,  78,  79,
         80,  81,  82,  83,  84,  85,  86,  87,
         88,  89,  90, 250, 251, 252,  29, 196,
        /* #96 */
         39,  97,  98,  99, 100, 101, 102, 103,
        104, 105, 106, 107, 108, 109, 110, 111,
        112, 113, 114, 115, 116, 117, 118, 119,
        120, 121, 122, 253, 218, 255, 206, 127,
        /* #128 */
         16,  17,  18,  19,  20,  21,  22,  23,
         24,  25,  26,  27,  28, 140, 141, 142,
        143, 144, 145, 146, 147, 148, 149, 150,
        151, 180, 181, 182, 187, 207, 222, 224,
        /* #160 */
        160,  64, 177, 161,  36, 163, 243,  95,
        248,  67, 170,  20, 172, 173,  82, 175,
        128, 140, 130, 131, 249, 143, 182, 221,
        244, 129, 128,  21, 139, 138, 190,  96,
        /* #192 */
        174, 226, 174, 174,  91, 174, 188, 169,
        197, 191, 198,  69,  73,  73,  73,  73,
         68,  93, 168, 228, 236,  79,  92, 120,
        171, 238, 229, 238,  94, 230, 178, 190,
        /* #224 */
        127, 231, 175, 175, 123, 175, 189, 200,
        164, 165, 199, 101, 167, 232, 105, 105,
        111, 125, 168, 233, 237, 111, 124,  58,
        172, 166, 234, 239, 126, 235, 178, 255
};

/*
 * Character mapping by Frank Jepsen <vdr_at_jepsennet.de>.
 */
const unsigned char SED1278F_0B_charmap[] = {
        /* #0 */
          0,   1,   2,   3,   4,   5,   6,   7,
          8,  32,  32,  32,  32,  32,  14,  15,
         16,  17,  18,  19,  20,  21,  22,  23,
         24,  25, 199, 200,  28,  29,  30,  31,
        /* #32 */
         32,  33,  39,  35,  36,  37,  38,  39,
         40,  41,  42,  43,  44,  45,  46,  47,
         48,  49,  50,  51,  52,  53,  54,  55,
         56,  57,  58,  59,  60,  61,  62,  63,
        /* #64 */
         64,  65,  66,  67,  68,  69,  70,  71,
         72,  73,  74,  75,  76,  77,  78,  79,
         80,  81,  82,  83,  84,  85,  86,  87,
         88,  89,  90,  91,  92,  93,  94,  95,
        /* #96 */
         96,  97,  98,  99, 100, 101, 102, 103,
        104, 105, 106, 107, 108, 109, 110, 111,
        112, 113, 114, 115, 116, 117, 118, 119,
        120, 121, 122, 123, 124, 125, 126, 127,
        /* #128 */
         64,  65,  66,  67,  68,  69,  70,  71,
         72,  73,  74,  75,  76,  77,  78,  79,
         80,  81,  82,  83,  84,  85,  86,  87,
         88,  89,  90,  91,  92,  93,  94,  95,
        /* #160 */
        124, 169, 164, 166, 175, 166, 124, 210,
        177, 207, 178, 187,  44,  44, 206, 191,
        178,  16,  30,  31, 180, 234, 211, 205,
         44, 180, 178, 188, 182, 181, 245, 159,
        /* #192 */
         65,  65,  65, 170, 142, 143, 146, 128,
         69, 144,  69,  69,  73,  73,  73,  73,
        245, 156,  79,  79,  79, 172, 153, 183,
        174,  85,  85,  85, 154,  89, 220, 224,
        /* #224 */
        133, 160, 131, 171, 132, 134, 145, 135,
        138, 130, 136, 137, 141, 161, 140, 139,
         32, 155, 149, 162, 147, 173, 148, 184,
        175, 151, 163, 150, 129, 121,  32, 253
};

#ifdef EXTRA_CHARMAPS
/*
 * Table for HD44780 controller with ROM mask supporting
 * the european charset (ROM code A02).
 *
 * Russian KOI8-R codepage as input
 */
const unsigned char HD44780_KOI8R_charmap[] = {
        /* #0 */
          0,   1,   2,   3,   4,   5,   6,   7,
          8,   9,  10,  11,  12,  13,  14,  15,
         16,  17,  18,  19,  20,  21,  22,  23,
         24,  25,  26,  27,  28,  29,  30,  31,
        /* #32 */
         32,  33,  34,  35,  36,  37,  38,  39,
         40,  41,  42,  43,  44,  45,  46,  47,
         48,  49,  50,  51,  52,  53,  54,  55,
         56,  57,  58,  59,  60,  61,  62,  63,
        /* #64 */
         64,  65,  66,  67,  68,  69,  70,  71,
         72,  73,  74,  75,  76,  77,  78,  79,
         80,  81,  82,  83,  84,  85,  86,  87,
         88,  89,  90,  91,  92,  93,  94,  95,
        /* #96 */
         96,  97,  98,  99, 100, 101, 102, 103,
        104, 105, 106, 107, 108, 109, 110, 111,
        112, 113, 114, 115, 116, 117, 118, 119,
        120, 121, 122, 123, 124, 125, 126, 127,
        /* #128 */
         45, 124,  43,  43,  43,  43,  43,  43,       /* ─ │ ┌ ┐ └ ┘ ├ ┤ */
         43,  43,  43,  32,  32,  32,  32,  32,       /* ┬ ┴ ┼ ▀ ▄ █ ▌ ▐ */
        144, 145, 146, 147, 148, 149, 150, 126,       /*               ≈ */
         28,  29, 154, 155, 176, 157, 183, 247,       /* ≤ ≥     °   · ÷ */
        /* #160 */
        160, 161, 162, 203, 164, 165, 166, 167,       /*       ё         */
        168, 169, 170, 171, 172, 173, 174, 175,
        176, 177, 178, 203, 180, 181, 182, 183,       /*       Ё         */
        184, 185, 186, 187, 188, 189, 190, 169,       /*               © */
        /* #192 */
        172,  65, 128, 137, 129,  69, 216, 146,       /* ю а б ц д е ф г */
         88, 132, 133,  75, 134,  77,  72,  79,       /* х и й к л м н о */
        135, 173,  80,  67,  84, 136, 130,  66,       /* п я р с т у ж в */
         98, 142, 131, 139, 143, 140, 138, 141,       /* ь ы з ш э щ ч ъ */
        /* #224 */
        172,  65, 128, 137, 129,  69, 216, 146,       /* Ю А Б Ц Д Е Ф Г */
         88, 132, 133,  75, 134,  77,  72,  79,       /* Х И Й К Л М Н О */
        135, 173,  80,  67,  84, 136, 130,  66,       /* П Я Р С Т У Ж В */
         98, 142, 131, 139, 143, 140, 138, 141        /* Ь Ы З Ш Э Щ Ч Ъ */
};

/*
 * Table for HD44780 controller with ROM mask supporting
 * the european charset (ROM code A02).
 *
 * Russian CP-1251 codepage as input
 */
const unsigned char HD44780_CP1251_charmap[] = {
        /* #0 */
          0,   1,   2,   3,   4,   5,   6,   7,
          8,   9,  10,  11,  12,  13,  14,  15,
         16,  17,  18,  19,  20,  21,  22,  23,
         24,  25,  26,  27,  28,  29,  30,  31,
        /* #32 */
         32,  33,  34,  35,  36,  37,  38,  39,
         40,  41,  42,  43,  44,  45,  46,  47,
         48,  49,  50,  51,  52,  53,  54,  55,
         56,  57,  58,  59,  60,  61,  62,  63,
        /* #64 */
         64,  65,  66,  67,  68,  69,  70,  71,
         72,  73,  74,  75,  76,  77,  78,  79,
         80,  81,  82,  83,  84,  85,  86,  87,
         88,  89,  90,  91,  47,  93,  94,  95,
        /* #96 */
         96,  97,  98,  99, 100, 101, 102, 103,
        104, 105, 106, 107, 108, 109, 110, 111,
        112, 113, 114, 115, 116, 117, 118, 119,
        120, 121, 122, 123, 124, 125, 126, 127,
        /* #128 */
        141, 146,  44, 146,  34,  95,  43,  35,       /* Ђ Ѓ ‚ ѓ „ … † ‡ */
        158,  37, 134,  60,  72,  75,  72, 137,       /* € ‰ Љ ‹ Њ Ќ Ћ Џ */
        144, 145, 146, 147, 148, 149, 150, 151,
        152,  84, 156,  62, 156, 157, 158, 159,       /*   ™   ›         */
        /* #160 */
        160, 161, 162, 163, 164, 165, 124, 167,       /*         ¤   ¦ § */
        203, 169,  69, 171,  32,  32, 174, 207,       /* Ё © Є «     ® Ї */
        176, 177, 178, 179, 180, 181, 182, 183,       /* ° ±       µ ¶ · */
        203,  78,  69, 187, 188, 189, 190, 207,       /* ё № є »       ї */
        /* #192 */
         65, 128,  66, 146, 129,  69, 130, 131,       /* А Б В Г Д Е Ж З */
        132, 133,  75, 134,  77,  72,  79, 135,       /* И Й К Л М Н О П */
         80,  67,  84, 136, 216,  88, 137, 138,       /* Р С Т У Ф Х Ц Ч */
        139, 140, 141, 142,  98, 143, 172, 173,       /* Ш Щ Ъ Ы Ь Э Ю Я */
        /* #224 */
         65, 128,  66, 146, 129,  69, 130, 131,       /* а б в г д е ж з */
        132, 133,  75, 134,  77,  72,  79, 135,       /* и й к л м н о п */
         80,  67,  84, 136, 216,  88, 137, 138,       /* р с т у ф х ц ч */
        139, 140, 141, 142,  98, 143, 172, 173        /* ш щ ъ ы ь э ю я */
};

/*
 * Table for HD44780 controller with ROM mask supporting
 * the european charset (ROM code A02).
 *
 * Russian ISO 8859-5 codepage as input
 */
const unsigned char HD44780_ISO_8859_5_charmap[] = {
        /* #0 */
          0,   1,   2,   3,   4,   5,   6,   7,
          8,   9,  10,  11,  12,  13,  14,  15,
         16,  17,  18,  19,  20,  21,  22,  23,
         24,  25,  26,  27,  28,  29,  30,  31,
        /* #32 */
         32,  33,  34,  35,  36,  37,  38,  39,
         40,  41,  42,  43,  44,  45,  46,  47,
         48,  49,  50,  51,  52,  53,  54,  55,
         56,  57,  58,  59,  60,  61,  62,  63,
   
that I've put in the folder with the lcdproc driver is a symbol of all encodings, why did not he picks them up.
Change charmap encoding on cp1251 or ISO 8859-5 or KOI8R in LCDd.conf :

Code: Select all

# 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_koi8_r
#CharMap=hd44780_euro
#CharMap=ea_ks0073
#CharMap=hd44780_8859_5
#CharMap=upd16314
CharMap=hd44780_cp1251
and restart lcdproc:

Code: Select all

sudo /etc/init.d/LCDd restart
Gives an error:

Code: Select all

Restarting LCDd: ERROR mpdlcd.lcdrunner Found exception telnet connection closed, exiting.
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/mpdlcd/lcdrunner.py", line 89, in run
    self.update()
  File "/usr/local/lib/python2.7/dist-packages/mpdlcd/utils.py", line 64, in decorated
    return fun(instance, *args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/mpdlcd/lcdrunner.py", line 79, in update
    self.pattern.hook_changed(hook_name, new_data)
  File "/usr/local/lib/python2.7/dist-packages/mpdlcd/display_pattern.py", line 151, in hook_changed
    field.hook_changed(hook, widget, new_data)
  File "/usr/local/lib/python2.7/dist-packages/mpdlcd/display_fields.py", line 111, in hook_changed
    self.time_changed(widget, elapsed, total)
  File "/usr/local/lib/python2.7/dist-packages/mpdlcd/display_fields.py", line 222, in time_changed
    widget.set_text(txt)
  File "/usr/local/lib/python2.7/dist-packages/lcdproc/widgets.py", line 39, in set_text
    self.update()
  File "/usr/local/lib/python2.7/dist-packages/lcdproc/widgets.py", line 21, in update
    self.screen.server.request('widget_set %s %s %s %s "%s"' % (self.screen.ref, self.ref, self.x, self.y, self.text))
  File "/usr/local/lib/python2.7/dist-packages/lcdproc/server.py", line 48, in request
    response = urllib.unquote(self.tn.read_until("\n"))
  File "/usr/lib/python2.7/telnetlib.py", line 293, in read_until
    return self._read_until_with_poll(match, timeout)
  File "/usr/lib/python2.7/telnetlib.py", line 342, in _read_until_with_poll
    return self.read_very_lazy()
  File "/usr/lib/python2.7/telnetlib.py", line 454, in read_very_lazy
    raise EOFError, 'telnet connection closed'
EOFError: telnet connection closed
INFO mpdlcd.lcdrunner Exiting: removing screen MPD
Traceback (most recent call last):
  File "/usr/local/bin/mpdlcd", line 10, in <module>
    cli.main(sys.argv)
  File "/usr/local/lib/python2.7/dist-packages/mpdlcd/cli.py", line 475, in main
    'pattern', 'patterns', 'retry_attempts', 'retry_backoff', 'retry_wait'))
  File "/usr/local/lib/python2.7/dist-packages/mpdlcd/cli.py", line 240, in run_forever
    runner.run()
  File "/usr/local/lib/python2.7/dist-packages/mpdlcd/lcdrunner.py", line 96, in run
    self.quit()
  File "/usr/local/lib/python2.7/dist-packages/mpdlcd/lcdrunner.py", line 83, in quit
    self.lcd.del_screen(self.lcdproc_screen)
  File "/usr/local/lib/python2.7/dist-packages/lcdproc/server.py", line 90, in del_screen
    self.request("screen_del %s" % (ref))
  File "/usr/local/lib/python2.7/dist-packages/lcdproc/server.py", line 45, in request
    self.tn.write(command_string + "\n")
  File "/usr/lib/python2.7/telnetlib.py", line 282, in write
    self.sock.sendall(buffer)
  File "/usr/lib/python2.7/socket.py", line 224, in meth
    return getattr(self._sock,name)(*args)
socket.error: [Errno 32] Broken pipe
LCDd.
[1]+  Exit 1                  sudo mpdlcd --no-syslog
[email protected]:~$
It works under the scheme : mpd > mpdlcd> lcdproc> display?
Where to look for the error and fix it to work properly?

User avatar
0xFF
Posts: 202
Joined: Tue Nov 20, 2012 7:52 pm
Location: Poland

Re: 20x2 I2C OLED character display and XBMC = nothing (solv

Sat Jan 03, 2015 10:04 pm

Run LCDd in foreground to see debug info

Code: Select all

LCDd -f
Hope that helps.

solaar1974
Posts: 5
Joined: Wed Dec 17, 2014 7:26 pm

Re: 20x2 I2C OLED character display and XBMC = nothing (solv

Tue Jan 13, 2015 3:17 am

Code: Select all

[email protected]:~$ sudo LCDd -f
LCDd 0.5.5, LCDproc Protocol 0.3
Part of the LCDproc suite
Copyright (C) 1998-2010 William Ferrell, Selene Scriven
                        and many other contributors

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

hd44780: Charmap hd44780_cp1251 is unknown
hd44780: Available charmaps:
 hd44780_default
 hd44780_euro
 ea_ks0073
 sed1278f_0b
 none
Driver [hd44780] init failed, return code -1
Could not load driver hd44780
There is no output driver
Critical error while initializing, abort.
[email protected]:~$

Arcoruig
Posts: 4
Joined: Sat May 02, 2015 6:34 pm

Re: 20x2 I2C OLED character display and XBMC = nothing (solv

Sat May 02, 2015 7:17 pm

I'm using the same display als Gluck, a Wide.HK 20x4 Op204i

Using the guides in this thread I've managed to get the display working on Volumio 1.55, Only I get just 2 rows.
I replaced the LCDd.conf form the Github, changed the driver location to the right point. Replaced the hd44780-i2c.c & hd44780.so files. Modified LCDd.conf to 20x4 size and uncomment ExtendedMode=yes.

If I read it correct, maybe the init string for the 20x4 Oled is different compared to the 20x2. But I don't now what to change in, I think, the hd44780-i2c.c file for getting all the four rows active.

Somebody an idea?

Much appreciated,
AR

Gluck
Posts: 3
Joined: Wed Oct 15, 2014 5:45 pm

Re: 20x2 I2C OLED character display and XBMC = nothing (solv

Tue May 05, 2015 12:51 pm

I hope this helps.
< my changes
> original file

Code: Select all

[email protected] / # diff /home/pi/lcdproc/lcdproc-0.5.6/server/drivers/hd44780-i2c.c /home/pi/RPi-OLED-Display-SSD1311-master/hd44780-i2c.c
99c99
< #define DEFAULT_DEVICE                "/dev/i2c-1"
---
> #define DEFAULT_DEVICE                "/dev/i2c-0"
171,173c171
<       data[1] = 0xC0;  // 0x5C set Vdd
<       i2c_out(p, data);
<       data[1] = 0x00;
---
>       data[1] = 0x5C;  // 0x5C set Vdd
192c190
<       data[1] = 0x09;         // **** Set 5-dot, 3 or 4 line(0x09;, 1 or 2 line(0x08;
---
>       data[1] = 0x08;         // **** Set 5-dot, 3 or 4 line(0x09;, 1 or 2 line(0x08;
197,202d194
<       data[1] = 0x72;
<       i2c_out(p, data);
<       data[1] = 0xC0;
<       i2c_out(p, data);
<       data[1] = 0x01;
<       i2c_out(p, data);
211c203
<       data[1] = 0xDC;         // **** Set ROM
---
>       data[1] = 0x72;         // **** Set ROM
221,230c213,216
<       data[1] = 0x81;         // **** Set Contrast
<       i2c_out(p, data);
<       data[1] = 0x01;
<       i2c_out(p, data);
<       data[1] = 0x8F;
<       i2c_out(p, data);
<
<       data[1] = 0xF1;
<       i2c_out(p, data);
<
---
>       //data[1] = 0x81;       // **** Set Contrast
>       //i2c_out(p, data);
>       //data[1] = 0x50;
>       //i2c_out(p, data);
246,247c232,236
<
<       data[1] = 0x06;         // **** Set Entry Mode
---
>       data[1] = 0x2A;
>       i2c_out(p, data);
>       data[1] = 0x6;          // **** Set Entry Mode
>       i2c_out(p, data);
>       data[1] = 0x08;
249a239
>       i2c_out(p, data);

Arcoruig
Posts: 4
Joined: Sat May 02, 2015 6:34 pm

Re: 20x2 I2C OLED character display and XBMC = nothing (solv

Tue May 05, 2015 5:15 pm

Thnx, i made the changes, as best as i could do, but unfortunately the display only show's the upper two rows.
Can you maybe post your complete hd44780-i2c.c file?

Or is the hd44780.so driver file different for a 20x4 OLED then for a 20x2 OLED.

Arco

infinity85
Posts: 10
Joined: Thu May 28, 2015 11:52 am

Re: 20x2 I2C OLED character display and XBMC = nothing

Thu May 28, 2015 12:32 pm

0xFF wrote:For fun with XBMC, you need to download lcdproc sources from http://www.lcdproc.org/ and patch hd44780-i2c.c file
like I did here: https://github.com/0xFACE/RPi-OLED-Disp ... 4780-i2c.c

I'm not good coder, so it is just dirty hack for hdd44780-i2c driver.

Build sources, copy hd44780.so file to /usr/lib/lcdproc (overwrite original file) , setup /etc/LCDd.conf and .xbmc/userdataLCD.xml, install lcdproc plugin for xbmc.
Now start your favorite music/video and enjoy your brand new display ;-)
Glad I found this thread here :)
I've also bought the wide.hk 20x4 OLED Display (Op204i) http://www.ebay.com/itm/161575128497

Now, as I am a newbie, I would like to know a bit more exactly how to get it working in XBMC/Kodi on OpenELEC or RaspBMC(OSMC) on my Raspberry PI 2 (1GB RAM)

There I have some questions:

1. Can I connect the Display directly to my PI with 4 wires without any resistors, because it has fortunately 3.3V?
2. 0xFF, if I download your github-files, what do you mean with "build sources"? I thought that you did everything already, so everything should be prepared, isn't it? :/
3. Where can I find the /usr/lib/lcdproc and /etc/ directories on OpenELEC for Raspberry 2?
4. What do you mean with "setup /etc/LCDd.conf and .xbmc/userdata/LCD.xml"? Do you mean to adjust the display size in an editor and then copy the file in those directories?
5. What do I do with the hd44780-i2c.c file? I assume this should be the source file and you compiled it with the result of getting the patched hd44780.so file, right? This brings me to question 2. again: The provided files by you are patched and shall work already, right?
  • In particular those values in LCDd.conf: ExtendedMode=yes and Size=20x4
  • And which values in LCD.xml then? Apparently it should work without editing this file, right?
6. Is there anything else I have to initialize or to start the I2C Interface? Or is it enabled by default? How does OpenELEC know to which pins/adress it has to send the informations to, which have to be displayed?

I am really sorry for my noob questions. I am just a bloody beginner and don't want to burn the LCD or my PI :-/. I'm really looking forward to hearing from you and besides this you've done a great job, as I can read in this thread :) :) :)

Best regards
infinity


Edit: Oh I guess I will also need to compile the driver especially for the RPi-2, as these Files here are for RPi-1? Especially the hd44780.so will have to be newly made by me, right? For my understanding: This has to be done directly on the RPi-2, not on my desktop machine or so, right?
What commands do I need for that? I can SSH into my Pi, but I'm not sure whether OpenELEC has the functions included for compiling files, as it is quite minimalistic linux hmmm... Would appreciate here some help also :(

User avatar
0xFF
Posts: 202
Joined: Tue Nov 20, 2012 7:52 pm
Location: Poland

Re: 20x2 I2C OLED character display and XBMC = nothing

Thu May 28, 2015 5:20 pm

1. Yes, you can connect the display directly to the Pi. It works @ 3.3V.
2. You can download my hd44780.so file if you don't know how to build driver from sources. It works with RPi2.
3. I'm not familiar with OpenELEC.
4. Yes, you have to edit config files.

infinity85
Posts: 10
Joined: Thu May 28, 2015 11:52 am

Re: 20x2 I2C OLED character display and XBMC = nothing

Thu May 28, 2015 5:43 pm

0xFF wrote:1. Yes, you can connect the display directly to the Pi. It works @ 3.3V.
2. You can download my hd44780.so file if you don't know how to build driver from sources. It works with RPi2.
3. I'm not familiar with OpenELEC.
4. Yes, you have to edit config files.
Wow thanks! fast reply :) I will try it.

You you give me a hint how you compiled it anyway? Respectively give me a link with some hints about it. On which system did you compile the driver, because I would like to know on which system it is working for sure ;)

Are you sure it works on Raspberry PI 2? I am so curious because somebody made here a similar approach (different display) and provides two different *.so files for the two Pi's (http://www.sknorrell.de/blog/lcd-displa ... pberry-pi/)

User avatar
0xFF
Posts: 202
Joined: Tue Nov 20, 2012 7:52 pm
Location: Poland

Re: 20x2 I2C OLED character display and XBMC = nothing

Thu May 28, 2015 6:00 pm

infinity85 wrote: Wow thanks! fast reply :) I will try it.

You you give me a hint how you compiled it anyway? Respectively give me a link with some hints about it. On which system did you compile the driver, because I would like to know on which system it is working for sure ;)

Are you sure it works on Raspberry PI 2? I am so curious because somebody made here a similar approach (different display) and provides two different *.so files for the two Pi's (http://www.sknorrell.de/blog/lcd-displa ... pberry-pi/)
Yes, I'm sure. It works with RPi2.
If you really want to compile driver:
Download code from http://sourceforge.net/projects/lcdproc/files/lcdproc/
Replace hd44780-i2c.c file with my patched version.
Build code.
Copy hd44780.so to /usr/lib/lcdproc.

infinity85
Posts: 10
Joined: Thu May 28, 2015 11:52 am

Re: 20x2 I2C OLED character display and XBMC = nothing

Thu May 28, 2015 7:34 pm

0xFF wrote:
infinity85 wrote: Wow thanks! fast reply :) I will try it.

You you give me a hint how you compiled it anyway? Respectively give me a link with some hints about it. On which system did you compile the driver, because I would like to know on which system it is working for sure ;)

Are you sure it works on Raspberry PI 2? I am so curious because somebody made here a similar approach (different display) and provides two different *.so files for the two Pi's (http://www.sknorrell.de/blog/lcd-displa ... pberry-pi/)
Yes, I'm sure. It works with RPi2.
If you really want to compile driver:
Download code from http://sourceforge.net/projects/lcdproc/files/lcdproc/
Replace hd44780-i2c.c file with my patched version.
Build code.
Copy hd44780.so to /usr/lib/lcdproc.
Okay, thank you very much :) I will try to get it running with your files at first. Could you tell me, which operating system you are using your XBMC on, anyway? Did you built your drivers on RaspBian or another system?

Wish you a good evening :)

User avatar
0xFF
Posts: 202
Joined: Tue Nov 20, 2012 7:52 pm
Location: Poland

Re: 20x2 I2C OLED character display and XBMC = nothing (solv

Thu May 28, 2015 8:00 pm

I use Xbian for XBMC.
I build my drivers on RaspBian or Xbian - don't remember, but Xbian is based on Raspbian, so it's doesn't matter.

infinity85
Posts: 10
Joined: Thu May 28, 2015 11:52 am

Re: 20x2 I2C OLED character display and XBMC = nothing (solv

Thu May 28, 2015 8:42 pm

0xFF wrote:I use Xbian for XBMC.
I build my drivers on RaspBian or Xbian - don't remember, but Xbian is based on Raspbian, so it's doesn't matter.

Thanks for the info :)

The display works! The text is somehow not refreshing the right way and old text crashes with new one, but I will figure it out later! Thank you for your driverpatch and the quick help here :)

Have a nice evening 0xFF

infinity85
Posts: 10
Joined: Thu May 28, 2015 11:52 am

Re: 20x2 I2C OLED character display and XBMC = nothing (solv

Thu May 28, 2015 11:09 pm

Well... after playing around with the display I got really odd behaviour, which is quite a mixed issue of what Gluck and Arcoruig encountered.

Both have my Display (Op204i):

1. If I set #ExtendedMode=yes (which means, that extended is disabled) then I have only first 2 lines, but those two lines work properly!

2. If I uncomment ExtendedMode=yes (which means, that extended is enabled) then I get all 4 lines, but those four lines are of this kind:

input:

Code: Select all

Hello="12345678901234567890"
Hello="09876543210987654321"
Hello="ABCDEFGHIJKLMNOPQRST"
Hello="abcdefghijklmnopqrst"
Display shows:

Code: Select all

12345678901234567890
MNOPQRSTIJKL
09876543210987654321
mnopqrstijkl
So totally contrary to the effect, that Gluck has with this setting.

I set 20x4 as display size, so this can't be the problem hmmm... Apparently you made some changes to the patched driver, after Gluck hat success with the ExtendedMode-setting? That is probably why Arcoruig and me have problems with the Op204i?

Arcoruig
Posts: 4
Joined: Sat May 02, 2015 6:34 pm

Re: 20x2 I2C OLED character display and XBMC = nothing (solv

Fri May 29, 2015 6:12 am

Hi, I still have issues with this display. probably driver related.
I currently use it as 20x2 without any problems, but only the upper two lines are working.

I'm currently to busy with my company so lesser time for looking into this. I think we probably need a modified hd44780.so file for these 20x4 display.

Grtz Arco

infinity85
Posts: 10
Joined: Thu May 28, 2015 11:52 am

Re: 20x2 I2C OLED character display and XBMC = nothing (solv

Fri May 29, 2015 1:54 pm

hd44780-i2c_[Op204i].zip
modified hd44780-i2c.c to suit 20x4 Oled [wide.hk Op204i]

EDIT: File is completely faulty.... Please look further down to my post, where I uploaded working drivers!
(2.91 KiB) Downloaded 41 times
Arcoruig wrote:Hi, I still have issues with this display. probably driver related.
I currently use it as 20x2 without any problems, but only the upper two lines are working.

I'm currently to busy with my company so lesser time for looking into this. I think we probably need a modified hd44780.so file for these 20x4 display.

Grtz Arco
Now I found a bit time to look into Glucks posted code changes. They are referring to 0xFF's hd44780-i2c.c file, not to the original LCDproc file. That confused me at first.

Indeed there are some changes, especially following change is the cause for our two lines in 20x4 problem:

Provided by Gluck

Code: Select all

< my changes
> original file [0xFF's patched file]
192c190
<       data[1] = 0x09;         // **** Set 5-dot, 3 or 4 line(0x09;, 1 or 2 line(0x08;
---
>       data[1] = 0x08;         // **** Set 5-dot, 3 or 4 line(0x09;, 1 or 2 line(0x08;
I maintained all the changes of Gluck into 0xFF's file and now only need to compile it. Still don't know how to manage this, but I will try it today evening on raspbian perhaps. I guess I will fail many times, as I totally don't know anything about where to get all those files from:

Code: Select all

#include "hd44780-i2c.h"
#include "hd44780-low.h"

#include "report.h"
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include <stdio.h>
#include <string.h>
#include <errno.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/ioctl.h>

#ifdef HAVE_DEV_IICBUS_IIC_H
#include <dev/iicbus/iic.h>
#else /* HAVE_LINUX_I2C_DEV_H */
#include <linux/i2c-dev.h>
/* I2C_SLAVE is missing in linux/i2c-dev.h from kernel headers of 2.4.x kernels */
#ifndef I2C_SLAVE
#define I2C_SLAVE 0x0703  /* Change slave address */
#endif
#endif
I guess except the first two files (which have to be taken out of LCDproc's driver directory) the others seem to be part of the system or the gcc compiler or development tools. Unfortunately it's too noobie to get answers about those compiling thing in this thread, but the most complicated stuff was solved by 0xFF and Gluck, so the rest won't be unsolvable anymore I think ;)

That's the modified hd44780-i2c.c file for Op204i, that has to be compiled:
[attachment=0]hd44780-i2c_[Op204i].zip[/attachment]
Last edited by infinity85 on Tue Jun 02, 2015 2:17 pm, edited 2 times in total.

User avatar
0xFF
Posts: 202
Joined: Tue Nov 20, 2012 7:52 pm
Location: Poland

Re: 20x2 I2C OLED character display and XBMC = nothing (solv

Fri May 29, 2015 2:46 pm

These displays require different init codes. The init sequence is hard-coded in hd44780-i2c.c file.
So you need build driver yourself or ask Gluck for compiled version.
My hd44780.so is just for 16x2 display, no other will work.

infinity85
Posts: 10
Joined: Thu May 28, 2015 11:52 am

Re: 20x2 I2C OLED character display and XBMC = nothing (solv

Fri May 29, 2015 10:19 pm

0xFF wrote:These displays require different init codes. The init sequence is hard-coded in hd44780-i2c.c file.
So you need build driver yourself or ask Gluck for compiled version.
My hd44780.so is just for 16x2 display, no other will work.
Ouh it's okay, I did not ask you about compiling it for me. But now you put me into something... Since the hd44780-i2c.c that I uploaded has all the changes from Gluck, anybody could compile it or not? I mean...my understanding is, that you don't need the display hooked up to the Pi while compiling and the display is not necessary for compiling, its just the adapted hd44780-i2c.c chich should be needed?


EDIT:

Okay, tried to compile, but get this error all the time:

Code: Select all

[email protected] ~/hd44780 $ gcc hd44780-i2c.c -o hd44780.so
In file included from hd44780-i2c.c:20:0:
hd44780-low.h:240:17: error: field ‘pressed_key_time’ has incomplete type
  struct timeval pressed_key_time;/**< Time the key was pressed first */
I do not see anything strange in the described file... did you have similar errors while compiling? I use gcc 4.8 on raspbian and LCDproc 0.57


EDIT #2:

I uncommented the erroneous line and then the build process ends with following error :(

Code: Select all

[email protected] ~/hd44780 $ gcc hd44780-i2c.c -o hd44780.so
/usr/bin/ld: cannot open output file hd44780.so: Permission denied
collect2: ld returned 1 exit status
[email protected] ~/hd44780 $
and this with sudo:

Code: Select all

[email protected] ~/hd44780 $ sudo gcc hd44780-i2c.c -o hd44780.so                 /usr/lib/gcc/arm-linux-gnueabihf/4.6/../../../arm-linux-gnueabihf/crt1.o: In function `_start':
(.text+0x34): undefined reference to `main'
collect2: ld returned 1 exit status
[email protected] ~/hd44780 $
does somebody have any idea what that means? There is no built output file hd44780.so that i can find in any folder :roll:

User avatar
0xFF
Posts: 202
Joined: Tue Nov 20, 2012 7:52 pm
Location: Poland

Re: 20x2 I2C OLED character display and XBMC = nothing

Sat May 30, 2015 7:22 pm

Download code from http://sourceforge.net/projects/lcdproc/files/lcdproc/
Replace hd44780-i2c.c file with patched version.
Build code:

Code: Select all

./configure --enable-drivers=hd44780
make
Copy hd44780.so to /usr/lib/lcdproc.

infinity85
Posts: 10
Joined: Thu May 28, 2015 11:52 am

Re: 20x2 I2C OLED character display and XBMC = nothing

Mon Jun 01, 2015 9:31 pm

0xFF wrote:Download code from http://sourceforge.net/projects/lcdproc/files/lcdproc/
Replace hd44780-i2c.c file with patched version.
Build code:

Code: Select all

./configure --enable-drivers=hd44780
make
Copy hd44780.so to /usr/lib/lcdproc.
You saved my live, 0xFF :lol:

Thanks again a looooot! The display is finally working properly with all four lines! I can't say again how happy I am about your approach with the initial 20x2 driver and then the modification of Gluck, which was completely correct and essential to get it working :). Guys, It's really a privilege to have people with your skills.
Op204i-20x4_patched_driver_SSD1311.zip
The file was compiled on a Raspberry Pi 2, running Raspbian 2015-05-05 (Kernel 3.18)
Confirmed running under OpenELEC 5.08
Please adjust for your case LCDd.conf: "DriverPath=/..."
(38.41 KiB) Downloaded 85 times
Tags: wide.hk 2004 I2C Op204i 20x4 OLED

Arcoruig
Posts: 4
Joined: Sat May 02, 2015 6:34 pm

Re: 20x2 I2C OLED character display and XBMC = nothing (solv

Fri Jun 05, 2015 6:41 am

Hi, just tried your file and it works flawlessly on a RPi B 512MB

Thanks!

Arco

Return to “Troubleshooting”