当前位置:网站首页>VS1003 debugging routine
VS1003 debugging routine
2022-07-28 12:42:00 【yi_ tianchou】
development tool IAR
chip :MSP430F5438
Audio module :VS1003B/VS1053
First get it, then , It's like going online to find a driver made by others and using it directly ,( si )
Looking for a day without fruit , Only fragments can be found , Or the chip model is wrong , I also saw it in the middle n Many articles introduce VS1003 Debug routine , I also saw several drivers .
About . Not much code . It's not very complicated .
good
Since there is no online can , Then start transplanting others . A meal check VS manual , Look at the notes of others' projects , Development completed , The test was completely silent , What is Zhengxuan wave , what MP3 , Not a hair ....
I'll be good .
To analyze
First VS1003 Several pins of , Is it connected incorrectly , Checked several times before and after , Even wonder if DREQ You need to pull up the resistor .
In the middle STM A development board for , Use ST The project has verified ,STM It can work on the board , and DREQ Whether there is a pull-up resistor is irrelevant
Then began to doubt Baud rate problem , hold MPS430 Take out your manual USCI I checked it from beginning to end ,VS1003 Above description

vs The default frequency doubling is 1.0x vs The crystal oscillator connected to the board of is 12.88Mhz Of , Then it should be no more than 3M. Okay
Start adjusting SPI Rate , To adjust to 3M, No sound .
No longer doubt the code problem , Began to doubt life
Look through the code again , That's all right. , Then compare it with stm32 The driver , Find out st Of SPI The rate is adjusted very low . Start to slow down the rate , The reality is that SPI In operation SCI Time cannot exceed 400K. Is the key , Because more than 400K, Data sent by the host , The slave cannot receive . This is the problem
A miracle happened , It can be played normally Zhengxuan wave . Happy . But I'm not happy 5 minute . It is found that Zhengxuan wave can be played , But play MP3 file , Here's a moment DERQ It will not be raised .
Is it too fast to finish playing .
Adjust whether it is Turn the frequency up and down , Always can only sin test , Instead of playing MP3 file . Then try to read the register data , I found that I couldn't read .
Then I found the oscilloscope , Yes CS DSC SCLK MISO SIMO Take measurements , Find out SOMI Indeed, the data is wrong , OK, forget it first , Since I can write it in , Then it should be normal , Read again VS Manuals . A detail was ignored before .:


