NHS3152 I2C connection problem

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

NHS3152 I2C connection problem

跳至解决方案
3,182 次查看
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

标记 (2)
0 项奖励
回复
1 解答
3,084 次查看
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 项奖励
回复
3 回复数
3,084 次查看
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 项奖励
回复
3,085 次查看
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 项奖励
回复
3,084 次查看
Kan_Li
NXP TechSupport
NXP TechSupport

Hi Damian,

Thanks for the update!

Best Regards,

Kan

0 项奖励
回复