当前位置:网站首页>Experience of using voice chip jq8400
Experience of using voice chip jq8400
2022-07-16 06:54:00 【Creator_ v】
Introduction to voice chip
Module features ( Brief introduction )
1、 Support MP3 WAV Hardware decoding
2、 Support FAT file system
3、 Two wire serial port mode 、 One line serial port mode
4、 Support the functions of ordinary music players as shown in the previous song 、 Next song 、 Play 、 Pause 、 stop it 、 Music selection and other common functions
5、 Support intelligent combination playback , Song combinations in specific folders , Just send the track name
6、30 Level volume adjustment
7、 The official has a supporting upper computer , It can generate transmission instructions to realize the required functions
Update voice content description
JQ8400 The voice module is SOC programme , Integrated with a 16 Bit MCU, And an audio decoder ADSP, Hard decoding is adopted , It ensures the stability and sound quality of the system . Small size can meet the needs of embedding other products .
SPI-flash( Change voice content )
The biggest advantage of this chip is that it can be replaced flexibly SPI-flash Voice content in , It saves the trouble of installing the upper computer to replace the voice of the traditional voice chip ,SPI FLASH Directly simulate as U disc , Follow copy U The dish is the same , Very convenient . It makes product development and production convenient and simple . One line serial port control mode 、RX232 Serial port control optional , Provide more options for R & D .USB Data line connection module , Plug in the computer , The computer will automatically recognize , Like inserting U The dish is the same , Voice content can be changed directly , There are certain restrictions on the naming method of voice files , The program also needs to be written in this format .
Module pin description

