NRF52840 I2C ADDRESS.

Hello Everyone,

                           I am working on NRF52840 development kit. I am trying to run I2c master. My main goal is to send some data to slave via I2C lines. I am using the example code "TWI scanner" from the sdk examples. I have attached the slave microcontroller (ATSAMD20) and I am running i2c slave code on it. The Slave address is 0x54. I have set it as 0x54 in the slave code. Now when I try to scan the devices from NRF52840, the device is found at 0x28 address. Why is it so?? 

Parents
  • Typically i2c is 7-bit address followed by an 8th-bit that indicate read or write. Making up a total of 8-bit i2c transaction. When there is mismatch between i2c address set and the actual i2c address that the scanner finds, then it typically due to a bit shifting that occured when creating the 7-bit address on the slave (typically done by shifting the address one bit to the left, there one bit can be masked out). It is likely this is the case here, but you may need to try several adresses or use a logic analyzer to more easily understand this.

    0x54: 01010100 (shifting 1bit to the left and masking out the MSB: 0101000).
    0x28: 00101000

    At least that is what I expect. 

    Best regards,
    Kenneth

Reply
  • Typically i2c is 7-bit address followed by an 8th-bit that indicate read or write. Making up a total of 8-bit i2c transaction. When there is mismatch between i2c address set and the actual i2c address that the scanner finds, then it typically due to a bit shifting that occured when creating the 7-bit address on the slave (typically done by shifting the address one bit to the left, there one bit can be masked out). It is likely this is the case here, but you may need to try several adresses or use a logic analyzer to more easily understand this.

    0x54: 01010100 (shifting 1bit to the left and masking out the MSB: 0101000).
    0x28: 00101000

    At least that is what I expect. 

    Best regards,
    Kenneth

Children
No Data
Related