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.

cc3200做slave中断问题

Other Parts Discussed in Thread: CC3200

大家好,我最近遇到了一些困扰我很久的问题,希望大家能提出解决方法或者建议。

我用cc3200做一个从机中断去接收主机发过来的一个字符,大致代码如下:

我在Debug模式下通过设置断点发现,可以跳进中断,但是uiStatus= I2CSlaveStatus(I2CA0_BASE)返回的值是0;这是什么原因呢?

void I2C0_IRQHandler(void)
{
     uint32_t uiStatus;
     uint32_t data;
     uiStatus = I2CSlaveStatus(I2CA0_BASE);
     data=I2CSlaveDataGet(I2CA0_BASE);
     I2CSlaveIntClearEx(I2CA0_BASE, I2C_SLAVE_INT_DATA);
     if(uiStatus & I2C_SCSR_DA)
     {

          data=I2CSlaveDataGet(I2CA0_BASE);
     }

     else if(uiStatus & I2C_SCSR_TREQ)
     {

     }
}

void I2C_Init(void)
{
     //PRCMPeripheralClkDisable(PRCM_I2CA0, PRCM_RUN_MODE_CLK);

     //Enable I2C Peripheral
     PRCMPeripheralClkEnable(PRCM_I2CA0, PRCM_RUN_MODE_CLK);
     PRCMPeripheralReset(PRCM_I2CA0);

     //Init Slave Mode, Set Slave Address
     I2CSlaveInit(I2CA0_BASE, MASTER_I2C_ADDR);

     I2CSlaveFIFODisable(I2CA0_BASE);

     //Enable Slave Interrupt
     I2CSlaveIntEnableEx(I2CA0_BASE, I2C_SLAVE_INT_START|I2C_SLAVE_INT_STOP|I2C_SLAVE_INT_DATA);

     //Register I2C Interrupt
     I2CIntRegister(I2CA0_BASE, I2C0_IRQHandler);

     //I2CMasterInitExpClk(I2CA0_BASE,80000000,false);

     I2CSlaveDataGet(I2CA0_BASE);

     //Enable Processor
     IntEnable(INT_I2CA0);
}

void main()
{
     //
     // Initailizing the board
     //
     BoardInit();
     //
     // Muxing for Enabling UART_TX and UART_RX.
     //
     PinMuxConfig();
     //
     // Initialising the Terminal.
     //
     InitTerm();

     I2C_Init();

     while(1)
     {

     }
}