issue for I2C slave using interrupt method on K64F51x

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

issue for I2C slave using interrupt method on K64F51x

1,503件の閲覧回数
chhsu0229
Contributor II

I am working on the I2C master mode and I2C slave mode using edma and interrupt method on K64F MCU.

 

I connect two k64F devices to test the I2C mode for master and slave.

 

The master I2C us used the edma to read 5 bytes data on slave address 0x50, subaddress 0x01.

 

Question 1:

The slave responds the 5 bytes data are 0xF0, 0xF0, 0xF0, 0xF0, and 0xF0.

 

In fact, the real dates are 0xF0, 0xF0, 0xF0, 0xF0 and 0xB0

 

It seems the Bit 6 is set as Low Bit on the last bytes and the wave form is shown as below,

Question 2:

 

Why does the wave form issue plus High signal that mark is read?

Thanks

2 (2).png

0 件の賞賛
返信
3 返答(返信)

1,431件の閲覧回数
chhsu0229
Contributor II

Hi,

The data is 0x00, 0x00, 0x00, 0x00, and 0x00 and the last byte does not become 0x40.

If the last data is 0x40 and it will become 0x00.

The SDK version that I use is 2.70 and the IDE is MCUX[ressIDE v11.1.1

Thanks

0 件の賞賛
返信

1,431件の閲覧回数
nxf56274
NXP Employee
NXP Employee

Hi,

  if (g_SlaveDirationFlag == true) //slave send data
      {

         I2C_SLAVE_BASEADDR->D = 0xF0; //0xFF

         g_slaveTxIndex ++;


         if((g_slaveTxIndex -1) == 5)
         {
            /* Switch to receive mode. */
         I2C_SLAVE_BASEADDR->C1 &= ~(I2C_C1_TX_MASK | I2C_C1_TXAK_MASK);

         /* Read dummy to release bus. */
            I2C_SLAVE_BASEADDR->D;

            g_SlaveDirationFlag = false;
            g_slaveTxIndex = 0;
            }
      }

  if((g_slaveTxIndex -1) == 5). This judgement has some problems.  It shuold be "if(g_slaveTxIndex  == 5) "

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 件の賞賛
返信

1,431件の閲覧回数
nxf56274
NXP Employee
NXP Employee

Hi,

 

If the data is 0xF0, 0xF0, 0xF0, 0xF0, and 0x00, will it become 0xF0, 0xF0, 0xF0, 0xF0, and 0x40 ? If so, check your code carefully, the send function may have some problems. What is your sdk, IDE?

 

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 件の賞賛
返信