Content originally posted in LPCWare by e135193 on Tue May 05 12:59:38 MST 2015
Hello
I'm having a transmit problem with my I2S. You can take a look the Tx_WS and Tx_SDA pins as on transmission. There is something wrong with Tx_SDA pin. it only transmits one of the two period of the Tx_WS. I'm using mono,16bit and 8Khz transmission . It should transmit one half of the Tx_WS but it transmitt on both half of the Tx_WS.
What could be my problem ? I share my settings.
void I2S_Config(void){
I2S_ConfigStruct.wordwidth = I2S_WORDWIDTH_16;
I2S_ConfigStruct.mono = I2S_MONO;
I2S_ConfigStruct.stop = I2S_STOP_ENABLE;
I2S_ConfigStruct.reset = I2S_RESET_ENABLE;
I2S_ConfigStruct.mute = I2S_MUTE_DISABLE;
I2S_ConfigStruct.ws_sel = I2S_MASTER_MODE;
I2S_Config(LPC_I2S,I2S_RX_MODE,&I2S_ConfigStruct);
I2S_Config(LPC_I2S,I2S_TX_MODE,&I2S_ConfigStruct);
I2S_Stop(LPC_I2S, I2S_TX_MODE);
I2S_Stop(LPC_I2S, I2S_RX_MODE);
I2S_ClkConfig.clksel = I2S_CLKSEL_FRDCLK;
I2S_ClkConfig.fpin = I2S_4PIN_DISABLE;
I2S_ClkConfig.mcena = I2S_MCLK_ENABLE;
I2S_ModeConfig(LPC_I2S,&I2S_ClkConfig,I2S_TX_MODE);
I2S_ClkConfig.clksel = I2S_CLKSEL_FRDCLK;
I2S_ClkConfig.mcena = I2S_MCLK_ENABLE;
I2S_ModeConfig(LPC_I2S,&I2S_ClkConfig,I2S_RX_MODE);
I2S_FreqConfig(LPC_I2S, 16000, I2S_TX_MODE);
I2S_FreqConfig(LPC_I2S, 16000, I2S_RX_MODE);
I2S_SetBitRate(LPC_I2S, 0x2F, I2S_RX_MODE);
I2S_SetBitRate(LPC_I2S, 0x2F, I2S_TX_MODE);
I2S_IRQConfig(LPC_I2S,I2S_RX_MODE,8);
I2S_IRQConfig(LPC_I2S,I2S_TX_MODE,1);
I2S_IRQCmd(LPC_I2S,I2S_RX_MODE,ENABLE);
}
void TIMER0_IRQHandler(void){
if (TIM_GetIntStatus(LPC_TIM0, TIM_MR0_INT)== SET)
{
if (sample < FRAME_SIZE)
{
I2S_Send(LPC_I2S, (OUT_Buffer[current_output_buffer][sample]) << 16);
sample++;
}
else
{
sample = 0;
if(current_output_buffer)
{
current_output_buffer = 0;
current_decode_buffer = 1;
}
else
{
current_output_buffer = 1;
current_decode_buffer = 0;
}
}
}
TIM_ClearIntPending(LPC_TIM0, TIM_MR0_INT);
}