Embedded general hardware module design - serial port audio playback module

Module function display:

Serial audio control module

insert image description here

1. Introduction

The solution is a serial port audio playback chip + power amplifier chip, the port audio playback chip IC is my1690-16s, and the power amplifier is PAM8406.

1、my1690-16s

A card MP3 player control chip controlled by the serial port of Maiyou Technology, supports serial port control to play specified audio, volume adjustment and other functions. Support dual decoding of MP3 and WAV formats, support 24-bit DAC output, the module supports a maximum of 32G TF card, and an external U disk or USB data cable can also be connected to a computer to replace SD card audio files;

2、PAM8406

PAM8406 is a digital power amplifier chip that supports dual channels and can drive two 5W speakers. It is recommended that the speakers use about 3-4W. 5W will heat up when used at high volume for a long time, but the problem is not big. The module can be used in many Store purchases, such as Taobao, Lichuang Mall and other platforms, the price ranges from a few cents to about 2 yuan.

2. Circuit design

1、my1690-16s

Refer to the chip manual:
insert image description here
for example:
insert image description here

2、PAM8406

Reference chip manual:
insert image description here

For example:
insert image description here

3. Complete reference circuit

insert image description here
The PCB project has been uploaded to the "Open Source Hardware Platform":
Easy Open Source Hardware Platform - Design of Universal Serial Port Audio Playback Module

3. STM32 serial port control audio playback routine

1. Open the routine

When the author tested, the serial port debugging assistant was used initially. We can also use any MCU with a serial port to program and control audio playback. You can reply to "0839" in the public account "IOT fun production" to get the project file, and open the "MP3- my1690-16s module test code-keil project" folder, the project mainly adds MP3.c and MP3.h files, which are located in the ".\HARDWARE\MP3" folder under the project directory.
insert image description here
insert image description here

2、MP3.C/H

In the keil project, the serial port 3 of the STM32 is mainly used to send hexadecimal serial port commands. In the MP3 resource file, for example, the function of playing a specified MP3 is as follows:

/*
*********************************************************************************************************
* 函 数 名: PlayMp3
* 功能说明: 播放指定MP3
* 形 参:uint8_t mp3num:1-65535
* 返 回 值: 无
*********************************************************************************************************
*/
void PlayMp3(uint8_t mp3num)
{
    
    
    //起始码 长度 操作码 曲目高位 曲目低位 校验码 结束码
    //7E     05     41      00       01      45     EF
    uint8_t arry[]={
    
    0x7E,0x05,0x41,0x00,0x00,0x00,0xEF};    
    arry[3]=mp3num/256;
    arry[4]=mp3num%256;
    arry[5]=(arry[1]^arry[2]^arry[3]^arry[4]);
    USART3_Send_Hex_Buff(arry,7);
}

After burning the routine, you can try to use STM32 to control the audio module to play various MP3s.

Guess you like

Origin blog.csdn.net/weixin_43351158/article/details/132570164