I2C_MasterStart() doesn't write address

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

I2C_MasterStart() doesn't write address

1,046 Views
beng_
Contributor III

According to the documention I2C_MasterStart(0 is supposed to send a start condition and then write the start address.

It doesn't' appear to be doing that.

I2C_MasterStart(I2C0, SENSIRION_I2C_ADDRESS, kI2C_Write);
I2C_MasterWriteBlocking(I2C0, local_buffer, 2);
I2C_MasterStop(I2C0);

If I put a breakpoint on the second line all that's on the I2C is:

pastedImage_3.png

There's no clocking of SCL done.

It also seems to leave MasterWriteBlocking() hanging as that gets permanently stuck at the line:

/* Wait until the data register is ready for transmit. */
while (!(base->S & kI2C_TransferCompleteFlag))

Right now there's not actually anything attached to my I2C lines (except the pull-up resistors) (as I'd removed the device I was trying to talk to to eliminate that as a case of my problems).

Tags (2)
0 Kudos
4 Replies

709 Views
mwutley
Contributor II

Hi Ben,

Were you able to resolve this issue? I am having the exact same problem. The 'Start' event occurs, but the address never shows up after that. And, when the slave address should show up, there is no clock showing up.

Thanks,

Matt

0 Kudos

709 Views
visakhanc
Contributor III

Hi,

   Are the I2C pins initialized properly (since there is no I2C clock)? It seems START condition is being sent (Toggle of DATA)

   Also, the above code for sending data is does not include waiting for the Interrupt Flag after I2C_MasterStart(). (See the code for I2C_MasterTransferBlocking() to see its usage)

   

   Just for curiosity, why are you trying to transfer data using lower layer functions, when you can do the transfer in one call of I2C_MasterTransferBlocking() ?

--Visakhan

0 Kudos

709 Views
beng_
Contributor III

I'm using the lower level functions because the I2C device I'm talking too doesn't quite follow the I2C spec when takings readings. Either it holds down SDA until it's taken a reading and is ready to report that (and I can't seem to use the I2C library in order to handle that). Or it requires constant polling to determine if it's completed a reading (ACKs Read address) or not (NAKs Read Address), the I2C_RTOS_Transfer() doesn't seem to reliably report ACKs or NAKs.

0 Kudos

709 Views
visakhanc
Contributor III

Check the return value from the functions (ie, I2C_MasterStart()) and verify it is kStatus_Success.

--Visakhan

0 Kudos