0

On a recent project of mine, I incorporated an MPU 9250 and a MS5611 Barometer on the i2c bus of an atmega 32u4.

The MPU 9250 works perfectly, but as soon as I solder on the MS5611 neither of them work.

Here is my schematic:

enter image description here

  • (1) Use a scope to view the I2C signals when idle (to check the helpful hypothesis from *Will*). (2) Assuming I2C signals idle at 3.3V, view the I2C signals with the following slaves attached to the I2C bus: (a) none - only ATmega trying to address a slave (b) just MPU9250 (c) just MS5611 (d) both slaves. Please provide those scope traces. (I know you might need to hack a PCB to temporarily disconnect the I2C signals from the individual devices, to do those tests.) (3) Has this design ever worked successfully e.g. an earlier prototype etc.? If so, what has changed since that working example? – SamGibson Jul 18 '17 at 20:59
  • 1
    Is the MS5611 pinout correct? I don't see pin numbers for it on the schematic – Krunal Desai Jul 18 '17 at 21:22
  • @KrunalDesai - Good question, and even if the pin numbers on the schematic were correct, the PCB footprint itself might be incorrect (e.g. mirrored by mistake) or the MS5611 might be accidently fitted with the wrong orientation etc. We have no information so far, that the PCB matches the schematic. – SamGibson Jul 18 '17 at 21:39
  • @SamGibson The pin order is definitely correct. I've checked multiple times with the datasheet. –  Jul 19 '17 at 00:36
  • @user2900812 "The pin order is definitely correct" I understand you believe that. But *something* is wrong, otherwise you wouldn't have a problem :-) When people ask for help here, they sometimes say they have checked "X" and the problem is not there - but later report that "X" *was* the problem, perhaps in a different way than they checked originally. Krunal and I are simply highlighting that *we* cannot confirm those points. I've already given a step-by-step list of data collection, and *somewhere* during that process, the 'scope traces will stop being normal and point towards the problem. – SamGibson Jul 19 '17 at 01:06
  • @user2900812 - Have you got an oscilloscope (or have access to one) and experience using it, to be able to view the I2C signals, as I suggested? If not, what test equipment do you have access to? Was there an earlier, working, version of this design? (this was point 3 from my initial comment) – SamGibson Jul 19 '17 at 01:16
  • @SamGibson No I'm sorry I don't have access to an oscilloscope. Still a hobbyist so an oscilloscope is too expensive for now. This is my prototype design, so I'm trying to work out the kinks. –  Jul 19 '17 at 01:44
  • @user2900812 - Oh dear :-( OK, thanks for explaining. I know 'scopes are comparatively expensive for a hobbyist, but some problems are *very* difficult and inefficient to find without one. If you have *not* disabled the ATmega 5V pull-up internal resistors on the 3V I2C pins, as highlighted by *Will* in his answer, then that *is* a problem, although I can't say whether or not it is causing your current problem. You can measure the *idle* I2C signal voltages with a DMM, looking for 3.3V (not higher). However other tests would need a scope, so I'll stop here - sincere good luck! – SamGibson Jul 19 '17 at 02:44
  • 1
    @SamGibson I appreciate the help! –  Jul 19 '17 at 17:01

1 Answers1

1

Looks like you have your MS5611 hooked up correctly, with CSB pulled low and PS pulled high. The two sensors also do have distinct I2C addresses. The following is just a guess without looking into the Atmega 32u4, but I have had trouble interfacing 3.3V devices to Atmega processors because of internal pullup resistors which drag the I2C up to 5V. On some boards this can be disabled in code, but on others I have solved this with a level converter on the SDA/SCL lines.

Will
  • 182
  • 7
  • So you suggest somehow disabling the internal pullup resistors? The 4k7 resistors I have on the i2c bus are pulled up to 3v3 –  Jul 18 '17 at 20:56
  • 1
    Good point about needing to disable any 5V ATmega internal I2C pin pull-ups, if running the I2C bus at a different voltage. In case anyone wants to read more about that problem, it has been mentioned by *Passerby* in [his answer to an old I2C question](https://electronics.stackexchange.com/a/102621/101852). Also *Fabio Varesano* has a write-up on the topic in his blog: "[How to disable internal Arduino ATMEGA pullups on SDA and SCL with I2C bus](http://www.varesano.net/blog/fabio/how-disable-internal-arduino-atmega-pullups-sda-and-scl-i2c-bus)" focussing on the Arduino library code. – SamGibson Jul 19 '17 at 02:38
  • @SamGibson Could the problem be that my circuit doesn't have a bi directional level shifter? Looking at the schematic of a popular IMU, it has a bi directional level shifter: http://www.thaieasyelec.com/downloads/ESEN246/GY-86_SCH.jpg –  Jul 19 '17 at 17:24
  • @user2900812 - "Could the problem be that my circuit doesn't have a bi directional level shifter?" *Perhaps* - more info is needed to help judge the likelihood of that helping. (a) Have you measured the idle voltage on the I2C signals, as suggested earlier? (That can be done with a DMM and doesn't need a scope.) (b) We haven't seen your code. Are you using any libraries or are you writing *all* the code? (c) Have you made *sure* that the ATmega's built-in pull-up resistors are disabled on its I2C pins, as *Will* highlighted in his answer and I mentioned in comments, or can't you do this? – SamGibson Jul 19 '17 at 20:56