NHS3152 I2C connection problem

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

NHS3152 I2C connection problem

Jump to solution
644 Views
damian_potoczny
Contributor I

Hello,

I'm trying to connect a peripheral IC to NHS3152 demo board. I'm using the I2CIO library part and informations provided in release_mra2_11_2_nhs3152 SDK. I'm facing the following issue:
I am not able to select the device via I2C - the address 0xEA should be sent, but on the bus i am observing a different output:
traces.png

The data is recognized as '212' but it should be '234'
The system runs at 4 MHz, and the I2C is set to 100kHz.

Thanks in advance for any help provided.
Damian

Tags (2)
0 Kudos
1 Solution
546 Views
damian_potoczny
Contributor I

Hello,

Thank you for the reply.Kan

Just the other day i/ve found the anserw myself by reading through the I2C driver library.

It turns out that the lib shifts the inputed address bits by one to the left to make room for the R/W bit.

int handleMasterXferState(NSS_I2C_T *pI2C, I2C_XFER_T *xfer) {

uint32_t cclr = I2C_CON_FLAGS;

switch (getCurState(pI2C)) {

case 0x08: /* Start condition on bus */

case 0x10: /* Repeated start condition */

pI2C->DAT = (uint32_t)((xfer->slaveAddr << 1) | (xfer->txSz == 0));

break;


I've been addressing the device with 8 bits ( R/W bit included).

I've corrected that and now it works like a charm.

Damian

View solution in original post

0 Kudos
3 Replies
546 Views
Kan_Li
NXP TechSupport
NXP TechSupport

Hello,

Is it possible to have your application code for a review?

Have a great day,
Kan

 

-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!

 

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 Kudos
547 Views
damian_potoczny
Contributor I

Hello,

Thank you for the reply.Kan

Just the other day i/ve found the anserw myself by reading through the I2C driver library.

It turns out that the lib shifts the inputed address bits by one to the left to make room for the R/W bit.

int handleMasterXferState(NSS_I2C_T *pI2C, I2C_XFER_T *xfer) {

uint32_t cclr = I2C_CON_FLAGS;

switch (getCurState(pI2C)) {

case 0x08: /* Start condition on bus */

case 0x10: /* Repeated start condition */

pI2C->DAT = (uint32_t)((xfer->slaveAddr << 1) | (xfer->txSz == 0));

break;


I've been addressing the device with 8 bits ( R/W bit included).

I've corrected that and now it works like a charm.

Damian

0 Kudos
546 Views
Kan_Li
NXP TechSupport
NXP TechSupport

Hi Damian,

Thanks for the update!

Best Regards,

Kan

0 Kudos