FN-M16P Embedded MP3 Audio Module Datasheet: Flyron Technology Co., LTD
FN-M16P Embedded MP3 Audio Module Datasheet: Flyron Technology Co., LTD
FN-M16P Embedded MP3 Audio Module Datasheet: Flyron Technology Co., LTD
com
Contents
1. Overviews......................................................................................................................2
1.1. Brief Introduction...................................................................................................2
1.2. Product Features...................................................................................................2
1.3. Technical Parameters............................................................................................2
1.4. Naming Rules of Audio Files(Tracks) and Folders..................................................2
2. Pin Configuration and Summary...................................................................................3
3. Serial Communication Protocol....................................................................................4
3.1. Serial Commands Format......................................................................................4
3.2. About Checksum...................................................................................................4
3.3. Serial Commands..................................................................................................5
3.4. Examples of Sending Serial Commands................................................................6
3.5. Returned Data from Module...................................................................................8
3.6. Detailed Annotation of Serial Commands..............................................................10
3.7. Detailed Annotation of Main Query Commands.....................................................15
3.8. Examples of Serial Program.................................................................................16
4. ADkey Control.............................................................................................................18
5. Application Circuits....................................................................................................19
6. Features of GPIO.........................................................................................................21
7. PCB Size......................................................................................................................21
1
Flyron Technology Co., Ltd. www.flyrontech.com
1.Overviews
FN-M 16P is a serial MP3 module that is with a perfect integrated MP3 and WMV decoder chip. It provides micro SD
card driver, and supports FAT16 and FAT32 file system s. It is able to play back specified sound files and realize
other functions through simple serial commands. In the mean time, this module supports AD key control mode that
facilitates users to develop their jobs in some simple applications. Without the cumbersome underlying operating,
easy to use, stable and reliable are the most important features of this module.
1). Audio files directly stored in the root directory of the storage device(SD card or USB flash drive) need to be
renamed as 0001.mp3/0001.wav, 0002.mp3/0002.wav, 0003.mp3/0003.wav, .......3000.mp3/3000.wav.
Here it works according to physical sequence when you copy the files from computer to SD card or USB flash drive.
2
Flyron Technology Co., Ltd. www.flyrontech.com
For example, when the module receives a command to play the track 0001.mp3, it will play the 1 st track you copied
from computer, probably 0001.mp3 or not (maybe it would play 0007.mp3 if it was the first one you copied from
computer). In order to avoid this problem, when you make the copy, rename the audio files firstly on computer and
put all the renamed files in a one folder, then press “Ctrl+A” on the key board to select all, and press “Ctrl+C” to
copy, and go back to the SD card or the USB flash drive, and press “Ctrl+V” to past all the files into the SD card or
USB flash drive. Or users just directly give up this way and just move the audio files to folders and choose to control
and play them in a folder as below.
2). Ordinary folders must be renamed as 01, 02, 03......99, and the audio files must be renamed as
001.mp3/001.wav, 002.mp3/002.wav, 003.mp3/003.wav, .......255.mp3/255.wav. It is also possible to keep the
original name when you rename a file. For example, the original name is “Yesterday Once More.mp3”, then you can
rename it as “001Yesterday Once More.mp3”.
Note: In addition, there are two special purposed folders “MP3” and “ADVERT” that can be chosen by users
to use or not according to the actual needs. Audio files stored in these two folders need to be renamed as
0001.mp3/0001.wav, 0002.mp3/0002.wav, 0003.mp3/0003.wav, .......3000.mp3/3000.wav.
1 16
VCC BUSY
2 15
RX USB-
3 14
TX USB+
4 13
DAC_R ADKEY2
5 12
DAC_L ADKEY1
6 11
SPK+ I/O2
7 10
GND GND
8 9
SPK- I/O1
3
Flyron Technology Co., Ltd. www.flyrontech.com
increase volume)
Serial port control mode is a common communication in the control field, based on which we conducted an
industrial level of optimization by adding frame checksum, retransmission, error handling, and other measures to
significantly strengthen the stability and reliability of communication. The default baud rate is 9600.
Support s asynchronous serial communication mode, via which accept serial commands sent by upper PC.
Communication Standard: 9600 bps
Data bits: 1
Checkout: none
Flow Control: none
Format: $S Ver. Length CMD Feedback Para_MSB Param_LSB Check_MSB Check_LSB $O
$S Start byte 0x7E
Ver. Version 0xFF by default
Length Number of byte from version info to Check_LSB, typically 0x06 (checksum not counted)
CMD Command Code
Feedback 0x01: Need feedback--send confirmation back to MCU; 0x00: No need feedback
Para_MSB Most significant byte of parameter
Para_LSB Least significant byte of parameter
Check_MSB Most significant byte of checksum
Check_LSB Least significant byte of checksum
$O End byte 0xEF
For example, if we specify playback of SD card, we need to send the command “7E FF 06 09 00 00 02 FF F0 EF”.
The number is 6 bytes, and these 6 bytes are “FF 06 09 00 00 02”. Start byte, end byte and checksum are not
counted.
Regarding to calculating checksum, you can use the following formula to count.
Checksum (2 bytes) = 0xFFFF–(CMD + Feedback + Para_MSB + Para_LSB) + 1
4
Flyron Technology Co., Ltd. www.flyrontech.com
Normally it ’s okay whether users choose to use checksum or not, our module can receive a serial data with or
without checksum, but some of users use a MCU without crystal oscillator, so if in that case we strongly suggest
0x19 Set repeat playback of current track See 3.6.13 for details
0x1A Set DAC See 3.6.14 for details
3.3.2.Query Commands
5
Flyron Technology Co., Ltd. www.flyrontech.com
0x3C N/A(Reserved)
0x3D N/A(Reserved)
0x3E N/A(Reserved)
0x3F Query current online storage device See 3.7.1 for details
0x4F Query number of folders in the current storage device See 3.7.4 for details
Play Next 7E FF 06 01 00 00 00 FE FA EF 7E FF 06 01 00 00 00 EF
Play Previous 7E FF 06 02 00 00 00 FE F9 EF 7E FF 06 02 00 00 00 EF
6
Flyron Technology Co., Ltd. www.flyrontech.com
Reset 7E FF 06 0C 00 00 00 FE EF EF 7E FF 06 0C 00 00 00 EF
Play 7E FF 06 0D 00 00 00 FE EE EF 7E FF 06 0D 00 00 00 EF
Pause 7E FF 06 0E 00 00 00 FE ED EF 7E FF 06 0E 00 00 00 EF
7
Flyron Technology Co., Ltd. www.flyrontech.com
Query current EQ 7E FF 06 44 00 00 00 FE B7 EF 7E FF 06 44 00 00 00 EF
1). After the module is powered on, normally it needs about no more than 500ms to 1500ms(depending on the
actual track quantities in the storage device) initialization time. Once the initialization is done, the module returns a
data to MCU. If it does not return a data after more than the initialization time, it means there is an error for
initialization, and please check the hardware connections.
2). The returned data from module after initialization means the current effective storage device/online equipment.
For example, the module returns 7E FF 06 3F 00 00 03 xx xx EF. 0x3F is the returned command by module, and
0x03 represents USB flash drive and SD card are effective/online at the same time. See the details as below.
SD card online 7E FF 06 3F 00 00 02 xx xx EF
PC online 7E FF 06 3F 00 00 04 xx xx EF
3). MCU can not send commands to control the module until the initialization of the module is done and a data is
returned, otherwise the commands sent by MCU will be ignored and also this will effect initializing of the module.
8
Flyron Technology Co., Ltd. www.flyrontech.com
1). There is a returned data after a track is finished playing. For example, the returned data is 7E FF 06 3C 00 00 01
xx xx EF. 0x3C represents USB flash drive and 0x3D represents SD card. 0x00 and 0x01 represents the 1 st track.
0x01 and 0xF4 represents the 500 th track(0x01F4=500).
2). Because all of the files(tracks) in the storage device are read in physical sequence, the returned data still follow
the physical sequence, which needs to be noted.
1). In order to enhance stability between data communication, the function of a feedback from module is added.
Once there is a feedback to MCU from the module, it means the module has successfully received the command
that MCU sent out. 0x41 is the returned command by module.
2). Users are free to choose this feedback or not. It ’s also fine not to choose this function.
7E FF 06 40 00 00 04 xx xx EF Checksum incorrect
9
Flyron Technology Co., Ltd. www.flyrontech.com
When the module is powered on, it reads SD card first and if SD card is not available it goes to USB flash drive.
SD card is plugged in 7E FF 06 3A 00 00 02 xx xx EF
0x3A represents a device is plugged in while 0x3B represents a device is pull out. 0x01, 0x02, 0x04 represent USB
flash drive, SD card and USB cable connected to PC respectively.
1).For example, select the first song played, and send the command 7E FF 06 03 00 00 01 FF E7 EF
7E --- Start byte
FF --- Version Information
06 --- Data length (checksum not included)
03 --- Actual command(specify playback of a track)
00 --- 0x01: need feedback, 0x00: no need feedback
00 --- Most significant byte of the track(MSB of Parameter)
01 --- Least significant byte of the track(LSB of Parameter)
FF --- Most significant byte of checksum(MSB of checksum)
E7 --- Least significant byte of checksum (LSB of checksum)
EF --- End byte
2).Regarding track selection, if choose the 100 th song(track), firstly convert 100 to hexadecimal. It is double-byte by
default , i.e. 0x0064. MSB=0x00; LSB=0x64
3).If you choose to play the 1000 th song(track), firstly convert 1000 to hexadecimal . It is double-byte, i.e. 0x03E8.
MSB=0x03; LSB=0xE8
4).And so on in the same way to the other operations, as in the embedded area hexadecimal is the most convenient
operation method.
10
Flyron Technology Co., Ltd. www.flyrontech.com
3.6.2.Specify volume
1).Our system power-on default volume is level 30, if you want to set the volume, then directly send the
corresponding commands.
2).For example, if specify the volume to level 15, send the command 7E FF 06 06 00 00 0F FF D5 EF.
3).MSB=0x00; LSB=0x0F, 15 is converted to hexadecimal 0x000F.
1).We added this control command 0x08, to meet the needs that some users need single repeat playback.
2).During single repeat playback, you can still normally execute the operations Play/Pause, Previous, Next,
Volume+/-, EQ and so on. You can specify single track playback or make it sleep to turn off single repeat playback
status.
1).The module supports two types of playback devices(USB flash drive and SD card). The device must be on-line,
so it can be specif ied playback. It automatically detect s if a device is on-line or not. No need users’ attention.
2).It automatically enters into the standby status after specif ying a device, waiting MCU to specify a track to play. It
takes about 200ms from specifying device to the module finishes initialization of file system. Please wait for 200ms
and then send the specified command to play a track.
1).The default folders are named as "01", "11", “99” in this way. In order to be with a better system stability, it is
made to support maximum 99 folders and maximum 255 tracks in each folder..
2).For example, if specify to play “100.mp3” in the folder "01", send the command 7E FF 06 0F 00 01 64 xx xx EF
MSB: represents the name of the folder, maximum supports 99 folders from 01 - 99.
LSB: represents the track, maximum supports 255 tracks from 0x01 to 0xFF.
3).You must specify both the folder and the file name to target a track. This feature supports MP3 and WAV audio
formats.
4).The following two images illustrates the naming method of folders and files.
11
Flyron Technology Co., Ltd. www.flyrontech.com
1).We added such a control command 0x11, to meet the needs that some users need repeated playback of all
tracks in the root directory of a storage device.
2).During all repeat playback, you can still normally execute the operations Play/Pause, Previous, Next, Volume+/-,
EQ and so on.
3).After starting all repeat playback, the module will play all the tracks in the device ceaselessly again and over
again until it receives a command for stop or pause.
1).We extended such single folder function on the basis of specifying playback of folders. The folder must be
named “MP3”.
2).This special folder supports max. 65536 songs(tracks), but the operation speed will get slow along with the folder
become large, so we suggest users put no more than 3000 songs(tracks) in this folder. Audio files need to be
renamed as 0001.mp3/0001.wav, 0002.mp3/0002.wav, 0003.mp3/0003.wav, .......3000.mp3/3000.wav in this folder
as shown below.
12
Flyron Technology Co., Ltd. www.flyrontech.com
1).This module supports inter-cut advertisements during playback of a track, so that it can meet some special
needs for some applications.
2).After sending the command 0x13, the system will save the IDV3 information of the track being played and pause,
then it will play the specified inter-cut track(advertisement). When the inter-cut track is finished, the system will go
back and continue to play the track that was interrupted until to the end.
3).The setting method is to build a folder named “ADVERT” in the storage device, and put the tracks(ads) you need
in the folder, and rename the files as “0001.mp3/wav”, 0002.mp3/wav.
4).If you send an inter-cut command when the module is at Pause status or Stop status, it will not work and there
will be an returned error information. In the course of an inter-cut, you can continue to inter cut the other
tracks(ads). When the last inter-cut track goes to the end, the system still goes back to the IDV3 position saved at
the first time.
5).Audio files stored in this special folder need to be renamed as 0001.mp3/0001.wav, 0002.mp3/0002.wav,
0003.mp3/0003.wav, .......3000.mp3/3000.wav as shown below.
In order to meet some users’ needs that each folder is able to manage more tracks, we specially added this
command for users to use. It supports max. 15 folders only(from folder 01 to folder 15), and each folder can store
3000 tracks.
1).The command byte is 0x14.
13
Flyron Technology Co., Ltd. www.flyrontech.com
2).For example, if we specify playback of track “1999” in the folder “12”, we need to send the serial
command
7E FF 06 14 00 C7 CF FD 51 EF.
0xC7 and 0xCF are parameter, and the combined data is 0xC7CF, and totally 16 bytes.
The high 4 bytes represent the folder name; C here means the folder “12”.
The low 12 bytes represent the file name; 7CF here means the file “1999”.
3).Audio files stored in these folders need to be renamed as 0001.mp3/0001.wav, 0002.mp3/0002.wav,
0003.mp3/0003.wav, .......3000.mp3/3000.wav as shown below.
3.6.10. Stop
1).During playback of the module, there is two modes to stop. One is to stop playing the inter-cut advertisement,
and go back and continue to play the music interrupted, and the other mode is to stop all playback(stop decoding).
2).For example, suppose the module is playing an inter-cut advertisement, and now if send a stop command 0x16,
it will stop all playback tasks.
1).This command is used to randomly play sound files in the storage device according to physical sequence and no
matter if there is a folder or not in the device. The first sound file that is conducted to be played is the first one in the
device.
14
Flyron Technology Co., Ltd. www.flyrontech.com
1).During playback, send the turn-on command, and it will repeatedly play the current track. If the module is at
Pause or Stop stat us, it will not respond to this command.
2).If you need to turn off repeat playback, just send the turn-off command.
Turn on DAC 7E FF 06 1A 00 00 00 FE E1 EF
When the module is powered on, DAC is turned on by default. It is not turned off until it is set up by sending the
command.
When the module is working, users can use the command as above (0x3F) to query the status of the online storage
devices. For example, if the module returns the data 7E FF 06 3F 00 00 0A xx xx EF, LSB 0x0A(0000 1010)
represents SD card online. If LSB is 0x1F(0000 1111), it represents all of USB flash drive, SD card, and PC
online(PC online means module is connecting with PC via a USB cable).
1)There are 4 status(playing, paused playing, stopped playing, and in sleep) that can be queried during the module
is decoding. Users can query the current status via sending the command as above(0x42).
7E FF 06 42 00 10 00 xx xx EF Module in sleep
15
Flyron Technology Co., Ltd. www.flyrontech.com
If the folder queried is empty without any files, the module will report an error, and the data 7E FF 06 40 00 00 06
FE B5 EF will be returned.
Users can query the total folder numbers of the current storage device through sending the command above.This
just supports to query the folder numbers in the root directory of the device. Not possible to query the sub-folder
numbers(Please don’t build any sub-folders in a folder).
/******************************************************************************
- 实现功 能:实现芯 片上电分别 指定播放 第一曲和第 二曲,基本 的程序供用 户测试
- 运行环 境:STC 晶振: 11.0592M 波特率:9600
- 备注 :在普 中科技的 51 开发板 上调试 OK --- STC89C516RD+
1、该测 试程序必须 是模块或者 芯片方案 中有设备在 线,譬如 U 盘、TF 卡
******************************************************************************/
#include "REG52.h"
void Delay_Ms(INT32U z)
{
INT32U x=0 , y=0;
for(x=110 ; x>0 ;x--)
for(y=z; y>0;y-- );
}
/******************************************************************************
- 功能描 述: 串口 1 初始化
- 注: 设置为 9600 波特率
16
Flyron Technology Co., Ltd. www.flyrontech.com
******************************************************************************/
void Serial_init(void)
{
TMOD = 0x20; // 设置 T1 为波特 率发生器
SCON = 0x50; // 0101,0000 8 位数据 位, 无奇偶 校验
PCON = 0x00; //PCON=0;
TH1=256-(OSC_FREQ/COMM_BAUD_RATE/32/12);//设置为 9600 波特率
TL1=256-(OSC_FREQ/COMM_BAUD_RATE/32/12);
TR1 = 1; //定时器 1 打开
REN = 1; //串口 1 接收使 能
ES = 1; //串口 1 中断使 能
}
void Uart_PutByte(INT8U ch)
{
SBUF = ch;
while(!TI){;}
TI = 0;
}
/******************************************************************************
- 功能描 述: 串口向 外发送命令 [包括控 制和查询]
- 参数说 明: CMD:表示控 制指令,请 查阅指令表 ,还包括 查询的相关 指令
feedback:是否需 要应答 [0:不需要 应答,1:需要应 答]
data:传送的 参数
******************************************************************************/
void SendCmd(INT8U len)
{
INT8U i = 0 ;
Uart_PutByte(0x7E); //起始
for(i=0; i<len; i++)//数据
{
Uart_PutByte(Send_buf[i]) ;
}
Uart_PutByte(0xEF) ;// 结束
}
/******************************************************************************
- 功能描 述:求和校 验
- 和校验 的思路如下 :
发送 的指 令,去 掉起始 和结 束。将 中间 的 6 个字 节进 行累加 ,最后 取反 码。接 收端 就将接 收到的 一帧 数据, 去掉 起始和 结束。
将中间 的数据累加 ,再加上接 收到的校 验字节。刚 好为 0.这样就 代表接收到 的数据完全 正确。
******************************************************************************/
void DoSum( INT8U *Str, INT8U len)
{
INT16U xorsum = 0;
INT8U i;
for(i=0; i<len; i++)
{
xorsum = xorsum + Str[i];
}
xorsum = 0 -xorsum;
*(Str+i) = (INT8U)(xorsum >>8);
*(Str+i+1) = (INT8U)(xorsum & 0x00ff);
}
17
Flyron Technology Co., Ltd. www.flyrontech.com
{
Send_buf[0] = 0xff; //保留字 节
Send_buf[1] = 0x06; //长度
Send_buf[2] = CMD; //控制指 令
Send_buf[3] = feedback;//是否需 要反馈
Send_buf[4] = (INT8U)(dat >> 8);//datah
Send_buf[5] = (INT8U)(dat); //datal
DoSum(&Send_buf[0],6); //校验
SendCmd(8); //发送此 帧数据
}
void main()
{
Serial_init() ;//串口寄 存器的初始 化设置
Uart_SendCMD(0x03 , 0 , 0x01) ;//播放第 一首
Delay_Ms(1000) ;//延时大 概 6S
Uart_SendCMD(0x03 , 0 , 0x02) ;//播放第 二首
Delay_Ms(1000) ;//延时大 概 6S
Uart_SendCMD(0x03 , 0 , 0x04) ;//播放第 四首
while(1) ;
}
4. ADkey Control
K4 Play/Pause
K5 Previous Vol+
K6 Next Vol-
K7 4 Repeat play back track 4 Long push always to repeat play back
18
Flyron Technology Co., Ltd. www.flyrontech.com
K8 3 Repeat play back track 3 Long push always to repeat play back
K9 2 Repeat play back track 2 Long push always to repeat play back
K10 1 Repeat play back track 1 Long push always to repeat play back
K11 5 Repeat play back track 5 Long push always to repeat play back
K12 6 Repeat play back track 6 Long push always to repeat play back
K13 7 Repeat play back track 7 Long push always to repeat play back
K14 8 Repeat play back track 8 Long push always to repeat play back
K15 9 Repeat play back track 9 Long push always to repeat play back
K16 10 Repeat playback track 10 Long push always to repeat play back
K17 11 Repeat playback track 11 Long push always to repeat play back
K18 12 Repeat playback track 12 Long push always to repeat play back
K19 13 Repeat playback track 13 Long push always to repeat play back
K20 14 Repeat playback track 14 Long push always to repeat play back
5. Application Circuits
19
Flyron Technology Co., Ltd. www.flyrontech.com
20
Flyron Technology Co., Ltd. www.flyrontech.com
6. Features of GPIO
21
Flyron Technology Co., Ltd. www.flyrontech.com
22