LPC55S69 IIC通信

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

LPC55S69 IIC通信

1,463 Views
wangyibin
Contributor II

在lpc55S69的iic通信中,fsl_iic.c的库文件中有kI2C_SlaveIrqFlags | I2C_INTSTAT_MONIDLE_MASK就能判断一帧数据是否发送或接收完成?实际测试过程中,图二中的这个标志位没有置位?请问这个I2C_INTSTAT_MONIDLE_MASK这个功能该如何使用呢?

wangyibin_0-1669785815865.png

wangyibin_1-1669785829098.png

 

Labels (1)
0 Kudos
Reply
4 Replies

1,418 Views
zhang2
Contributor I

When  I use  the LPC55S28 IIC slave function; When the rxSize is variable and unfixed,How  to get the completeflag, how to check the stop signal; 

Thanks very much!

0 Kudos
Reply

1,421 Views
zhang2
Contributor I

When  I use  the LPC55S28 IIC slave function; When the rxSize is variable and unfixed,How  to get the completeflag, how to check the stop signal; 

Thanks very much!

0 Kudos
Reply

1,392 Views
xiangjun_rong
NXP TechSupport
NXP TechSupport

Hi,

对于I2C slave, 请参考例子 i2c_interrupt_b2b_transfer_slave.
尤其是这个callback function.

static void i2c_slave_callback(I2C_Type *base, volatile i2c_slave_transfer_t *xfer, void *userData)
{
    switch (xfer->event)
    {
        /*  Address match event */
        case kI2C_SlaveAddressMatchEvent:
            xfer->rxData = NULL;
            xfer->rxSize = 0;
            break;
        /*  Transmit request */
        case kI2C_SlaveTransmitEvent:
            /*  Update information for transmit process */
            xfer->txData = &g_slave_buff[2];
            xfer->txSize = g_slave_buff[1];
            break;

        /* Setup the slave receive buffer */
        case kI2C_SlaveReceiveEvent:
            /*  Update information for received process */
            xfer->rxData = g_slave_buff;
            xfer->rxSize = I2C_DATA_LENGTH;
            break;

        /* The master has sent a stop transition on the bus */
        case kI2C_SlaveCompletionEvent:
            g_SlaveCompletionFlag = true;
            break;

        default:
            g_SlaveCompletionFlag = false;
            break;
    }
}


当master传输完数据,发出stop信号,下列指令将要执行, 这里你可以加入你的代码。

case kI2C_SlaveCompletionEvent:
            g_SlaveCompletionFlag = true;
//add customer code here:
            break;

 

Hope it can help you

BR

XiangJun Rong

0 Kudos
Reply

1,453 Views
xiangjun_rong
NXP TechSupport
NXP TechSupport

Hi,

Regarding the bit of I2C_INTSTAT_MONIDLE_MASK bit, pls refer to the I2C status register as the following pic, I copied from UM11126.pdf(UM for LPC556x/2x).

xiangjun_rong_0-1669872789337.png

If you want to use the monitoring function, you have to enable monitoring function in CFG register.

xiangjun_rong_1-1669872949843.png

 

You can use the code to set the MONEN bit:

I2C0->CFG|=1<<2;

 

Hope it can help you

BR

XiangJun Rong

Tags (1)
0 Kudos
Reply