Advertisements

Archive for February 19th, 2018

Streaming Radio Player: OLED Garble

Even in the dim light of dawn, it’s obvious¬†slowing the SPI clock to 1 MHz didn’t quite solve the problem:

RPi OLED display - garbled

RPi OLED display – garbled

The display started up fine, became encrypted during the next few hours, and remained garbled as the track information changed. This is almost certainly a bad SPI transfer trashing the OLED module’s control registers.

Dropping the clock to the absolute minimum of 0.5 MHz didn’t help, either:

serial = spi(device=0,port=0,bus_speed_hz=500000)
device = sh1106(serial)

This particular display woke up blank after loading the new code, then worked OK after another reset. The other streamers lit up as expected on the first try, so the slower SPI isn’t making the situation instantly worse.

Running the clock at 1 MHz definitely reduced the failure rate, which suggests it’s a glitchy thing.

Good embedded systems practice suggests resetting the entire display from scratch every now and again, but my streamer code has no concept of elapsed time. Opening that particular can o’ worms would almost certainly result in an on-screen clock and I do¬†not want to go there.

I suppose I must get a new oscilloscope with SPI bus decoding to verify all the SPI setup and hold times …

Advertisements

,

9 Comments