Author Topic: Help determining I2C slave device address  (Read 3906 times)

0 Members and 2 Guests are viewing this topic.

Offline bhj99Topic starter

  • Contributor
  • Posts: 30
  • Country: us
Help determining I2C slave device address
« on: September 02, 2023, 11:55:31 pm »
Hi all, could anyone help me with determining the I2C slave address for this GPIO expander chip (schematic snippet attached)? Trying to learning I2C basics. Looking through this long datasheet, it seems like it is 0x44H, or I am I totally off track. Also, if anyone can share general approached to determining I2C addresses based on the datasheet, I'd appreciate it.
 

Offline ataradov

  • Super Contributor
  • ***
  • Posts: 11687
  • Country: us
    • Personal site
Re: Help determining I2C slave device address
« Reply #1 on: September 03, 2023, 12:07:08 am »
With ADDR connected to the ground, the 8-bit I2C address would be 0x44 according to the datasheet.

There is no general approach, different devices use slightly different methods of setting the address, so you just have to read the description in each case.

In most cases there is a fixed part and a variable part. The whole address may be fixed, of course. If there is a variable part, then it is often just mapped to the address pins.

In this case they use 4 possible connections of the ADDR pin to define two variable bits of the address, allowing up to 4 devices on the same bus.
« Last Edit: September 03, 2023, 12:09:25 am by ataradov »
Alex
 
The following users thanked this post: bhj99

Offline ataradov

  • Super Contributor
  • ***
  • Posts: 11687
  • Country: us
    • Personal site
Re: Help determining I2C slave device address
« Reply #2 on: September 03, 2023, 01:30:53 am »
This is not correct. 0x44 is 8-bit address, so it is either 0x44 (W) or 0x45 (R).
Alex
 

Online DavidAlfa

  • Super Contributor
  • ***
  • Posts: 6183
  • Country: es
Re: Help determining I2C slave device address
« Reply #3 on: September 03, 2023, 03:16:38 am »
Correct! It's very common for datasheets to use the 7bit address so I assumed wrong this time :)
Deleted the message!
Hantek DSO2x1x            Drive        FAQ          DON'T BUY HANTEK! (Aka HALF-MADE)
Stm32 Soldering FW      Forum      Github      Donate
 

Offline rstofer

  • Super Contributor
  • ***
  • Posts: 9929
  • Country: us
Re: Help determining I2C slave device address
« Reply #4 on: September 03, 2023, 04:13:26 pm »
From a software point of view, the address can be 0x40, 0x42, 0x44 or 0x46 according to
Table 4.

But there's only 1 address pin, how do they get 4 addresses?  By connecting the ADDR pin to either  SCL, SDA, Vss or Vdd according to Table 4.

https://www.nxp.com/docs/en/data-sheet/PCAL6524.pdf

You do not need to shift the bits 1 position to the left with this scheme.  Just mask in the R/W' bit to position 0 and you are good to go. See Figure 4.

This is where I enable I2C on a Raspberry Pi and use the 'lsi2c' utility to find out what is where on the I2C bus.

Kind of an unusual addressing scheme!  The datasheet is quite clear on how this works and what needs to be sent down the wire.
 
The following users thanked this post: bhj99

Offline bhj99Topic starter

  • Contributor
  • Posts: 30
  • Country: us
Re: Help determining I2C slave device address
« Reply #5 on: September 07, 2023, 07:13:51 pm »
With ADDR connected to the ground, the 8-bit I2C address would be 0x44 according to the datasheet.

There is no general approach, different devices use slightly different methods of setting the address, so you just have to read the description in each case.

In most cases there is a fixed part and a variable part. The whole address may be fixed, of course. If there is a variable part, then it is often just mapped to the address pins.

In this case they use 4 possible connections of the ADDR pin to define two variable bits of the address, allowing up to 4 devices on the same bus.



Thanks for the help for begineers like me. it makes sense now. I now would like to connect an Aardvark I2C/SPI Host Adapter for read/write via I2C and the GPIO Control menu options avaiable on the Total Phase Control Center Serial tool. I was wondering if you could explain how to configure the logic level for the indivdual I/O ports. For example, if I wanted to write logic 0 (i.e. pull low) to the SFP0_3.3V_EN signal (P0_6, pin 7 of schematic), what command/message (0x0Ch ?) should I be writing to the slave address 0x44?
 
 

Offline ataradov

  • Super Contributor
  • ***
  • Posts: 11687
  • Country: us
    • Personal site
Re: Help determining I2C slave device address
« Reply #6 on: September 07, 2023, 07:45:27 pm »
You would first need to write corresponding Configuration register (0x0C for P0). Clear the bits that you want to become outputs. Then write Output port register (0x04 for P0) with the value you want to see on the pin.

The write happens in 2 bytes - register address and register value. So, the "message" field would look like "0C BF" (set only P0.6 to output), and then "04 40" to set it high and  "04 00" to set it low.

Also, keep in mind that Aardvark uses 7-bit address, so you need to use address 0x22.

There does not seem to be a way to set/clear individual pins, so you have to set the whole port state. If you don't want some pins to change, you just need to write the same value.
Alex
 
The following users thanked this post: bhj99


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf