I have a question regarding all sensors offering to work in either SPI or I2C mode.

I am having some issues working with a MPU9250, but think it is a general question: When working in I2C, the MPU SD0 pin must be connected to ground or VCC for adress selection, and the SPI CS# pin must be connected to VCC throught a pull-up resistor.

Does anyone have knowledge about this communication mode selection, in particular: is the resistor on the CS# line mandatory for the chip to communicate throught I2C

Thanks In advance

  • \$\begingroup\$ Where does it say the SDO pin must be connected to ground for I2C? I don't see this. To me it looks like a pin for setting I2C address. \$\endgroup\$ – DiBosco Sep 27 '17 at 10:01
  • \$\begingroup\$ It must be connected to gnd or VCC ; "The slave address of the MPU-9250 is b110100X which is 7 bits long. The LSB bit of the 7 bit address is determined by the logic level on pin AD0." page 32 of doc \$\endgroup\$ – LDelhorno Sep 27 '17 at 10:08
  • \$\begingroup\$ I think maybe we're talking about the same thing in different ways. It needs to be tied high or low, but does not necessarily mean directly to GND or Vcc. Sorry, don't wish to appear pedantic. I see nothing about a resistor on CS line. One diagram seems to tie it to Vcc. You can't generalise about how other sensors work BTW. \$\endgroup\$ – DiBosco Sep 27 '17 at 10:30
  • \$\begingroup\$ You dind't, no worries. wasn't sure we where saying the same things. I did not see anything in the documentation, but for example the sparkfun module for this sensor have a resistor, as I can't communicate with my MPU, was wondering if it may be the problem, as I don't see where it could be if this is not the problem Yes I was generalising, because I worked with an LIS3DH which have both interface, and CS have Pull-up resitor too for I2C operations. But I do agree that this may not apply to all sensor having both interfaces \$\endgroup\$ – LDelhorno Sep 27 '17 at 10:54

This post has been bumped to the homepage by Community, but I'll leave another answer just for variety and for reference by others.

In my experience one should always follow the data sheet. If the data sheet indicates a pullup resistor should be used, there's probably a good reason for it.

is the resistor on the CS# line mandatory for the chip to communicate through I2C

In theory, a direct connection is just like a very low resistance resistor (a very strong pull-up resistor). In many cases, a direct connection is fine. Unless you know the internals of the chip, however, there could be a reason to limit current to the port. That's why the datasheet might supply these suggestions. Following the datasheet is a good idea. Otherwise test, test, test.


yes ,it's to important because MPU supported SPI and I2C both mode so if you want to access only I2C then other pins you need to be connected as they describe in datasheet.

  • \$\begingroup\$ Edited my post, question is not about puting CS# High for I2C, but about the resistor it-self to be mandatory, or direct connection should work \$\endgroup\$ – LDelhorno Sep 27 '17 at 10:09
  • \$\begingroup\$ no , it's not manatory, but if you want to use SPI mode in future then what you do?, \$\endgroup\$ – Bhura Sep 27 '17 at 10:14
  • \$\begingroup\$ I won't, pcb is designed for I2C operations \$\endgroup\$ – LDelhorno Sep 27 '17 at 10:20

Yes, those pull up resistors are necessary, because controllers are designed with open drain CMOS logics which need an pull up resistor external to them, in order to change logic states of that pin.


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.