S32K144 EVB: No data sent after receiving ACK in I2C

cancel
Showing results for 
Search instead for 
Did you mean: 

S32K144 EVB: No data sent after receiving ACK in I2C

Jump to solution
719 Views
sripav-7
Contributor III

Hello

I am trying to interface the S32K144 EVB to the TC74 (http://www.mouser.com/ds/2/268/21462c-73653.pdf ) temperature sensor. This is my pin configuration:

pastedImage_3.png

This is my I2C config:

pastedImage_17.png

Clocks:

pastedImage_18.png

This is my code:

lpi2c_master_state_t lpi2c1MasterState;

uint8_t buffer[TRANSFER_SIZE];
uint8_t txbuffer;
uint8_t temp;

LPI2C_DRV_MasterInit(INST_LPI2C1, &lpi2c1_MasterConfig0, &lpi2c1MasterState);
txbuffer = 0x00;
LPI2C_DRV_MasterSendDataBlocking(INST_LPI2C1,&txbuffer, 1, false, OSIF_WAIT_FOREVER);
LPI2C_DRV_MasterReceiveDataBlocking(INST_LPI2C1, &temp, 1, true, OSIF_WAIT_FOREVER);

I disabled the internal pullup and I am using external pull-up resistors to pull to 3.3 V because my sensor doesn't operate at 5V. The code compiles fine and I see that the controller tries to send on the I2C lines but there is no ACK received from the sensor.

My SCL is connected to J1-03 and SDL to J1-01.

What am I doing wrong?

EDIT: I set the baudrate to 100 KHz (it was set to 40 KHz before) and I executed only transmit command without receive and I seem to receive ACK. However, no data is being transmitted after that. Still no clue what's wrong. Here is the scope reading:

pastedImage_4.png

Thank you,

Sri Harsha Pavuluri

Labels (1)
Tags (2)
1 Solution
152 Views
Ray_V
Contributor V

The first 7 bits are your slave address 0x4D (sensor), the 8th bit is low, so it is a write operation. The 9th bit is high (NACK), since your sensor did not acknowledge (ACK = low) the master is not sending the data. It could be stuck because you specified no timeout (OSIF_WAIT_FOREVER). You have to first find out why your sensor does not ACKnwledge.

View solution in original post

0 Kudos
3 Replies
152 Views
sripav-7
Contributor III

Turns out the part I have is a special version with a different address. It works properly. Thank you so much.

0 Kudos
153 Views
Ray_V
Contributor V

The first 7 bits are your slave address 0x4D (sensor), the 8th bit is low, so it is a write operation. The 9th bit is high (NACK), since your sensor did not acknowledge (ACK = low) the master is not sending the data. It could be stuck because you specified no timeout (OSIF_WAIT_FOREVER). You have to first find out why your sensor does not ACKnwledge.

View solution in original post

0 Kudos
152 Views
dianabatrlova
NXP TechSupport
NXP TechSupport

Hi sripav-7@student.ltu.se,

I recommend you to look at the working example code for the I2C provided by the S32 Design Studio. It can help you to understand how communication works.

Best regards,

Diana