Sunday, April 22, 2012

Deglitching a Sparkfun 7-segment Serial Display

The display in my Ambient Bus Arrival Monitor is a Sparkfun 7-segment Serial Display connected to the TTL serial port.  I had noticed that occasionally the display would reset itself to 0000 (or sometimes 0, 00 or 000).  It was even possible to make it do this by touching the body of the bus.  It didn't happen often so I was able to ignore it but then it began to happen more and more.

After a very long and tedious investigation I discovered why.  I started out by blaming my code, my soldering, the cable I was using, the quality of the connectors, ...  Only having eliminated everything that I'd touched did I realize it must be something else.

The display has two input methods: serial (which I am using) and SPI (which I am not).  The SPI interface has a clock signal (which in the case of the display is acting as an input) called SCK.  The manual for the display says "The display is configured using SPI mode 0 (CPOL = 0, CPHA = 0), so the clock line should idle low".

If you take a quick look at the schematic for the display you'll discover that the SCK pin on the microcontroller is just connected to a solder pad for connection.


The upshot is that if you (the user) don't connect that pin to something Sparkfun aren't doing it for you.  The display glitch I was seeing was that this floating clock input would sometimes go high and the firmware for the device would then read a byte (all zeroes of course) and write to the display.

There were two possible fixes: hack the firmware so that it ignores SPI completely, or force the SCK pin low all the time.  I opted for the latter (since it was a quick fix) and connected a 10k resistor between that pin and ground.  Glitch gone.



Pity that Sparkfun didn't include a pull-down resistor on SCK (and possibly on RX as well).

If you enjoyed this blog post, you might enjoy my travel book for people interested in science and technology: The Geek Atlas. Signed copies of The Geek Atlas are available.

<$BlogCommentBody$>

<$BlogCommentDateTime$> <$BlogCommentDeleteIcon$>

Post a Comment

Links to this post:

<$BlogBacklinkControl$> <$BlogBacklinkTitle$> <$BlogBacklinkDeleteIcon$>
<$BlogBacklinkSnippet$>
Create a Link

<< Home