I have been debugging my Sensor board. I started by debugging the ability to light the LEDs connected to the 74HC565 shift register. I started with the basic code mentioned by Chris in the “serial shift out” video.
The initial run of the code didn’t produce any positive results, meaning I wasn’t able to successfully cause any of the LEDs to light. Undeterred, I treated this as a debugging exercise.
Using my DMM, with a simple wire as a “probe”, I was able to determine Vcc of 3.3 volts was successfully being delivered to the 74HC595 chip, and also that ground was really ground.
In reviewing the code, I determined the latch pin was “high” be default, but I found the signal at the latch pin to be low. Working backwards, I also determined pin on the CE header (ie. pin 7) connected to the latch pin on the 74HC595 (ie. pin 12) was also low. The code shows the latch pin should be high at all time except for when “latching” new data from the shift register.
Continuing to work backwards, I found a bug in my layout. I had inadvertently assigned Teensy Pin 1 (USART Tx) to CE header pin7, and Teensy Pin 0 (USART Rx) to CE Pin 8. These are swapped from what they should be.
I created the following table to keep it straight my mind:
Latch = Teensy pin 0 == CE Header pin 7 == 74HC595 pin 12
Data clk = Teensy pin 13 = CE Header pin 5 == 74HC595 pin 11
Data = Teensy pin 10 = CD Header pin 6 = 74HC595 pin 14
After updating the code, I found that I was able to cause all but 2 of the LEDs to light up with the expected ascii values. The problematic LEDs were D5 and D7.
After a bit more probing and investigation using my microscope, I found a cold solder joint on 74HC595 pin 3 (LED D5, Ascii value 3). I was able to fix this quickly by just applying a bit of heat using my solder iron.
Using my Rigol DS1054Z oscilloscope and appropriately located test leads (thanks Chris!), and using an appropriately configured single trigger, I was able to watch the signals sent to the latch, clock, and data pins.
Channel 1 == CE Header pin 7 == latch == yellow
Channel 2 == CE Header pin 6 == Data == blue
Channel 3 == CE Header pin 5 == Clock = purple
Channel 4 == DC voltmeter for probing other areas of the board
The attached picture shows a screen shot. There is 1 v per vertical division, and 2 us per horizontal division. The screen shot was captured when sending an ascii value of 3. The data pulse (blue) is indeed clocked out on the 4th clock signal (corresponding to pin 3 on the 74HC595).
Sorry, the colors don’t show up the picture quite a well as I’d hoped.
Each clock pulse is approximately 0.8 microseconds. On this topic, I took at quick look at the code implementing the shiftOut() function. It is written entirely in software, using a simple for loop where the width or time for each clock pulse is determined simply by how fast the CPU can iterate over that loop. Different CPUs would operate the shift register clock at a different frequency. A higher precision clock would require the device to be connected to I2C or SPI. Obviously not at all critical in this application, just kind of fun to look at.
It is also interesting to see the long RC decay curve associated with the latch signal (yellow), and how it takes a relatively long time (nearly 150x the rise/fall time of the clock pulses). Which is due to the 0.1 uF capacitor applied to the latch pin on my board (as per the data sheet). Cool stuff.
I eventually determined yet another cold solder joint on the anode side of the LED D7, which I fixed. My soldering skills are lacking, and quite frankly I don’t have a ton of interest in improving them (my primary interests are elsewhere). This experience is causing me to seriously contemplate either building or purchasing my own reflow oven and designing my boards accordingly. My hat is off to those who have professional solder skills. Its definitely an art form of its own.
This exercise has also caused me to strongly evaluate how and where to put effective “test points” in my hardware, to make it much more friendly for using an oscilloscope. Possibly the test locations can be removed during “production spins” of the hardware. Might also need to consider how a test point might affect circuit operation at high speed clocks (which I am not concerned about in the near term).