JQ8400-FL The chip pins , And with TF And have other controllable IO The chip of the mouth 
Chip pin description
Two line serial communication ( See the attached official document for the first-line serial communication )
Serial port transfer function
void UART1_SendCode(u8 *DATA,u8 len)
{
USART_ClearFlag(USART1,USART_FLAG_TC); // Clear the send flag before sending
while(len--)
{
USART_SendData(USART1, *DATA++);
while(USART_GetFlagStatus(USART1,USART_FLAG_TC)!=SET);// Wait for the end of sending
}
}
Two line serial port specifies the path to play The following is its driver function , Support Chinese and English numbers and other groups , It is suggested that the folder name and file name should not be too long . Create two folders , The folder name is test 1, test 1 There are folders 2, Folder 2 There are documents in the 00002 The audio of .
/************************************************************************ Function description : Play audio files in any path Entrance parameters :JQ8X00_Symbol: System letter ,*DATA: The path of the audio file to be played return return value : none Other instructions : Example of playing instructions Such as :/ advertisement / Mi phones .mp3, It can be in the following format / advertisement * / millet *???,“ advertisement *” The first two words stand for “ Advertising folder ”,* For wildcard Attention format , The next catalog symbol should be preceded by *, Such as / test 1* / test 2* /00002*??? JQ_8x00_RandomPathPlay(JQ8X00_FLASH," advertisement * / millet ") Play FLASH The file name in the root directory is 00001.mp3 The audio of , Then pass on JQ_8x00_RandomPathPlay(JQ8X00_FLASH,"/00001"); **************************************************************************/
void JQ8x00_RandomPathPlay(JQ8X00_Symbol symbol,char *DATA)
{
uint8_t Buffer[52] ={
0xaa,0x08};
uint8_t i,j;
Buffer[2] = 1 + strlen(DATA) + 4;
Buffer[3] = symbol;
i = 4;
while(*DATA)
{
Buffer[i++] = *DATA;
DATA++;
}
Buffer[i++] = '*';
Buffer[i++] = '?';
Buffer[i++] = '?';
Buffer[i++] = '?';
for(j=0;j<i;j++)
{
Buffer[i] = Buffer[i] + Buffer[j];
}
i++;
JQ8x00_UART(Buffer,i);
}
// The following is the playback function
char Path_Buffer[] = {
"/ test 1*/ test 2*/00002"}; // Play path : root directory -> test 1-> test 2 The next file is called 00002 The audio file for
JQ8x00_RandomPathPlay(JQ8X00_FLASH,Path_Buffer); // Play root directory -> test 1-> test 2 The next file is called 00002 The audio file for
Two line serial port combination play The following is its driver function , Combined playback is combined by file name , The file is required to be stored in “ZH” Under the folder , You can put the file name to be combined
Change the name to two bytes , It is generally recommended to use numbers to represent . Such as : 01.mp3,02.mp3, It can also be named with two letters or one Chinese character .
/************************************************************************ Function description : Combined broadcast function Entrance parameters : *DAT: String pointer ,Len String length return return value : none Other instructions : Put the file name to be advertised into the array as a formal parameter **************************************************************************/
void JQ8x00_ZuHeBoFang(uint8_t *DATA,uint8_t Len)
{
u16 CRC_data=0,i = 3;
uint8_t Buffer[ZH_MAX] ={
0xaa,0x1b};
Buffer[2] = Len*2; // Calculate the length
CRC_data = CRC_data + 0xaa + 0x1b + Buffer[2];
while(Len--)
{
Buffer[i] = *DATA/10+0x30; // Take out ten
CRC_data = CRC_data + Buffer[i];
i++;
Buffer[i] = *DATA%10+0x30; // Take out a bit
CRC_data = CRC_data + Buffer[i];
i++;
DATA++;
}
Buffer[i] = CRC_data;
i++;
JQ8x00_UART(Buffer,i);
}
// The following is the playback function
uint8_t ZH_Buffer[3] = {
1,2,3};
JQ8x00_ZuHeBoFang(ZH_Buffer,3); // take ZH The name under the folder is 01 02 03 Of 3 Audio files are played in turn
Chip communication adopts full duplex serial port communication ;
The baud rate is 9600, Data bits :8 , Stop bit 1 position , Inspection position N
Communication format
Start code - Instruction type - Data length (n)- data 1- data n- And inspection (SM)
Instruction code : Fixed for AA
Instruction type : Used to distinguish instruction types
Data length : The number of bytes of data in the instruction
data : Relevant data in the instruction , When the data length is 1 when , Only CMD, No data bits
And inspection : Is the low of the sum of all previous bytes 8 position , That is, the start code is added to the data and taken as the low 8 position Data format : Send data or commands , high 8 Bit data comes first , low 8 In the back
Agreement
Play state definition : The system is powered on and stopped
00( stop it ) 01( Play ) 02( Pause )
Drive letter definition : After switching the drive letter, it is in the stop state
USB:00 SD:01 FLASH:02 NO_DEVICE:FF
The volume : The volume is... In total 31 level ,0-30 level , On the phone, Mo thought 20 level
Play mode definition : On power, Mo thinks the single stops
/************************************************************************ Function description : Start code - Instruction type - Data length - The checksum Entrance parameters : MODE: Pattern return return value : none Other instructions : Countless data is transferred **************************************************************************/
void JQ8x00_Command(UartCommand Command)
{
uint8_t Buffer[4] ={
0xaa};
Buffer[1] = Command; // Instruction type
Buffer[2] = 0x00; // Data length
Buffer[3] = Buffer[0] + Buffer[1] + Buffer[2]; // The checksum
JQ8x00_UART(Buffer,4);
}
/************************************************************************ Function description : Start code - Instruction type - Data length - data - The checksum Entrance parameters : *DAT: String pointer ,Len String length return return value : none Other instructions : **************************************************************************/
void JQ8x00_Command_Data(UartCommandData Command,uint8_t DATA)
{
uint8_t Buffer[6] ={
0xaa};
uint8_t DataLen = 0;
Buffer[1] = Command; // Instruction type
if((Command != AppointTrack) && (Command != SetCycleCount) && (Command != SelectTrackNoPlay) && (Command != AppointTimeBack) && (Command != AppointTimeFast)) // Contains only one data instruction
{
Buffer[2] = 1; // Data length
Buffer[3] = DATA; // data
Buffer[4] = Buffer[0] + Buffer[1] + Buffer[2] + Buffer[3]; // The checksum
DataLen = 5;
}
else // Contains two data instructions
{
Buffer[2] = 2; // Data length
Buffer[3] = DATA/256; // data
Buffer[4] = DATA%256; // data
Buffer[5] = Buffer[0] + Buffer[1] + Buffer[2] + Buffer[3] + Buffer[4];
DataLen = 6;
}
The serial port transmission control instruction includes no data and multiple data
typedef enum {
CheckPlayState = 0x01, /* Query the broadcast status */
Play = 0x02, /* Play */
pause = 0x03, /* Pause */
Stop = 0x04, /* stop it */
LastSong = 0x05, /* Last song */
NextSong = 0x06, /* Next song */
CheckOnelineDisksign = 0x09, /* Query the current online drive letter */
CheckCurrentDisksign = 0X0A, /* Query the current drive letter */
CheckTotalTrack = 0x0C, /* Query the total tracks */
CurrentTrack = 0x0D, /* Current track */
LastFloder = 0x0E, /* Previous folder directory */
NextFloder = 0x0F, /* Next folder directory */
EndPlay = 0x10, /* End play */
CheckFloderFirstTrack = 0x11, /* Query file directory track */
CheckFloderAllTrack = 0x12, /* Query the total tracks of the file directory */
AddVolume = 0x14, /* Volume plus */
DecVolume = 0x15, /* Vol */
EndZHPlay = 0X1C, /* End the combined broadcast */
CheckSongShortName = 0x1E, /* Query song short file name */
EndLoop = 0x21, /* End reread */
GetTotalSongTime = 0x24, /* Get the total time of the current track */
OpenPlayTime = 0x25, /* Playback time development send */
ClosePlayTime = 0x26, /* Turn off playback time sending */
}UartCommand; // Instructions without data , Start code - Instruction type - Data length - The checksum
typedef enum {
AppointTrack = 0x07, /* Specify track playback */
SetCycleCount = 0x19, /* Set the number of cycles */
SetEQ = 0X1A, /*EQ Set up */
SelectTrackNoPlay = 0x19, /* The selected music will not be played */
GoToDisksign = 0X0B, /* Switch the specified drive letter */
SetVolume = 0x13, /* Volume settings */
SetLoopMode = 0x18, /* Set cycle mode */
SetChannel = 0x1D, /* Set up channels */
AppointTimeBack = 0x22, /* Specified time rewind */
AppointTimeFast = 0x23, /* Specified time rewind */
}UartCommandData; // Instructions containing multiple data , Start code - Instruction type - Data length - data 1-...- The checksum
Drive letter and cycle mode selection instruction
typedef enum {
JQ8X00_USB = 0X00, /*UPANND*/
JQ8X00_SD = 0x01, /*SD*/
JQ8X00_FLASH = 0x02, /*FLASH*/
}JQ8X00_Symbol; // System letter
// The cycle mode selection is contained in multiple data instructions
// SetLoopMode = 0x18, /* Set cycle mode */
typedef enum {
OverallCycle = 0X00, /* Total circulation Play the whole track in sequence , After playing, cycle */
SingleCycle = 0x01, /* Single tune circulation Keep looping the current track */
SingleStop = 0x02, /* Single stop Stop once after playing the current track */
OverallRandom = 0X03, /* Totally random Randomly play the tracks in the drive letter */
CatalogCycle = 0X04, /* Directory loop Play the tracks in the current folder in order , After playing, cycle , Directory does not contain subdirectories */
CatalogRandom = 0x05, /* Catalog random Play randomly in the current directory , Directory does not contain subdirectories */
CatalogTurnPlay = 0x06, /* Directory sequence playback Play the tracks in the current folder in order , Stop after playing , Directory does not contain subdirectories */
OverallTurnPlay = 0x07, /* Play the whole disc in sequence Play the whole track in sequence , Stop after playing */
}LoopModeSelect; // Cycle mode selection
Play different songs through key control , It uses atomic STM32ZET6 Serial port 1, See the attached document
The attachment :JQ8400
notes : Written with reference to official documents
边栏推荐
- Import word document pictures root file system production and mounting
- 如何使用Keil5中的虚拟示波器进行软件仿真
- 2022.6.24~2022.8.26 假期学习计划
- SSM整合(借鉴版)
- A series of operations of C language string (inverse output of string, mutual conversion of string type with int and double)
- [introduction to go language] 11 go language functions
- ROS command
- 使用MessageBox实现窗口表白小程序(附带源码)
- Automation instrumentation and process control (final review)
- 分布式理论
猜你喜欢

C language bit operation (applicable to the operation of MCU registers)

Pagoda panel creates multiple port deployment projects under the same server (lightweight application server one click deployment website, blog, gltlab full version)

Introduction to vscode plug-in installation

Keil5 shortcut key

Download and burn raspberry pie system image
![[Go语言入门] 09 Go语言切片详解](/img/e8/9d2df78a29c15d3564555b85f8a561.png)
[Go语言入门] 09 Go语言切片详解

Promise --- synchronize? Asynchronous?

将字符串s1中所有出现在字符串s2中的字符删除

Customize and modify the width and height of the van button in the van weap component library

学完C语言能干啥?先来做个推箱子吧~(有图片呦)
随机推荐
GY-53红外激光测距模块的使用以及pwm模式代码的实现
Vectorization of gradient descent method
[Go语言入门] 07 Go语言字符串
go语言websocket库Gorilla Websocket
[go language introduction] 13 go language interface details
vim用法
The 12th Blue Bridge Cup embedded simulation questions
Implementation of array flattening
学完C语言能干啥?先来做个推箱子吧~(有图片呦)
OpenGL 3D graphics development notes, terrain, lighting, shadows, etc
ES6 let, const detailed explanation
[Go语言入门] 12 Go语言结构体(struct)详解
C language bit operation (applicable to the operation of MCU registers)
Notepad++ open bin file
ROS communication mechanism
Import word document pictures root file system production and mounting
Download and burn raspberry pie system image
SSM integration (Reference Version)
分布式理论
[introduction to go language] 08 go language array