Saturday, 4 November 2017

microcontroller - How to deal with multiple pull-up resistors on modules


I was thinking about doing a modules for a development board I did a few days ago that will include spi/i2c interfaces.


The problem is that I didn't included pull-up resistors in the MCU pins in the main board and was thinking to add them in the modules to make them more "generic" so every user could use them without need to add extra resistors in the prototype board.



But then I faced the next problem. If I add the pull-up resistos in the extra modules and I connect for example two or more modules to the same bus I'll get those resistors in parallel so the resistance will drop and will not accomplish their function.


But if I add the pull-up resistors to the main board I'll have those pins in the MCU always as active low.


So the main question is:


How to have multiple modules connected to the same bus having on each of them the pull-up resistors but not get them in parallel when you've more than one module? Is that possible?


Or the best solution here is enable the pullup resistors in the MCU and don't inlcude them in the modules?


Thanks.-



Answer



I'll assume that the total length of each of your buses is under 1 meter, which is typical for plain I2C and SPI. Also, the bus capacitance is within the spec.


There should be only one (1) set of pull-up resistors. As a result, the best place for them is on the main controller board. Don't put the pull-ups on the modules.


If you want to have pull-up in some cases and not have them in other cases.




  • Do not populate the pull-up resistors, when you don't need them.

  • Design the main controller board such that pull-ups are connected to the signal lines through jumpers. Remove the shorting blocks, when you don't need the pull-ups.


edit: Frankly, I think it's a mistake that Sparkfun puts pull-ups on I2C slave modules. Unfortunately, not everyone who buys modules realizes that excessive pull-up can be a problem. It would be nicer if the controller boards (instead of slave peripheral boards) had pull-ups with solder jumpers. Oh... Wait... Arduino doesn't carry the (optional) pull-ups (although perhaps it should). So, let's schlep pull-ups everywhere. Easier initial out-of-the-box experience. But add a few slave modules and the bus will stop working.


update (May 2015) :
- Related discussion in comments in another thread.
- In their recent modules, SparkFun began to add solder blob jumpers between Vcc and the I2C pull-up resistors (example). That allows to disconnect the pull-ups more easily.


update (Dec 2015) :
Similar questions about troubleshooting I2C with multiple modules keep popping up on message boards. Attempt at an extended general response.



No comments:

Post a Comment

arduino - Can I use TI's cc2541 BLE as micro controller to perform operations/ processing instead of ATmega328P AU to save cost?

I am using arduino pro mini (which contains Atmega328p AU ) along with cc2541(HM-10) to process and transfer data over BLE to smartphone. I...