How to discover I2C device addresses
DaveJenson
Posts: 375
Does anyone have a code snippet or other means of discovering any I2C device's address?
I have a couple I2C displays and other things that I would like to interface, but don't know the proper I2C address.
Thanks in advance!
I have a couple I2C displays and other things that I would like to interface, but don't know the proper I2C address.
Thanks in advance!
Comments
@JonnyMac has some code on github that scans for a range of addresses and lists what it finds in a matrix.
https://github.com/parallaxinc/propeller/tree/master/libraries/community/p2/All/jm_i2c_devices
At least that's how I read the code. It looks like the zip file has all the objects you need to run the code. I'm downloading it now to test it. It only prints the addresses though.
However, there are a couple of URLs which do list I2c addresses. Below are a few I found with the "Is there a database of I2C addresses" google search:
https://i2cdevices.org/addresses
https://learn.adafruit.com/i2c-addresses/the-list
Their list seems to terminate at 0x7F. Not sure why. They don't have the $A4 and $A5 addresses for my RV-3028-C7 RTC though.
Thanks!
Peter, I can't seem to get lsi2c to work on my P2 Edge in the Flexprop terminal that is started when selecting P2 ROM TAQOZ.
lsi2c ???
Is lsi2c part of some extended command set? Or is because there aren't any I2C devices currently connected?
I2C is one of those acronyms that people use freely, while not knowing what it stands for (Inter-Integrated Circuit).
There is nothing stopping you from taking a few seconds to load the TAQOZ binary into RAM, and if you have an SD card inserted, just tell it to backup to it with BU.
For instance I2C. Which pins does this look at and how to change it?
Is there a comprehensive list of which pins TAQOZ default uses for devices?
Thanks!
Hi Dave, I almost missed your post. If you call I2CPINS ( scl sda -- ) it will also setup the pins with stiff 1K5 soft pullups as soon as you start to talk to the bus. You can go as fast as the fastest chip can go (well over 3000 kHZ) or slow right down for those really really old 100kHz chips too by using I2C.KHZ ( khz -- )
You don't external pullups but most of the time they are fairly weak 10k pullups anyway so it doesn't matter if you already have them connected.
Use lsi2c to discover and list the I2C devices on the bus.