VS10xx driver

download

csdn:https://download.csdn.net/download/shaynerain/12712576

Introduction

mp3 decoder chip vs1053 driver, vs1003 is also applicable, the former with a microphone and the latter without. I personally think that these two chips are still expensive. If the storage medium space is large, it is better to use wav files to play sound, use DAC or PCM decoder, etc., which will be cheaper than this.

SPI configuration

SPI mode 3, the speed needs to be configured with two speeds, high speed and low speed, use low speed when configuring, and high speed when playing music, which can be viewed in the drive file

transplant

1. The migration mainly modifies the SPI interface and several control interfaces of the vs10xx.h file, which is relatively simple

2. Add initialization in the main file

#if USE_VS1053
		VS_HD_Reset();		   	//硬复位
		VS_Soft_Reset();  		//软复位 
		VS_Set_All();
		//VS_Sine_Test();
#endif

3. Play the sound, check the sending pin after opening the file, and send it cyclically

	VS_Restart_Play();  
	MP3_RET = f_open(&MP3_FIL, "8.mp3", FA_READ|FA_OPEN_EXISTING);
	if (MP3_RET == FR_OK)
	{
		VS_SPI_SpeedHigh();	
		while (1)
		{
			MP3_RET = f_read(&MP3_FIL, MP3_BUF, 32, &mp3_count);
			if(MP3_RET!=FR_OK || mp3_count!=32)
				break;
			while(VS_Send_MusicData(MP3_BUF))
			{
				osDelay(20);
			}
		}
		f_close(&MP3_FIL); 
	}

4. Sound setting, 0-255, the sound changes more obviously around 200, others are not obvious

to sum up

Generally, playing mp3 requires a file system and a real-time system to ensure that there is no problem under multitasking

 

Guess you like

Origin blog.csdn.net/shaynerain/article/details/108051899