使用stm32控制ch375, 单片机主频72M,采用并口方式,现在能播放歌曲,但是声音很慢,就像慢放一样,不知道问题出在哪,而且扫面文件也挺慢的,U盘里面5首歌要扫描3 4秒钟左右,下面是我的程序 -------------------------------------------------------------- u8 ch375_play_song(void) { u16 i; u8 n; u8 readSecCount; u32 total_Seccount; INT8U ch375Result; /*复位VS1003播放下一首歌曲*/ VS_Soft_Reset();//软复位VS1003 set1003();//设置VS1003 delay_ms(2);//延时2毫秒
strcpy( mCmdParam.Open.mPathName, "\\A.MP3" ); ch375Result = CH375FileOpen( ); if(ch375Result == ERR_SUCCESS) { CH375FileQuery(); printf( "\r\n%d\r\n", mCmdParam.Modify.mFileSize); total_Seccount = mCmdParam.Modify.mFileSize / 512; readSecCount = FILE_DATA_BUF_LEN / 512; SPIx_SetSpeed(SPI_SPEED_8);//高速,对VS1003B,最大值不能超过36.864/6Mhz mCmdParam.Read.mSectorCount = readSecCount; while (1) { CH375FileRead(); i = 0; VS1003_XCS = 1; do //主播放循环 { if((VS1003_DREQ != 0)) //非暂停 送数据给VS1003 { OS_ENTER_CRITICAL(); VS1003_XDCS = 0; //开VS1003片选 for(n = 0; n < 32; n++)//VS1003的FIFO只有32个字节的缓冲 { SPIx_ReadWriteByte(FILE_DATA_BUF[i++]); } VS1003_XDCS = 1; //关VS1003片选 OS_EXIT_CRITICAL(); } }while(i < FILE_DATA_BUF_LEN);//循环发送512个字节 SPIx_ReadWriteByte(0xff);//高速写命令延时 SPIx_ReadWriteByte(0xff);//高速写命令延时 SPIx_ReadWriteByte(0xff);//高速写命令延时 SPIx_ReadWriteByte(0xff);//高速写命令延时 SPIx_ReadWriteByte(0xff);//高速写命令延时 SPIx_ReadWriteByte(0xff);//高速写命令延时 total_Seccount -= readSecCount; /* 计数,减去当前实际已经读出的字符数 */ if ( total_Seccount < 1 ) { return 99; } } } }