Wednesday, March 16, 2016

I2C design error

So, when I laid out the Wisp1 board, I was confused about whether the STM processor could provide integrated pull-up resistors for the I2C bus, or whether I would need to install external pull-ups.  I set the issue aside as I was doing the schematics, and promptly forgot about it entirely.  I went on to have the boards built, and oops, forgot about the pull-ups.

Well, not surprisingly, I was having problems with I2C not working.  After reviewing the code a dozen times over, I finally realized my mistake.  I kludged in a few pull-ups on the board, in a very snug (and not terribly pretty soldering job.  I stood a few 4.7k resistors on end at the end of a pair of capacitors that were on a VCC trace.  I ran the wires from the top of the resistors over to the I2C pins on the processor.  It was tricky, but I got 'em in there!

Having added the pull-ups, I was still having problems talking to the Si5351 chip.  It wasn't responding.  I looked on the 5351 end of things, and found that he TCXO was making a nice 26Mhz waveform on the TCXO side of the decoupling capacitor, but on the 5351 side, it wasn't making any signal.  I fooled with that for a while, thinking maybe the oscillator signal wasn't getting to the 5351 due to a cold solder joint or something.  I tried swapping my 0.47uF cap with a 100pF cap.  No joy.  I swapped that for a 0 ohm resistor, and suddenly there was no oscillation on either side.

Hmm.... was something wrong with the 5351, which was screwing up the Oscillator?   I went over to the 5351 and looked at things more closely.  All of the solder joints looked fine.  No shorts.  Getting nervous now, I decided to consult the datasheet.  Was I maybe putting the oscillator into the wrong pin?

It didn't take long for me to have an outright panic.  All the pinouts were wrong on the board!   After another moment I realized the problem, and did a serious face-palm.  I had installed the 5351 chip 180 degrees around.  The pins were out of order simply because the chip was on backwards.  Doh!

With a quick puff of hot air and flux, I flipped the chip around.  I fired up my debugger so that I could confirm the oscillator was now oscillating.  Lo and behold, before I could even pick up my test probe, I saw diagnostic messages from my I2C code scrolling up the screen.  The processor was talking to the chip!

I can now continue on with coding and debugging.  I'll have to look at my debugs more closely, and look at the pinouts.  I may have blown up the 5351 to some degree, so I'll be skeptical of things until I see it work.  It'll be easy enough to swap if I need to.

 In the meantime, I've already done a "RevB" spin of the board with the pull-ups in place, and a pull-down added to the 1v8 regulator, which I discovered was missing previously.  I guess I just have a mental block about pull-ups and pull-downs! OSH Park has already whisked the boards off to China for manufacture.  I didn't move too many parts around, so I'll just use my RevA stencils, and manually paste the (6) 0603 parts that were added/moved.  I expect once I finalize the design, I'll be panelizing the boards and ordering them in 0.8mm, at which point I'll order a stainless steel stencil to use on my tooling block.


No comments:

Post a Comment