Odd IO errors with Scroll pHAT


#1

Hello,

I’m getting quite a few strange IO errors when running the script below.

It’s a simple script; adjust the brightness of a scrolling clock according to the time of day.

clock.py

#!/usr/bin/env python

import sys
import datetime
import time

import scrollphat

while True:
try:
now = datetime.datetime.now()
brightness = scrollphat.set_brightness(10)

    if now.hour >= 20 and now.hour <= 8:
       brightness = brightness / 2

    scrollphat.write_string(time.strftime("%H:%M     "))
    scrollphat.scroll(1)
    time.sleep(0.5)

except KeyboardInterrupt:
    scrollphat.clear()
    sys.exit(-1)

The script runs for a bit, then freezes.

A high number of IO Errors have occurred, please check your soldering/connections.

Traceback (most recent call last):
File “Pimoroni/scroll-phat/examples/clock.py”, line 12, in brightness = scrollphat.set_brightness(10)
File “/usr/lib/python3/dist-packages/scrollphat/init.py”, line 52, in set_brightness controller.set_brightness(brightness)
File “/usr/lib/python3/dist-packages/scrollphat/IS31FL3730.py”, line 71, in set_brightness self.bus.write_i2c_block_data(self.i2cConstants.I2C_ADDR, self.i2cConstants.CMD_SET_BRIGHTNESS, [self.brightness])

OSError: [Errno 121] Remote I/O error

The errors suggest that my soldering is to blame, which is entirely possible…

However, I’m not convinced, as it seems to be failing when passing an integer to the brightness parameter.

(Running the test-all.py script works fine and throws zero errors, which is another reason I’m not convinced it’s the soldering.)

So, I dumbed it down to just scroll the time:

clock2.py

#!/usr/bin/env python

import sys
import time

import scrollphat

brightness = scrollphat.set_brightness(5)

while True:
try:
scrollphat.write_string(time.strftime("%H:%M "))
scrollphat.scroll(1)
time.sleep(0.5)

except KeyboardInterrupt:
    scrollphat.clear()
    sys.exit(-1)

This works, no freezing, but again in the terminal window I get:

A high number of IO Errors have occurred, please check your soldering/connections.

With non of the Traceback hints.

To be fair, my python-fu is not that strong, so:

  • Is my script OK?
  • Should I care about IO errors in a terminal window.

Cheers,

Simon.


#2

Could you post a photo of your setup/soldering?

The Scroll pHAT code will tolerate a certain number of IO errors, but beyond that it’ll fail to avoid getting stuck in an endless loop with genuinely bad connections or even a pHAT not being connected at all.

It’s possible to tweak your code to catch OSError and just keep on trying until it works.


#3

Hi,

Thanks for the quick response.

I can post pics, but I’m going to have to take this apart first.

I’ll have to get back to you.

Cheers,

Simon.


#4

Zoiks! Judging from those pictures, it may be that your soldering is fine but that you’re getting issues with crosstalk between the i2c data/clock wires or noise coupled into the system from somewhere else. You might find it easier just to more aggressively ignore IO errors since you can always send a screen update again if it fails.


#5

Hi,

Well, I’m going to take it apart anyway, as I’ve just ordered the booster headers from you.

This will give me a bit more room at the top of the box as I’d previously had to lift the AIY HAT off the RaspIO board with extra long (11mm I think) headers.

Ordered a Scroll pHAT HD too, so I might chuck that in there for a test.

A weekend job methinks.

I’ll post back with pics.

Incidently, how can I ‘aggressively ignore IO errors’?

Cheers,

Simon.


#6

I still think that this may be something related:

File “/usr/lib/python3/dist-packages/scrollphat/init.py”, line 52, in set_brightness controller.set_brightness(brightness)
File “/usr/lib/python3/dist-packages/scrollphat/IS31FL3730.py”, line 71, in set_brightness self.bus.write_i2c_block_data(self.i2cConstants.I2C_ADDR, self.i2cConstants.CMD_SET_BRIGHTNESS, [self.brightness])

No ideas what though :)


#7

Another though (more on the build).
If you add the headers to the VoiceHAT for i2c, you’ll have 5V gnd and i2c’s in a nice row header, then use a the Dupont jumper cables or similar wiring to just the gpio holes on the scrollhathd when you get it. You may even be able to use a square black on the phat if 5V5 is down pin 4 and not pin 2.
That’ll get rid of that large ribbon cable .

(I’m sure the scrollhatHD needs 5V and not 3V3, but get it confirmed, that there in the line on the voiceHAT as well.)


#8

Hi,

Thanks for the tip.

I have one of the new Scroll pHAT HDs in a box somewhere.

When I get the time / inclination to take it apart again and install it instrad I will definitely go down this route.

Cheers,

Simon.


#9

OK, so I finally got around to dismantling the box to inspect the soldering.

This is the top of the FullpHAT board that allows for two HATs to be connected at once:

Same board but from a different angle:

The underside of the board:

The connections to the ScrollpHAT:

I replaced the overly long headers that I initially used with the correctly sized ones:

As you can see this reduces the overall height of the assembled boards and will give a bit more room between the top of the boards and the underside of the top of the case; it actually made a difference:

I think I’m going to draw a line under this now, as the unit runs headless and the errors do not in any way affect the running of it.

I’ll see if I get the same errors when I hook up a different HAT, probably in the way that @bensimmo suggested above as that way I’ll be able to remove the big fat coloured cable.

Thanks everyone for the advice and tips

Simon.