Previously in this EmbeddedRelated article,   we saw how to use Buttons Subsystem on NuttX using a RaspberryPi Pico board. Now we will change fro

How to use I2C devices in (Apache) NuttX: Scanning for Devices

submited by
Style Pass
2024-04-23 09:30:14

Previously in this EmbeddedRelated article, we saw how to use Buttons Subsystem on NuttX using a RaspberryPi Pico board. Now we will change from user input device (buttons) for something more generic: I2C protocol. NuttX supports a lot of I2C devices (sensors, displays, EEPROMs, I/O Expanders, I2C multiplexers, and many more). And most important: because NuttX is a Linux-like RTOS you will find the very familiar i2ctool to search for devices in your I2C bus. So, lets to get started!

As most of ours readers know, the I2C protocol was invented by Philips Semiconductors in the 80's to interconnect devices inside circuit boards. Compared to current interfaces standard this protocol is slow: the Standard mode (Sm) uses 100 kbit/s; Fast mode (Fm) use 400 kbit/s; Fast mode plus (Fm+) at 1 Mbit/s, High-speed mode (Hs) at 1.7 Mbit/s or 3.4 Mbit/s, Ultra-fast mode (UFm) at 5 Mbit/s.

Although there are many I2C modes, at end of day you will work mostly with Standard mode devices (100 kbit/s) and Fast mode devices (400 kbit/s).

Leave a Comment