SDI At work CS In fact, it is high in other words Sending MP3 The data should be DSC Pull it down CS pull up ,( Actually, it's a little against SPI cs Selected )
This makes me miserable , During this period, it is suspected that SMCLK and MCLK problem , Modify DCS and CS Control it ,
The test again ,MP3 It can play normally . Previously, it was still used 400K The following rate , I found that the sound was not smooth , Try to spi Speed up , If you need to use SCI take vs1003 Of 03 Register frequency doubling to 3 times . Here we are mp3 Playback process .


The whole use process :
VS10XX_HardwareReset();// adopt RES foot restart vs1003
Mp3DeselectControl(); // pull up CS foot
Mp3DeselectData();// pull up DCS foot
Mp3SelectData(); // Open data slice selection , That is to open SDI Pass on xDCS = 1, choice VS10XX Data interface
SPI_Write_Byte(0xFF);
SPI_Write_Byte(0xFF);
SPI_Write_Byte(0xFF);
SPI_Write_Byte(0xFF);
Mp3DeselectData(); // Close data slice selection
VS_Write_Reg(0,0x08,0x04); // Software reset , towards 0 No. register is written 0x0804 SM_SDINEW by 1 SM_RESET by 1
VS_Write_Reg(3,0x98,0x00); // The clock is set , towards 3 No. register is written 0x9800 SC_MULT by 4 SC_ADD by 3 SC_FREQ by 0
VS_Write_Reg(SPI_VOL ,0x30,0x30); // Volume settings , towards 0B Number register write in Left voice way 30 Right channel 30 ---0x00,0x00 Both left and right channels have maximum volume
Mp3SelectData(); // Open data slice selection , Note that this time XCS( Command chip selection ) High level ,SDI It works
SPI_Write_Byte(0); // Write data , Write here 4 individual 0, It's irrelevant data , Used to start data transmission
SPI_Write_Byte(0);
SPI_Write_Byte(0);
SPI_Write_Byte(0);
Mp3DeselectData(); // Close data slice selection ,SDI Invalid
set_SPI_bps(5);// Set up High frequency rate
Then you can test Zhengxuan wave and mp3 It's on
/***********************************************************************
**********
28
** The name of the function : void VS_SinTest(INT8U x).
** Function description : Sine test function , Check vs1003 If there is something wrong .
** Input parameters : INT8U x Sine wave frequency .
** Output parameters : None.
** Returns the parameter : None.
***********************************************************************
***********/
void VS_SinTest(int x)
{
VS_Write_Reg(0x00,0x08,0x20);/* Start the test , towards 0 No. register is written 0x0820 SM_SDINEW by 1 SM_TEST by 1 */
while(!(P2IN&MP3_DREQ)); //VS1003 Of DREQ High to write data
Mp3SelectData(); // Open data slice selection , That is to open SDI transmission
SPI_Write_Byte(0x53); /* Write the following 8 Bytes , Enter sine test */
SPI_Write_Byte(0xef);
SPI_Write_Byte(0x6e);
SPI_Write_Byte(x); /* Parameters x Used to adjust the frequency of sine wave in sine test */
SPI_Write_Byte(0);
SPI_Write_Byte(0);
SPI_Write_Byte(0);
SPI_Write_Byte(0);
VS_delay(60000); /* Here is a time delay , You can hear “ Sine tone ”*/
VS_delay(60000);
VS_delay(60000);
VS_delay(60000);
VS_delay(60000);
VS_delay(60000);
SPI_Write_Byte(0x45); /* Write the following 8 Bytes , Exit sine test */
SPI_Write_Byte(0x78);
SPI_Write_Byte(0x69);
SPI_Write_Byte(0x74);
SPI_Write_Byte(0);
SPI_Write_Byte(0);
SPI_Write_Byte(0);
SPI_Write_Byte(0);
Mp3DeselectData(); // Close data slice selection
}
unsigned char VS10XX_SendMusicData( unsigned char *dat)
{
unsigned char i;
while(!(P2IN&MP3_DREQ));
set_SPI_bps(15);
Mp3SelectData(); // Open data slice selection , That is to open SDI transmission
for(i=0; i<8; i++)
{
SPI_Write_Byte(dat[i]);
}
Mp3DeselectData(); // Close data slice selection
return 0;
}
end
https://wenku.baidu.com/view/fa1efcc990c69ec3d4bb756a.html
This article is well written , The debugging idea is relatively clear
边栏推荐
- [nuxt 3] (XII) project directory structure 3
- 用C语言开发NES游戏(CC65)02、什么是v-blank?
- 1331. Array sequence number conversion: simple simulation question
- Tik tok "founder" Yang Luyu, farewell byte?
- 恋爱男女十禁
- Open source database innovation in the era of digital economy | the 2022 open atom global open source summit database sub forum was successfully held
- C# 结构使用
- Why do enterprises need the ability of enterprise knowledge management?
- MySQL之知识点(十三)
- 【Base】优化性能到底在优化啥?
猜你喜欢

Newly released, the domestic ide developed by Alibaba is completely open source

New Oriental's single quarter revenue was 524million US dollars, a year-on-year decrease of 56.8%, and 925 learning centers were reduced

Developing NES games with C language (cc65) 09, scrolling

Kuzaobao: summary of Web3 encryption industry news on July 13

FlexPro软件:生产、研究和开发中的测量数据分析

聚变云原生,赋能新里程 | 2022 开放原子全球开源峰会云原生分论坛圆满召开

Uniapp wechat applet realizes the function of connecting low-power Bluetooth printing

MMA8452Q几种模式的初始化实例

OpenAtom OpenHarmony分论坛圆满举办,生态与产业发展迈向新征程

Using Arduino to develop esp8266 to build a development environment
随机推荐
Hongjiu fruit passed the hearing: five month operating profit of 900million Ali and China agricultural reclamation are shareholders
The input string contains an array of numbers and non characters, such as a123x456. Take the consecutive numbers as an integer, store them in an array in turn, such as 123 in a[0], 456 in a[1], and ou
Let Arduino support nuvotom Xintang
第九章 REST 服务安全
Deployment之滚动更新策略。
Anhui Jingzhun: Beidou satellite synchronous clock | Beidou synchronous clock | NTP network clock server
Open source office (ospo) unveils Secrets
Developing NES games with C language (cc65) 04. Complete background
HC-05蓝牙模块调试从模式和主模式经历
Did kafaka lose the message
STM32F103 几个特殊引脚做普通io使用注意事项以及备份寄存器丢失数据问题1,2
Analysys analysis: focus on users, improve the user experience of mobile banking, and help the growth of user value
Distributed session solution
用C语言开发NES游戏(CC65)07、控制器(和精灵碰撞)
【Base】优化性能到底在优化啥?
Distributed timer
公司在什么情况下可以开除员工
Some API interfaces purchased by Yiwu hope to bring you some help
Uniapp wechat applet realizes the function of connecting low-power Bluetooth printing
Developing NES games with C language (cc65) 11. Metatiles