MKE02Z I2C0 issue

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 
1,235件の閲覧回数
neilporven
Senior Contributor I

I am having an issue with the I2C module.  I am writing to an LCD controller chip that uses I2C.

If I step through my code, I can see all bytes being pumped out and the LCD controller chip is 

ACKing my bytes properly.  

The minute I let the software run, bytes don't appear on my scope,nor do I see the numbers I 

am pumping out to the LCD?????

I feel there is an issue with my I2C STATUS wait.  Here is the code for  the STATUS wait:

I2C0_D = ucData; //Write

//Make sure we Arbitration is not lost 1=Lost 0=Standard bus operation
if ((I2C0_S & I2C_S_ARBL_MASK) == 0)
  {//Begin if (Standard Bus Operation)

     //Wait until an acknowledge signal is detected
     while ((I2C0_S & I2C_S_RXAK_MASK) == 1)
        {
          return (1);
          break;
       }
  }//End if (Standard Bus Operation)
else
  I2C0_S |= I2C_S_ARBL_MASK; //Clear the arbitration

Thank you,

Neil

ラベル(1)
0 件の賞賛
返信
1 解決策
1,113件の閲覧回数
mjbcswitzerland
Specialist V

Hi

I would use the TCF or IICIF flag to wait for transmission and then the RXAK only to check whether a slave responded or not.

Possibly the RXAK flag is meaningless during transmission and so only set in an error case, which would cause your loop to immediately quit when run at normal speed (and something later abort transmission).

IICIF operation with interrupts would be generally more efficient, whereby KE02 code is identical to code for all KL and K parts (except newer double-buffered I2C controller types).

Regards

Mark

元の投稿で解決策を見る

0 件の賞賛
返信
2 返答(返信)
1,114件の閲覧回数
mjbcswitzerland
Specialist V

Hi

I would use the TCF or IICIF flag to wait for transmission and then the RXAK only to check whether a slave responded or not.

Possibly the RXAK flag is meaningless during transmission and so only set in an error case, which would cause your loop to immediately quit when run at normal speed (and something later abort transmission).

IICIF operation with interrupts would be generally more efficient, whereby KE02 code is identical to code for all KL and K parts (except newer double-buffered I2C controller types).

Regards

Mark

0 件の賞賛
返信
1,113件の閲覧回数
neilporven
Senior Contributor I

Hi Mark,

As always thank you!  I used the TCF and now it's working, I left the RXAK flag to make

sure the other chip is communicating.

Neil

0 件の賞賛
返信