MIMXRT1064 I2C Does not Read

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

MIMXRT1064 I2C Does not Read

2,104 Views
BryanWilcutt
Contributor I

I'm using MCUXpresso with an MIMXRT1064 processor.  I am able to write data to my I2C device just fine, I can even read (according to sniffing the I2C bus) but the data is not removed from the stream and placed in my buffer.

The calls are:

uint8_t val = 0;

val = 0xee;

BOARD_LPI2C_Send(base, SSM4567_ADDR, SSM4567_REG_DAC_VOLUME, 1, (uint8_t *) &val, sizeof(val));

val = 0;

BOARD_LPI2C_Receive(base, SSM4567_ADDR, SSM4567_REG_DAC_VOLUME, 1, (uint8_t *) &val, sizeof(val));

 

Setting the device's volume to 0xee works just fine, reading it back works fine too as the 0xee data is returned in the I2C stream.  However, the LPI2C driver doesn't move that data to my buffer.

 

Am I missing something?

 

 

0 Kudos
Reply
5 Replies

2,097 Views
BryanWilcutt
Contributor I

Update:

 

Okay, I am able to read my data from the LPI2C bus, however it is ONE byte behind.

 

In other words:

Write 5 - > Read garbage

Write 6 - > Read 5

Write 7 - > Read 6

 

Should be:

 

Write 5 - > Read 5

Write 6 - > Read 6

Write 7 - > Read 7

 

Is the hardware buffering the LPI2C and sending me back the PREVIOUS packet?

 

 

0 Kudos
Reply

2,099 Views
jeremyzhou
NXP Employee
NXP Employee

Hi,
Thank you for your interest in NXP Semiconductor products and for the opportunity to serve you.
To provide the fastest possible support, I'd highly recommend you refer to the lpi2c demos in the SDK library.
Have a great day,
TIC

-------------------------------------------------------------------------------
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
Reply

2,095 Views
BryanWilcutt
Contributor I

Jeremy, 

 

Does the read buffer to LPI2C have to be in non-cacheable memory?  Is that the issue?

0 Kudos
Reply

2,069 Views
jeremyzhou
NXP Employee
NXP Employee

Hi,
Thanks for your reply.
1) Does the read buffer to LPI2C have to be in non-cacheable memory? Is that the issue?
-- No, however, I'd like to recommend you store the read data in non-cacheable memory to avoid the cache data coherency problem.
Further, I'd like to suggest you use a logic analyzer to observe the I2C data stream and compare it to the slave device's datasheet, I think it can give you an insight into the phenomenon.
Have a great day,
TIC

-------------------------------------------------------------------------------
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
Reply

2,096 Views
BryanWilcutt
Contributor I

Thank you for your reply!

0 Kudos
Reply