微波EDA网,见证研发工程师的成长!
首页 > 研发问答 > 无线和射频 > TI WIFI设计交流 > CC3200 的 non-DMA I2S 收发问题

CC3200 的 non-DMA I2S 收发问题

时间:10-02 整理:3721RD 点击:

TI 工程师,

     你们好,我现在又碰到了一个问题,non-DMA 的 I2S ,发数据的时候,只能发送前两个字节,两个字节之后I2SDataPutNonBlocking的返回值总是-1,应该表示buffer总是满的,为什么会出现这种情况啊?

     

unsigned long I2S_Xdata = 0;

void I2SIntHandler()

{

    unsigned long ulStatus;

    unsigned long ulDummy;

    int iRetVal;

    // Get the interrupt status

    ulStatus = MAP_I2SIntStatus(I2S_BASE);

//    UART_PRINT("====> I2SIntStatus = 0x%08x \n\r",ulStatus);

    // Check if there was a Transmit interrupt; if so write next data into the tx buffer and acknowledge

    // the interrupt

//    if(ulStatus & (I2S_INT_XDATA|I2S_INT_XSTAFRM|I2S_INT_XLAST))

    if(ulStatus & (I2S_INT_XDATA))

    {

     iRetVal = MAP_I2SDataPutNonBlocking(I2S_BASE,I2S_DATA_LINE_0,++I2S_Xdata);

MAP_I2SIntClear(I2S_BASE,(I2S_INT_XDATA));

       

 if ( iRetVal == 0 )

  UART_PRINT("INT_I2S_XDATA = 0x%08x \n\r",I2S_Xdata);

 else

  UART_PRINT("INT_I2S_XDATA FAILED! \n\r");

    }

    // Check if there was a receive interrupt; if so read the data from the rx buffer and acknowledge

    // the interrupt

//    if(ulStatus & (I2S_INT_RDATA|I2S_INT_RSTAFRM|I2S_INT_RLAST))

    if(ulStatus & (I2S_INT_RDATA))

    {

        iRetVal = MAP_I2SDataGetNonBlocking( I2S_BASE, I2S_DATA_LINE_1,&ulDummy);

        MAP_I2SIntClear(I2S_BASE,(I2S_INT_RDATA));

 if ( iRetVal == 0 )

  UART_PRINT("INT_I2S_RDATA = 0x%08x \n\r",ulDummy);

  else

  UART_PRINT("INT_I2S_RDATA FAILED! \n\r");

    }

//    UART_PRINT("I2SIntStatus = 0x%08x <====\n\r",ulStatus);

}

void I2S_Init(void)

{

    //512000 = 16*2*16000Khz(Num of bytes * STEREO * 16000 sampling)

    MAP_PRCMPeripheralClkEnable(PRCM_I2S,PRCM_RUN_MODE_CLK);

    MAP_PRCMPeripheralReset(PRCM_I2S);

#if 1

    MAP_PRCMI2SClockFreqSet(512000);

    MAP_I2SConfigSetExpClk(I2S_BASE, 512000, 512000, I2S_SLOT_SIZE_16|I2S_PORT_CPU);

#else

    MAP_PRCMI2SClockFreqSet(1411200);

    MAP_I2SConfigSetExpClk(I2S_BASE, 14112000, 14112000, I2S_SLOT_SIZE_16|I2S_PORT_CPU);

#endif

    MAP_I2SIntRegister(I2S_BASE, I2SIntHandler);

//    MAP_I2SIntEnable(I2S_BASE,(I2S_INT_XDATA|I2S_INT_XSTAFRM|I2S_INT_XLAST) );

    MAP_I2SIntEnable(I2S_BASE,(I2S_INT_XDATA) );

    MAP_I2SSerializerConfig(I2S_BASE, I2S_DATA_LINE_0,I2S_SER_MODE_TX, I2S_INACT_LOW_LEVEL);

//    MAP_I2SIntEnable(I2S_BASE,(I2S_INT_RDATA|I2S_INT_RSTAFRM|I2S_INT_RLAST) );

    MAP_I2SIntEnable(I2S_BASE,(I2S_INT_RDATA) );

    MAP_I2SSerializerConfig(I2S_BASE, I2S_DATA_LINE_1, I2S_SER_MODE_RX, I2S_INACT_LOW_LEVEL);

#if 0

    MAP_I2SEnable(I2S_BASE, I2S_MODE_TX_RX_SYNC);

#endif

}

bool I2S_test_flag = 0;

void I2S_start(void)

{

MAP_I2SEnable(I2S_BASE, I2S_MODE_TX_RX_SYNC);

I2S_test_flag = 1;

}

void I2S_stop(void)

{

MAP_I2SDisable(I2S_BASE);

I2S_test_flag = 0;

}

算了采用DMA模式,不再纠结该问题。

你好,你这个问题解决了吗?求指导

同求,解决了吗

Copyright © 2017-2020 微波EDA网 版权所有

网站地图

Top