Odroid N2 OLED I2C / SPI driver

Great, is there a way to use it on odroid c2?

As far I’m aware the c2 gpio is pin compatible with the n2 so the connection should be the same, however it depends weather or not the c2 has I2C port 2 enabled in the dtb. I guess connect it, install the add-on and try it.

I don’t own a C2 so cannot confirm this nor have I tested this, so you do this at your own risk!!!

Don’t seem so:

CoreELEC:~/.kodi/temp # i2cdetect -l

i2c-1 i2c aml_i2c_adap1 I2C adapter

Ok, so it looks like the numbering is different, on the N2 pins 3,5 are named as I2C-2 where as on the C2 it looks like they are I2C-1.

If that is the case then the wiring should be the same but the add-on would need a code change to use SMBUS 1 instead of SMBUS 2.

Ok, great. Can I do it myself by editing?

First have the tried the add-on as it is now?

If it doesn’t work, then let me know and I’ll post a version with the changes for you in a few minutes.

Yes but display keeps dark. Anyway to check display?

Ok, uninstall the add-on completely and try this one.

service.odroidn2.oled_bus1.zip (161.1 KB)

1 Like

Sorry didn’t work. Old version also. Can’t install…

Here error from log:

2019-08-31 17:31:48.026 T:3184931712 NOTICE: service.odroidn2.oled v0.1.4 -> Service started
2019-08-31 17:31:48.032 T:3184931712 ERROR: EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<–
- NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
Error Type: <type ‘exceptions.IOError’>
Error Contents: [Errno 11] Resource temporarily unavailable
Traceback (most recent call last):
File “/storage/.kodi/addons/service.odroidn2.oled/service.py”, line 234, in
oled = OledAddon(monitor)
File “/storage/.kodi/addons/service.odroidn2.oled/service.py”, line 63, in init
self._settings.flipDisplay())
File “/storage/.kodi/addons/service.odroidn2.oled/lib/oled.py”, line 56, in init
self._initSSD1306_64()
File “/storage/.kodi/addons/service.odroidn2.oled/lib/oled.py”, line 107, in _initSSD1306_64
self._command(DISPLAYOFF)
File “/storage/.kodi/addons/service.odroidn2.oled/lib/oled.py”, line 69, in _command
self.bus.write_byte_data(self._i2c, 0x00, c)
File “/storage/.kodi/addons/service.odroidn2.oled/lib/smbus2.py”, line 391, in write_byte_data
ioctl(self.fd, I2C_SMBUS, msg)
IOError: [Errno 11] Resource temporarily unavailable
–>End of Python script error report<–
2019-08-31 17:31:48.326 T:3184931712 WARNING: CPythonInvoker(66, /storage/.kodi/addons/service.odroidn2.oled/service.py): the python script “/storage/.kodi/addons/service.odroidn2.oled/service.py” has left several classes in memory that we couldn’t clean up. The classes include: N14PythonBindings31XBMCAddon_xbmc_Monitor_DirectorE,N14PythonBindings30XBMCAddon_xbmc_Player_DirectorE

Try a reboot of the board.

Perhabs I made something wrong?

Why the output is like this:

CoreELEC:~/.kodi/temp # i2cdetect -y 1
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f
10: 10 11 12 13 14 15 16 17 18 19 1a 1b 1c 1d 1e 1f
20: 20 21 22 23 24 25 26 27 28 29 2a 2b 2c 2d 2e 2f
30: – -- – -- – -- – -- 38 39 3a 3b 3c 3d 3e 3f
40: 40 41 42 43 44 45 46 47 48 49 4a 4b 4c 4d 4e 4f
50: – -- – -- – -- – -- – -- – -- – -- – --
60: 60 61 62 63 64 65 66 67 68 69 6a 6b 6c 6d 6e 6f
70: 70 71 72 73 74 75 76 77

Should there only one adress?

Nothing changed

I disconnect display restart and type again:

CoreELEC:~ # i2cdetect -y 1
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f
10: 10 11 12 13 14 15 16 17 18 19 1a 1b 1c 1d 1e 1f
20: 20 21 22 23 24 25 26 27 28 29 2a 2b 2c 2d 2e 2f
30: – -- – -- – -- – -- 38 39 3a 3b 3c 3d 3e 3f
40: 40 41 42 43 44 45 46 47 48 49 4a 4b 4c 4d 4e 4f
50: – -- – -- – -- – -- – -- – -- – -- – --
60: 60 61 62 63 64 65 66 67 68 69 6a 6b 6c 6d 6e 6f
70: 70 71 72 73 74 75 76 77

That means something is wrong with dtb?

That definitely looks wrong to me, you should only have one device address listed.

Can you try i2cdetect -y 2 and i2cdetect -y 3 and post the results.

CoreELEC:/etc # i2cdetect -y 2
Error: Could not open file /dev/i2c-2' or /dev/i2c/2’: No such file or directory
CoreELEC:/etc # i2cdetect -y 3
Error: Could not open file /dev/i2c-3' or /dev/i2c/3’: No such file or directory

from C2 wiki:

H/W connection

I2CA (/dev/i2c-1)

Pin Number Net Name Export Number
3 I2CA.SDA 205
5 I2CA.SCL 206

I2CB (/dev/i2c-2)

Pin Number Net Name Export Number
27 I2CB.SDA 207
28 I2CB.SCL 208

should I try to connect at Pin 27,28 and then i2cdetect -2 ?

Ok try it but from your previous post bus 2 and 3 aren’t active on the c2. Unfortunately I can’t get i2c-tools installed on my N2 so I can’t test what the output should be. Do you know where I can i2c-tools from?

Sorry don’t know. Was preinstalled on my coreelec. Perhabs it was in addon systemtools…

Could you do a

ls /dev/i2c*

and post the output

CoreELEC:/etc # ls /dev/i2c*
/dev/i2c-1