Access to I2C addresses

Hi,
How can I get access to I2C addresses (I need access to 0x3F to change CARD_DETECT)

U200 EEPROM: 0x50
U508 ACCE/GYRO: 0x18/68
U507 BME680: 0x76
U502 BMM150: 0x10/0x11
U503 IO EXP: 0x3E
U506 OPT3002: 0x44
U505 TCA9546: 0x71 (same as 'red)
U700 NT3H2211: 0x55 (default - can be changed)
U701 PCF85063: 0x51
U1000 BQ25601: 0x6B
U1002 BQ27426: 0x55
U703 USB3503A: 08h

Only 0x76 is available:

On mangOH red everything is clear:
I2CRed

IS that showing the actual 7-bit address, or giving an 8-bit value - including the R/W bit … ?

What is on address 0x3F? The card_detect gpio is on the SX1509 GPIO expander at I2C address 0x3E. Can you explain what you’re trying to accomplish?

Sorry 0x3E. i need to set up card_detect gpio. As you can see above I do not have the address. I have got only 0x76. Addresses 0x53 and 0x6C are from my IoT card.

image

I2C bus 4 is the primary I2C bus. Bus 5, 6, 7, 8 correspond to ports 0, 1, 2, 3 of the I2C switch. The GPIO expander will show up as UU if you scan bus 8. The reason it shows up as UU instead of 3E is because there is already a linux kernel driver associated with the address.

I know, addresses are unavailable. Original question still remains “How can I get access to I2C addresses?” Do I have to stop one of the service? My mangOH yellow is connected to Octave, so maybe, I should stop Octave integration somehow?

Sorry, I still don’t understand what “get access to i2c addresses” means? Do you meant that you want to write code from userspace to access the GPIO expander at address 0x3E? If that’s the case, then you will need to ensure that no kernel driver is bound to that device. The driver is bound to that device in the mangOH kernel module. If you just want to configure the properties of the card detect GPIO from userspace, you should look at /sys/class/gpio/v2/. There should be a gpiochip in there corresponding to the sx1509. On my device it is gpiochip793. Since card_detect is pin 8, the gpio should be 793 + 8 = 801. So run echo 801 > /sys/class/gpio/v2/export and then there will be a /sys/class/gpio/v2/gpio801/ folder inside which you will find various files for controlling the GPIO.

I used, i2cget on console and I got ‘Device or resource busy’ (no access / unavailable ), so I assumed, when I wrote a function I would have the same problem. But when I wrote a function ( I used bus 8 ) and on address 0x3E used function 0x10 and value 0x01, system changed IoT address from 0x53 to 0x52. So it is ok.

image_2019_10_08T22_13_50_039Z

By the way. Where did you find info about the gpios ( gpiochip793 )? I also tried your solution. /sys/class/gpio/v2/gpio801 was created, but I could not change the gpio value from console.