Hi Kerry Zhou,
Thanks for the quick reply.
The problem is that i am working on a custom pcb and when i probe the i2c slaves i don't see correct addresses.
More specifically i have a temperature/humidity sensor that lies in 0x40 address.
When i speak directly to that address or probe the i2c slave I never see sth at address 0x40.
I changed the iteration number of "for (i = 0; i <= 0x7F; i++) {" for test reasons (i know i2c can have up to 127/7f slave addresses) and a device appear at 0xC0 (0x40 is 0b 100 0000, 0xC0 is 0b 1100 0000 ).
Also i have two sensors at correct addresses as expected.
0x60 and 0x6A. There are also devices at 0xE0 (0x60 is 0b 110 0000, 0xE0 is 0b 1110 0000 ) and
0xEA (0x6A is 0b 110 1010, 0xEA is 0b 1110 1010 ).
To sum up,
I should see the 7bit addresses 0x40, 0x60 and 0x6A. I only see 0x60 and 0x6A.
When i change probe slave to check after 7F. I see 0xC0, 0xE0 and 0xEA addresses that are the 7bit above adresses with an 1 as an eight bit.
Is this expected?
When i2c_probe_slaves function is called Chip_I2C_MasterRead is called and then Chip_I2C_MasterTransfer
that finally calls these two functions:
/* Enable I2C and start master transfer */
STATIC INLINE void startMasterXfer(LPC_I2C_T *pI2C)
{
/* Reset STA, STO, SI */
pI2C->CONCLR = I2C_CON_SI | I2C_CON_STA | I2C_CON_AA;
/* Enter to Master Transmitter mode */
pI2C->CONSET = I2C_CON_I2EN | I2C_CON_STA;
}
and
/* Enable I2C and enable slave transfers */
STATIC INLINE void startSlaverXfer(LPC_I2C_T *pI2C)
{
/* Reset STA, STO, SI */
pI2C->CONCLR = I2C_CON_SI | I2C_CON_STA;
/* Enter to Master Transmitter mode */
pI2C->CONSET = I2C_CON_I2EN | I2C_CON_AA;
}
.
How does the i2c_probe_slaves gets the ack as you showed before and understands that a device lies in a specific address?
Thanks a lot in advance.
Dimitris