1
\$\begingroup\$

I built a simple sensor board connecting a RFDUINO to two I2C components. A ADXL345 accelerometer and a MPR121 Touch controller. The board also includes an RGB LED, vibration motor and Li-Po charger circuit.

The I2C bus seems not to be working, and I cannot read the register (using the wire library for Arduino) on the two I2C. If I connect a scope to the I2C lines (using some pads exposed on the PCB, see figure) I can see a 3.3v but no activity on both SCL and SDA lines.

In a ealier breadboard prototype I used a RFDUINO shield and breakout boards for ADXL345 and MPR121 and did not present any problems.

Schematic PCB layout

\$\endgroup\$
  • 2
    \$\begingroup\$ This isn't the solution but you don't need two sets of pull-up resistors if there is a set that will always be connected to VCC \$\endgroup\$ – Funkyguy Dec 14 '15 at 19:18
  • 1
    \$\begingroup\$ It can actually affect your I2C bus as those resistors aren't arbitrary. I'm not sure about the I2C bus specs for the RFduino but having too strong or too weak of pull-ups can render your I2C bus useless in any system. \$\endgroup\$ – Funkyguy Dec 14 '15 at 19:32
  • 2
    \$\begingroup\$ The datasheet recommends a 4.7k pullup on SDA, and is only required on SCL if there are multiple masters, or if the master has an open-drain output. You are using 10k pullups on SCL, SDA, and INT \$\endgroup\$ – DerStrom8 Dec 14 '15 at 19:36
  • 2
    \$\begingroup\$ I2C is an irritatingly complex protocol. You should really think about investing in a logic analyzer if you plan on doing this much. My personal fav. is Saleae Logic. \$\endgroup\$ – Daniel Dec 14 '15 at 19:44
  • 1
    \$\begingroup\$ @ScottSeidman I did some breadboard prototyping using breakout boards for ADXL345 and MPR121 and that did not present any problems \$\endgroup\$ – Simone Mora Dec 14 '15 at 20:17
4
\$\begingroup\$

From the ADXL345 datasheet:

The #CS pin should always be tied high to VDD I/O or be driven by an external controller because there is no default mode if the #CS pin is left unconnected.

Try to solder VCC manually to the IC if you have placed a pad that can be reached at all. Else, you'll probably need to find a more creative solution.

\$\endgroup\$
  • \$\begingroup\$ Thanks, this is indeed a flaw in my design. Yet the second I2C device (touch controller) should work fine anyway or leaving the #CS disconnected could disrupt the I2C bus for all the devices? \$\endgroup\$ – Simone Mora Dec 15 '15 at 17:14
  • \$\begingroup\$ @SimoneMora There is another problem then. Double check all the connections and make sure you get a working waveform using your scope. \$\endgroup\$ – FRob Dec 15 '15 at 17:45
  • \$\begingroup\$ @SimoneMora One I2C slave device can bring down the entire bus and prevent other slave devices from communication. Here's a remotely related answer involving ADXL345. One way to test this is to remove the ADXL345 chip, and try to talk to the other I2C slaves. If you can talk to them, then ADXL345 was the culprit (in one way or another). On a related note, judging from your comments, you haven't read the I2C bus specification yet. Please read it (at least skim through it). \$\endgroup\$ – Nick Alexeev Dec 15 '15 at 18:35
  • \$\begingroup\$ @NickAlexeev Thanks! I read the I2C specs and realised that the amplitude of the signals (2.4V) I get on SCL/SDA is ok. I also discovered that I left both the CS and SDO/ALT ADDRESS unconnected. I tried to wire them up to VDD (as in the datasheet, should I add a resistor too?) and scan for I2C address from RFDUINO but still cannot see the accelerometer or any other devices on the bus; but I cannot trust my soldering work because the pins are very small (QFN package). I wish I could try removing the accelerometer but I don't have proper equipments. \$\endgroup\$ – Simone Mora Dec 17 '15 at 15:02
0
\$\begingroup\$

If there is no activity on the bus, the relevant pins are high, and are not shorted to VCC, then the problem is in the firmware. (Or you are looking at the wrong pins, wired the wrong pins, have the wrong chip, something like that).

\$\endgroup\$
  • \$\begingroup\$ Thanks, now I read some activity on the bus using a scope. I can see the clock but the amplitude of the signal, is about 2.4v, probably not enough for the RFDUINO for being picked up, same for the data line. This happens both powering the device via battery and USB. The frequency of the clock seems to be 100Hz, unpowered SDA/SCL to VCC resistance is 5K. \$\endgroup\$ – Simone Mora Dec 15 '15 at 17:18
  • \$\begingroup\$ I suggest you change it to 2.2k. 100 Hz is rather slow. Are you sure? And Is the data going out correct and what you expect? You need to start with this. When you try to do an I2C read, is the outgoing clock and data correct? Until it is, don't worry about anything else. If possible, I would disconnect everything from the bus except the pullups, and probe the outgoing signal with an oscilloscope (and/or analyzer) until it is correct. Until the outgoing signal is known to be correct, there is no expectation of a correct response. \$\endgroup\$ – mkeith Dec 15 '15 at 17:29

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.