Monday, 28 November 2016

i2c - Why the need for multiple I²C ports?


The I²C protocol allows, in theory and with 7-bit addressing, up to 127 devices to be connected to the master. This is a large number, so why would any low-cost microcontroller (e.g. this PIC24), have more than one I²C port? Why is it needed?



Answer



Sensor hub arrangement


In this scenario, there are two I²C buses. Let's call them local bus and main bus. The purpose of the local bus is to connect a bunch of sensors to a microcontroller (μC). The purpose of the μC is to poll the sensors, aggregate information from them, and detect certain events. A μC in such role is called sensor hub. The sensor hub is not responsible for higher order functions; there is a powerful main processor for that. The main bus connects the sensor hub to the main processor. So, the sensor hub μC is a master on the local I²C bus and a slave on the I²C main bus.



SPI and I²C


The PIC linked in the original post doesn't share the pins between SPI and I²C. However, there are other PICs that use the same pins for hardware SPI and I²C, because both are implemented with the same MSSP peripheral. If a PIC has two separate MSSP peripherals, then one can be used for hardware SPI, while the other one is used for hardware I²C.


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...