Display-O-Tron HAT i2c problem

Hi everybody,

I got my Display-O-Tron HAT up and running in no time using the setup script. So far so good, but now I am experiencing problems when using the backlight and graph LEDs. From the output there seems to be a problem with the I2C bus. Usually the problem is not recoverable, and I have to power cycle the PI.

Some of the stack traces I’m seeing:

Python 2.7.3 (default, Mar 18 2014, 05:13:23)
[GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from dothat import backlight
>>> backlight.set_bar(0, 255)
>>> backlight.set_bar(1, 255)
>>> backlight.set_bar(2, 255)
>>> backlight.update()
>>> backligh.set_graph(1.0)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: name 'backligh' is not defined
>>> backlight.set_graph(1.0)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python2.7/dist-packages/dothat/backlight.py", line 64, in set_graph
	cap._write_byte(cap1xxx.R_LED_POLARITY,   set_polarity)
  File "/usr/local/lib/python2.7/dist-packages/cap1xxx.py", line 477, in _write_byte
	self.i2c.write_byte_data(self.i2c_addr, register, value)
IOError: [Errno 5] Input/output error

In another session, after a power cycle:

>>> backlight.graph_off()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python2.7/dist-packages/dothat/backlight.py", line 34, in graph_off
	cap._write_byte(cap1xxx.R_LED_POLARITY,   0b00000000)
  File "/usr/local/lib/python2.7/dist-packages/cap1xxx.py", line 477, in _write_byte
	self.i2c.write_byte_data(self.i2c_addr, register, value)
IOError: [Errno 5] Input/output error

And another one:

>>> backlight.rgb(255, 0, 0)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python2.7/dist-packages/dothat/backlight.py", line 221, in rgb
	update()
  File "/usr/local/lib/python2.7/dist-packages/dothat/backlight.py", line 233, in update
	sn3218.output(leds)
  File "/usr/local/lib/python2.7/dist-packages/sn3218.py", line 95, in output
	i2c.write_i2c_block_data(address, CMD_SET_PWM_VALUES, [channel_gamma_table[i][values[i]] for i in range(18)])
IOError: [Errno 5] Input/output error

Any ideas, pointers on how to debug this? The LCD seems to work fine.

Kind Regards, Alex

Oh yeah, I’m running the latest Raspbian.

pi@raspberrypi ~ $ uname -a
Linux raspberrypi 3.18.11-v7+ #781 SMP PREEMPT Tue Apr 21 18:07:59 BST 2015 armv7l GNU/Linux 
pi@raspberrypi ~ $ cat /etc/debian_version
7.8

Looking into it!

What happens if you run one of our examples? Such as ( if you used the one line installer ):

sudo ./home/pi/Pimoroni/dot3k/dothat/basic/backlight.py

Right now the HAT seems to be happy again, both backlight.py and graph.py work fine. If I can get back into the error state, I’ll run them again and see what happens.