This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

c6748 i2c slave模式配置怎么做?

我配置dsp slave 接受模式,无法接受数据

代码:

I2CPinMuxSetup(0);

    HWREG(SOC_I2C_0_REGS + I2C_ICPFUNC) &= ~0x01;

    // place I2C in reset
    HWREG(SOC_I2C_0_REGS + I2C_ICMDR) &= ~(I2C_ICMDR_IRS);

    HWREG(SOC_I2C_0_REGS + I2C_ICMDR) &= ~(I2C_ICMDR_NACKMOD    // no ack
                                            | I2C_ICMDR_MST        // in slave mode
                                            | I2C_ICMDR_FREE    //
                                            | I2C_ICMDR_RM        // Nonrepeat mode. The value in the data count register (ICCNT) determines how many data words are received/transmitted by the I2C.
                                            | I2C_ICMDR_DLB        // disable loopback
                                            | I2C_ICMDR_TRX        // receive mode
                                            | I2C_ICMDR_FDF);

    //HWREG(SOC_I2C_0_REGS + I2C_ICMDR) |= I2C_ICMDR_FDF;
    HWREG(SOC_I2C_0_REGS + I2C_ICOAR) = 0x28;
    /* Bring the I2C module out of reset */
    HWREG(SOC_I2C_0_REGS + I2C_ICMDR) |= I2C_ICMDR_IRS;


    while ((HWREG(SOC_I2C_0_REGS + I2C_ICSTR) & (0x01 << 9)) != 0) {

    }