Hi
I used CS4344 sound codec for making the wave player,and it works well,but it has a problem,I have to disconnect and then connect one of the output to start reading,Or activating the output.
Shematic is in the attachment.
this is my code:
int main(void)
{
MX_GPIO_Init();
MX_DMA_Init();
MX_I2S2_Init();
MX_SDIO_SD_Init();
MX_FATFS_Init();
res=f_mount(&SDFatFs, (TCHAR const*)SDPath, 0);
if(res==FR_OK)
{
res=f_open(&MyFile, "2.wav",FA_READ);
if(res==FR_OK)
{
f_read(&MyFile,&sai_buf[0],sample_no*2,&br);
f_read(&MyFile,&sai_buf[1],sample_no*2,&br);
}
}
index_buf++;
HAL_I2S_Transmit_DMA(&hi2s2,sai_buf[0],sample_no);
while (1)
{
/* USER CODE END WHILE */
/* USER CODE BEGIN 3 */
if(refill)
{
refill=0;
HAL_GPIO_WritePin(GPIOB,GPIO_PIN_5,GPIO_PIN_SET);
res=f_read(&MyFile,&sai_buf[index_buf%2],sample_no*2,&br);
HAL_GPIO_WritePin(GPIOB,GPIO_PIN_5,GPIO_PIN_RESET);
}
}
}
void HAL_I2S_TxCpltCallback(I2S_HandleTypeDef *hi2s)
{
HAL_I2S_Transmit_DMA(&hi2s2,sai_buf[index_buf%2],sample_no);
index_buf++;
refill=1;
}
someone know what the problem is??