1
\$\begingroup\$

I've been playing around with I2C for a couple days now with a DE10-Nano dev board: I'm implementing an I2C master in CLaSH so that I can talk to the HDMI encoder chip, but for now I'm talking to an Arduino Due for easy debugging. The way I've been doing that is to use the SCL and SDA pins on the Arduino header of the DE10-Nano and connect that to the SCL and SDA pins on the Due with pullups.

I had versions that worked and versions that didn't; but at some point it just started not to work at all. Even with previously-working versions.

I managed to isolate the problem to the SCL pin: if I use a different pin on the FPGA for SCL, then everything works again. This makes me think I might have managed to kill the SCL pin.

How do I go about proving or disproving this? I tried outputting either 1 or 0 on the SCL pin and looking at it with a multimeter, and I see the correct voltage; I tried using the SCL pin as an input and connecting it to one of the builtin LEDs on the board, then feeding it 0 or 3.3 V, and I can see the LED light up or not.

Another thing I tried (based on this suggestion) is comparing the driver strength to a pin which seems to work:

  • Against 4.7k pulldown to GND:

    • "Good" pin: 3.21V
    • "Bad" pin: 3.19V
  • Against 4.7k pullup to 3.3V:

    • "Good" pin: 0.1V
    • "Bad" pin: 0.16V

Resistances (with the board powered down):

  • To GND:

    • "Good" pin: 1.2k
    • "Bad" pin: 0.95k
  • To 3.3V:

    • "Good" pin: 1.5k
    • "Bad" pin: 1.2k
\$\endgroup\$
  • \$\begingroup\$ Do you have an oscilloscope to check the dynamic behavior of the pin? I assume you pull-up voltage was 3.3V as well? \$\endgroup\$ – Humpawumpa Feb 6 at 9:17
  • \$\begingroup\$ @humpawumpa I don't have a scope. Yes, everything is in 3.3V, which is why I am using a Due as the slave. \$\endgroup\$ – Cactus Feb 6 at 9:21
  • 1
    \$\begingroup\$ A $11 USB logic analyzer with sigrok software will not let you see analog issues, but it would let you see I2C digital transitions and maybe get a sense if they are valid. It's sort of a complement to a scope, better for studying meaning while a scope is better for studying form. \$\endgroup\$ – Chris Stratton Feb 6 at 14:28
  • \$\begingroup\$ @ChrisStratton yes, I agree -- in fact, I've already ordered one because the I2C debugging was getting a bit hairy even before this potential electronic problem. It should arrive in ~2 weeks. \$\endgroup\$ – Cactus Feb 6 at 14:30
  • \$\begingroup\$ You could also build a logic analyzer in the FPGA, either directly or by jumpering to additional pins... Or both at once. Depending on licensing the tools may even build one for you, or you can DIY or use an open source codebase. \$\endgroup\$ – Chris Stratton Feb 6 at 14:34
1
\$\begingroup\$

As per your comment that you're bit-banging the I2C: are you totally sure that nothing else changes when you change your I2C setup to that pin? Can you use a multimeter to check the resistance to ground/supply/other outputs (with it off)? It could be as simple as physically moving wires around is causing an issue.

Your other options are limited without a scope. You could buy another dev kit to compare with, having two anyway is sometimes useful!

If you haven't done so already, it might be prudent to add some protection to the SDA/SCL lines. Series resistors (if you are unsure how to determine then 300R would be a good start) and TVS diodes can make quite robust protection against ESD and accidentally shorting the lines to power rails.

\$\endgroup\$
  • 1
    \$\begingroup\$ Thank you for the clarification! I've updated my answer to hopefully be more useful for this case. It seems like the pin should indeed be fine from your tests. \$\endgroup\$ – Cursorkeys Feb 6 at 13:39
  • \$\begingroup\$ I change my I2C setup to that pin by changing the VHDL -> physical pin assignment in the FPGA vendor's IDE, resynthesize/reupload, and unplug the jumper cable from one pin and plug it into the other. All the other connections (the pullups, the common ground, and the connection to the Due) are unchanged. \$\endgroup\$ – Cactus Feb 6 at 14:29
  • \$\begingroup\$ Hmm, I would definitely look at the resistances between the two configurations then. I've had things like faulty headers before that only shorted out when mated, and a wisp of solder that only shorted out two pins when the PCB was out of the case (the board unflexed) etc... \$\endgroup\$ – Cursorkeys Feb 6 at 14:51
  • \$\begingroup\$ But I wasn't taking the jumper wire out when I seemingly broke it... the whole thing about switching between pins was in the aftermath trying to figure out why nothing works anymore. \$\endgroup\$ – Cactus Feb 6 at 14:52
  • \$\begingroup\$ I'd say it's still worth investigating, even just to rule it out. Otherwise I'd try and borrow a scope from someone, or invest in one. They're really invaluable, even for simple electronics work. \$\endgroup\$ – Cursorkeys Feb 6 at 14:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.