I2C_MasterStart() doesn't write address

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

I2C_MasterStart() doesn't write address

2,001件の閲覧回数
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).

タグ(2)
0 件の賞賛
返信
4 返答(返信)

1,664件の閲覧回数
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 件の賞賛
返信

1,664件の閲覧回数
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 件の賞賛
返信

1,664件の閲覧回数
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 件の賞賛
返信

1,664件の閲覧回数
visakhanc
Contributor III

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

--Visakhan

0 件の賞賛
返信