AT83SND2CMP3 ..............................................................................................
-2 7525A–MP3–07/05 AT83SND2CMP3 User Guide
Table of Contents Section 1 Introduction ........................................................................................... 1-1 Section 2 Functional Description .......................................................................... 1-3 2.1 2.2 Features....................................................................................................1-4 Description of the Environment .................................................................1-5 Section 3 Communication Protocol........
-2 7525A–MP3–07/05 AT89RFD-08 User Guide
Section 1 Introduction The AT83SND2CMP3 easily adds MP3 music playing feature to mobile phone or any type of application. This product has fully integrated stand-alone: Hardwired MPEG I/II-Layer 3 decoder MP3-player control Stereo Audio DAC Mono Audio Power Amplifier for speaker control This document describes the MP3 Player, the Machine-Machine Interface and how to communicate with UART link to remote control the MP3 player.
Introduction 1-2 7525A–MP3–07/05 AT83SND2CMP3 User Guide
Section 2 Functional Description The AT83SND2CMP3 is designed to be used as a slave device driven by an host controller via a UART connection.
Functional Description 2.1 Features The AT83SND2CMP3 module provides: MP3 music playing capability – from Nand Flash (512Byte page size) – from MMC or SD card, Embedded FAT 12/16/32. The AT83SND2CMP3 can be remote controlled from an external Controller using standard commands such as: – Play, stop, pause, next, previous, – Select memory, – File System Navigation, System configuration (digital and analog sound settings, audio input and output selection,).
Functional Description 2.2 Description of the Environment List of system Interfaces: Figure 2-1.
Functional Description 2.2.1 USB AT83SND2CMP3 USB interface complies to the USB 2.0 Full Speed specifications. The USB bus is used to download music using bulk transfer. The system supports Mass Storage on the following platforms: Win98 with Atmel driver, Win2000/ME/XP. These platforms do not provide multi-drive (multiple USB Logical Unit) support, except Win2000 Service Pack 3 that allows multi-drive support. 2.2.
Functional Description AT83SND2CMP3 User Guide 2-7 7525A–MP3–07/05
Section 3 Communication Protocol The AT83SND2CMP3 is remotely controlled using simple ‘user interface like’ commands such as Play or Stop commands. The communication protocol provides an abstraction of the physical layer between the Remote Controller and the Player. 3.1 Communication Protocol The communication protocol is a half-duplex protocol between a host Remote Controller and the AT83SND2CMP3 (Player) over a UART. Note: 3.
Communication Protocol • Checksum (1 byte): Frame checksum: 8 least significant bit of the sum of: Channel + Protocol Command + Data Length + Data. In the following discussion, the Channel parameter is set to FFh. 3.3 Remote Controller - AT83SND2CMP3 Command Set List There are several command types: System Command: these commands allow to configure the system. Player Command: these commands allow to access all the Player’s functions.
Communication Protocol Protocol Command Command Data Description SYSTEM_PLAYER_MODE 0Dh 1 Byte Set Player mode on selected memory: • Repeat / No Repeat • Play Single • Play Dir • Play Disk • Explorer Mode (see all file type for file transfer) SYSTEM_AUDIO_INPUT 0Eh 1 Byte Enable Player Audio Input • None - disable selected input • Mono Input • Stereo Input SYSTEM_ENTER_HID_MODE 0Fh No Ask the Player to enter the HID mode: bridge USB - UART. Table 3-2 .
Communication Protocol Protocol Command Command Data Description FS_FCREATE 66h Yes Create a file on selected memory FS_FREAD_BLOCK 67h Yes Read data block to current created file FS_FWRITE_BLOCK 68h No Write data block from selected file FS_FWRITE_LAST_BLOCK 6Dh No Write last data block from selected file FS_FCLOSE 69h No Read or write close current file transfer FS_GETMEMFREESPACE 6Ah No Get memory free space available FS_GETFILESIZE 6Bh No Get current file size FS_GETFILE
Communication Protocol Protocol Command Command Data Description FS_FILEPOS * 8Ch Yes Send current file position. FS_END_OF_LIST * 8Dh Yes Player has reached the end of the list after PLAYER_GET_LIST command. SYSTEM_MOUNTED* 8Fh No Player has finished file system FAT instal on selected memory. CUSTOM_PLAYER_TOTALTIME * E0h Yes MP3 total time length. CUSTOM_PLAYER_END_OF_FILE * E1h Yes Player has reached the end of file. Notes: 3-12 7525A–MP3–07/05 1.
Communication Protocol 3.4 Player’s Operating Modes All the commands sent by the Remote Controller can change the Player’s current operating mode. Figure 3-2. Player’s Operating Modes Power on Reset BOOT Status Not Playing FileNameAvailable MemoryError Initialization SYSTEM_SELECT _MEMORY IDLE Status USB Connection USB Transfer SYSTEM_ USB_CONNECT SYSTEM_USB _DISCONNECT MASS STORAGE INIT Status => Memory Error or FileNameAvailable means that INIT is finished.
Communication Protocol 3.5 Error Management 3.5.1 Command Time-out When a communication handling error occurs (for example data length does not correspond to the actual frame size), the AT83SND2CMP3 reception state machine is resetted after TimeResumeCommand ms. If the Remote Controller does not receive any status from Player, it shall wait TimeResumeCommand ms before sending the GET_STATUS frame. Table 3-6 . Real Time Constraints Value Items Value Description TimeEffectiveCommand 400 ms max.
Communication Protocol Figure 3-3.
Communication Protocol 3.7 Player Management 3.7.1 Player Reset After a Player warm or cold reset, Remote Controller shall wait on its RX line the SYSTEM_ACK frame. This means that the AT83SND2CMP3 is ready to communicate. Figure 3-4 . Warm Reset C o n tro lle r_ R x C o n tro lle r_ T x S YST E M _AC K S YST E M _R E S E T G ET _ST A T U S A T 8XC 51S N D 2 R es et an d in it Table 3-7 . Hardware Reset Controller_Rx SYSTEM _ACK Controller_Tx AT83SND2CMP3 Hardware Reset Note: 3.7.
Communication Protocol The SYSTEM_ACK_STATUS frame response is the acknowledge for the received frame and the corresponding command processed. Note: Refer to Table 5-1 . Player STATUS Description Example 1 Table 3-8 .
Communication Protocol Example 2 Figure 3-5 .
Communication Protocol 3.8 File Transfer The File Transfer mode is used to transfer file from/to Remote Controller to/from Player Memory. START Power on Reset Hardware Reset BOOT FS_FWRITE_BLOCK FS_FWRITE_LAST_BLOCK FS_FREAD_BLOCK Initialization FS_FCREATE FILE TRANSFER IDLE ... 3.8.
Communication Protocol Example 1 Figure 3-6 . Transfer a File From Remote Controller to Player Selected Memory T r a n s fe r in g A F ile F r o m R e m o te C o n tr o lle r to P la ye r C o n tr o lle r P la ye r F S _ F C R E A T E (N a m e o f F ile , N u m b e r o f b lo c k to tra n s fe r ) US SYSTEM _AC K + STAT F S _ F W R IT E _ B L O C K + d a ta P la y e r p ro g ra m m s n o w th e m e m o ry a n d p re p a re N o w w a itin g fo r d a ta .
Communication Protocol Example 2 Figure 3-7 . Example: Transfer a File From Player to Remote Controller T r a n s fe r in g A F ile F r o m P la ye r to R e m o te C o n tr o lle r C o n tr o lle r P la ye r FS_G ETNAM E F S _ N A M E (F ile N a m e ) FS_FREAD_B FS_FREAD_BLO C K _ D A T A (B lo c k ) FS_FREAD_B FS _FR E A D _B L LO C K LO C K (N o D a ta ) O CK_DATA_END P la y e r re a d a n d s e n d th e firs t b lo c k o f d a ta . E n d o f file re a c h e d . F ile is c lo s e d .
Communication Protocol 3-22 7525A–MP3–07/05 AT83SND2CMP3 User Guide
Section 4 Design 4.1 Configuration 4.1.1 Connections Refer to AT83SND2CMP3 schematics. Table 4-1 . Remote Controller - AT83SND2CMP3 Interface AT83SND2MP3 VDD Power Amplifier Supply Wake-up Signal AUDVBAT INTO / P3.2 RXD UART TXD SND2 IRQ Note: 4.1.2 USB IDs IRQ P4_3 SND2 IRQ and INTO shall stay not connected if they are not used.
Design status report in host system: USB_MANUFACTURER_NAME: unicode character string (default “ATMEL”) USB_PRODUCT_NAME: unicode characters string( “MP3 STORAGE”) USB_SERIAL_NUMBER: unicode characters string (“4710765066451”) SBC_VENDOR_ID: 8 ASCII characters string (default “03EBh”, ATMEL VID) SBC_PRODUCT_ID:16 ASCII characters string (default “2010h”, ATMEL PID) SBC_REVISION_ID: 4 ASCII characters string (“1.
Design 4.2 Mass Storage Driver The ZIP file “usb_ms_drv” contains the Windows 98™ driver for the USB mass storage application. The readme files gives advice on how to install drivers on windows 98™ platform and how to mount the removable disk on Linux™ platform. Figure 4-1 . usb_ms_drv Directory Organization usb_ms_drv \ atusbms.zip \ readme.txt \ readme_linux.pdf 4.2.1 Windows Drivers No specific mass storage driver installation is requested when using Windows 2000™, Windows ME™, and Windows XP™.
Section 5 Protocol Frame Description Note: 5.1 (*) means the frame is a Player response. Player’s Status Description STATUS byte is the reflect in real-time of AT83SND2CMP3‘s system status. This status is a parameter of almost all Player frame. Table 5-1 . Player STATUS Description 7 6 5 4 3 2 1 0 OPM ERROR MERROR MNF USB_CON USB_TRANS - FNA Bit Number Bit Mnemonic OPM Operating Mode This is bit is set when playing music.
Protocol Frame Description Bit Number Bit Mnemonic Description USB_TRANS USB Transfer This bit is set when an USB data transfer is being processed. This bit is cleared when there is no USB transfer. 2 1 Reserved FNA 0 Reserved. File name available. This bit is set when new file name is available. This bit is cleared when Remote Controller has read the new file name. This bit is set when new FAT is installed on memory after a SYSTEM_SELECT_MEMORY command.
Protocol Frame Description 5.2 System Command SYSTEM_RESET Command Reset the AT83SND2CMP3. There is no answer for this command. After a Player warm or cold reset, Remote Controller shall wait on its RX line the followings response SYSTEM_ACK frame. This means that the AT83SND2CMP3 is ready to communicate. Table 5-2 .
Protocol Frame Description AT83SND2CMP3 frame response is SYSTEM_ACK frame. Table 5-4 . SYSTEM_GET_STATUS Frame Format Frame Start Channel Not used, 7Eh FFh Protocol Command Data Length Data CheckSum 02h 00h No Yes SYSTEM_AUDIO_OUTPUT Select Player Audio Output: Command Headset Power Amplifier The default configuration is Headset and Power Amplifier activated after reset. Table 5-5 .
Protocol Frame Description Table 5-7 . SYSTEM_GET_STATUS Frame Format Frame Start Channel Protocol Command Not used, 7Eh 04h FFh Data Length 01h Data Select Memory and install file system on: • On-Board Player Memory (Nand Flash) • Card (SD/ MMC card) CheckSu m Yes Table 5-8 . Data Parameter for Select Memory Command.
Protocol Frame Description Table 5-9 . System Set Sound Data Command Byte Number Note: Byte Mnemonic Description 0 MP3VOL MP3 Volume Left Channel 1 MP3VOR MP3 Volume Right Channel 2 MP3BASS MP3 Bass equalization 3 MP3MED MP3 Medium equalization 4 MP3TRE MP3 Treble equalization All value set to FFh will not be updated in Player. Example: MP3VOL set to FFh means tMP3VOL will keep its last value.
Protocol Frame Description Table 5-11 . SYSTEM_WAKEUP command Controller_Rx SYSTEM _ACK Controller_Tx (connected to INT0) 1ms SYSTEM _POWERDOWN AT8XC51SND2 Power Down Mode Initialization SYSTEM_USB_DETACH Request the Player to perform a USB detach. Command Warning: during USB data transfer, performing a USB detach can corrupted the current data transfered on the memory.
Protocol Frame Description Table 5-14 . SYSTEM_VOLUME_UP command format Frame Start Channel Not used, 7Eh FFh Protocol Command Data Length Data 0Bh 00h No CheckSum Yes SYSTEM_VOLUME_DOWN Master gain volume down (one step). Player response is PLAYER_VOLUME* frame. Table 5-15 .
Protocol Frame Description Table 5-17 . Play Mode (MOD 1:0) Player Mode (PLAYER_MODE) MOD1 MOD0 Play Single File 0 0 Play Dir 0 1 Play Disk 1 0 Table 5-18 . Player File Type (FILETYP 4:2) Player File Type (FILETYPE) FILETYP2 FILETYP1 FILETYP0 Mp3 Files only.** 0 0 0 All files extensions are visible. (Explorer mode for file transfer) 1 0 0 Table 5-19 .
Protocol Frame Description SYSTEM_ENTER_HID_MODE Ask the Player to enter the HID mode (only available with UART link). The Player shall be in IDLE state to enter HID mode (no Mass Storage, no Playing). When connected in this way, the Player acts only as USB-UART bridge. This mode allow the Remote Controller to send and receive any binary/protocol information from/to UART. To exit from this mode, Remote Controller have to perform an hardware Player Reset or unplug the USB cable. Table 5-22 .
Protocol Frame Description 5.3 Player Command These commands allow to access all the player’s function. PLAYER_PLAY Command If current file name is a MP3 file, play selected MP3 file from Selected Memory. If current file name is a directory, enter this directory and select the first MP3. A new Play command is needed to play this new MP3 file. Table 5-23 .
Protocol Frame Description PLAYER_PREVIOUS Select Previous MP3 file on Selected Memory. Command Table 5-27 . PLAYER_PREVIOUS command Frame Start 7Eh Channel If not used, FFh Protocol Command Data Length Data CheckSum 54h 00h No Yes PLAYER_SETMARKERA Set A marker for repeat AB feature. Command Table 5-28 . PLAYER_SETMARKERA Command Frame Start 7Eh Channel If not used, FFh Protocol Command Data Length Data CheckSum 55h 00h No Yes PLAYER_SETMARKERB Set B marker for repeat AB feature.
Protocol Frame Description Player response is PLAYER_TIME* frame. PLAYER_GETINDEXNUMBER Get numbers of files in current directory or root directory. Command Table 5-32 . PLAYER_GETINDEXNUMBER Command Frame Start 7Eh Channel Protocol Command Data Length Data CheckSum 59h 00h No Yes If not used, FFh Player response is PLAYER_INDEXNUMBER* frame. PLAYER_ENTER_ROOT_DIR Select first available MP3 files in the root directory.
Protocol Frame Description – Remote Controller sends PLAYER_FILE_GET_LIST command – Player sends 3 FS_NAME* frame because there is 3 files in current directory. – When all the files names are send, Player sends FS_END_OF_LIST* frame. The sequence can be aborted by any other command send to the Player (for example SYSTEM_GET_STATUS command).
Protocol Frame Description 5.4 File System Commands These commands allow to navigate in selected memory: file and directory architecture. FS_NEXT Command Select next file from selected memory. Table 5-37 . FS_NEXT command Frame Start 7Eh Channel If not used, FFh Protocol Command Data Length Data CheckSum 60h 00h No Yes Protocol Command Data Length Data CheckSum 61h 00h No Yes FS_PREVIOUS Command Select previous file from selected memory. Table 5-38 .
Protocol Frame Description Table 5-41 . FS_GET_NAME command Frame Start 7Eh Note: Channel Protocol Command Data Length Data CheckSum 64h 00h No Yes If not used, FFh When selected root or directory is empty, the returned file name is ‘\0’. FS_FORMAT Command Fo rm at Selected Memory in FAT16. Player reponse is SYSTEM_ACK* o r SYSTEM_NACK* frame. It is necessary to send the SYSTEM_ SELECT_MEMORY once (to select the memory) before sending the FS_FORMAT command.
Protocol Frame Description FS_FWRITE_BLOCK Write data in current created file (need previous FS_FCREATE command). The number Command of FS_WRITE_BLOCK command the Remote Controller shall send to Player is defined by Number of Blocks Parameter (refer to FS_FCREATE command). Table 5-44 . FS_FWRITE_BLOCK command Frame Start 7Eh Channel If not used, FFh Protocol Command Data Length Data CheckSum Data BLock 68h 00h - Yes Byte 0:1FFh => 512 Bytes data (no checksum on data) Data are 512 Bytes.
Protocol Frame Description Player response to FS_FREAD_BLOCK command is FS_READ_BLOCK_DATA*. Once end of file is reached, Player response to FS_READ_BLOCK command is FS_READ_BLOCK_DATA_END*. Remote Controller can stop reading file at any moment by sending the FS_FCLOSE command. Note: (*) means that the frame is a player response. FS_FCLOSE Command Close current file (close read or close write file). This command is used to stop any read or write file transfer.
Protocol Frame Description Player response is FS_FILEPOS frame. FS_FDELETE Delete the current selected file. Table 5-51 . FS_FDELETE command Frame Start 7Eh Channel If not used, FFh Protocol Command Data Length 6Dh 00h Data No CheckSum Yes Player response is SYSTEM_ACK or SYSTEM_NACK frame.
Protocol Frame Description 5.5 Custom Command AUDIO_SET_GAIN Set Audio Gain: Line out (default value: 02h, -3 dB). Power Amplifier (default value: 07h, +2 dB). Line in (default value: 08h, -9 dB). Auxiliary in (default value: 07h, -6 dB). Dac Master Gain (default value: 0Ch, -6 dB). Refer to AT83SND2CMP3 datasheet (chapter DAC and PA Interface) for audio gain description and register value. Table 5-52 .
Protocol Frame Description Table 5-53 . AUDIO_SET_GAIN parameter Gain Selector Gain Value Corresponding Register in datasheet 00000000b => 0 dB Line Out Gain 00h ... 00000010b => -3 dB LLOG, RLOG ... 00100000b => mute 00000000b => -22 dB 00000001b => + 20 dB ... Power Amplifier Gain 00001000b => -1 dB 01h 00001011b => -10 dB APAGAIN ... 00001111b => -22 dB 00000000b => +20 dB ... Line In Gain 02h 00000101b => 0 dB ... RLIG, LLIG 00001100b => -3 dB ... 00010001b => mute 00000000b => +20 dB .
Protocol Frame Description AUDIO_PA_LP Set Player power amplifier (PA) Low power mode (for speaker) - Only in PLAY mode. This command is used to set in a very short time the PA in a low power mode (only in play mode). A Play/Stop transition will reset the PA low power mode. Table 5-54 .
Protocol Frame Description Table 5-57 . CUSTOM_GET_SYS_VERSION command Frame Start Channel If not used, 7Eh FFh Protocol Command Data Length 94h 00h Data CheckSum No Yes Player response is CUSTOM_SYS_VERSION* frame. CUSTOM_SYSTEM_SLEEP Ask the Player to enter in power down mode (keep audio capacitors charged). Command Note: To avoid any extra-power consumption in power down mode because of keeping audio capacitors charged, refer to SYSTEM_POWER_DOWN command. Table 5-58 .
Protocol Frame Description Table 5-61 . CUSTOM_PLAYER_LAST Command Frame Start 7Eh Channel If not used, FFh Protocol Command Data Length Data CheckSum F4h 00h No Yes Player response is SYSTEM_ACK or SYSTEM_NACK. CUSTOM_PLAYER_FIRST Go to first file of current directory . Command Table 5-62 . PLAYER_FIRST Command Frame Start 7Eh Channel If not used, FFh Protocol Command Data Length Data CheckSum F3h 00h No Yes Player response is SYSTEM_ACK or SYSTEM_NACK. 5.
Protocol Frame Description 5-50 AT83SND2CMP3 User Guide
Protocol Frame Description Table 5-68 . FS_FREAD_BLOCK_DATA Frame Frame Start 7Eh Channel Protocol Command Data Length 84h 01h If not used, FFh Data CheckSum Data Block Yes Byte 0:1FFh => 512 Bytes data (no checksum on data) DataBlockNumber 01h FS_FREAD_BLOCK_DATA_EN Player Response of FS_READ_BLOCK command when last block is reached (end of D* Response file). After this Player reponse, there is no need to send the FS_FCLOSE command. Player returns in operating mode IDLE. Table 5-69 .
Protocol Frame Description Table 5-72 . FS_FILESIZE Frame Frame Start Protocol Command Channel Data Length Data CheckSum Byte 0: Player Status Byte Byte 1: MSB3 File size If not used, 7Eh 8Bh FFh 05h Byte 2: MSB2 File size Byte 3: MSB1 File size Yes Byte 4: MSB0 File size Note: File size is 4 bytes (MSB is byte 0). Directory size is 0. FS_FILEPOS* Response Player current file position (only in Player PLAY operating mode).
Protocol Frame Description Because that the memory selection can happens even without the SYSTEM_SELECT_MEMORY command, it is possible that the AT83SND2CMP3 will send the SYSTEM_MOUNTED frame in the following case: USB attach (reselect default memory before USB enumeration). USB detach (reselect default memory and install FAT on it). Table 5-75 .
Protocol Frame Description Table 5-78 . CUSTOM_PLAYER_END_OF_FILE Frame Frame Start Channel Protocol Command Data Length Data CheckSum Byte 0: Player Status Byte 1: ‘V’ (56h) 7Eh If not used, FFh Byte 2: ‘2’(31h) E3h 06h Byte 3: ‘.’(2Eh) Yes Byte 4: ‘0’(36h) Byte 5: ‘.
Section 6 Technical Support For Technical support, please contact mcu@atmel.com.
= & $ 2 -18(D/46)(-12 69 & -18(D/46)(-12 69 & -18(D/46)(-12 69 = & 2@ &2)-2?&A & = & 2 $ 2 & & & -18(D/46)(-12 69 & 2 E2 &2)-2?& -18(D/46)(-12 69 # & # -18(D/46)(-12 69 0 0 /2 /2 & 0 $ 2 $ 2 1 & & & & & ! ( ' * ) " , . ! #$ % ) & ' ( / ( ) * + , " #$ % & ' * -, ) . * ',/ ()*+ -B+42:/CC*; (,+ 6)+! -./0+1)2 /03+4 # 2 2 +8+4+1.
34 4 51 34 4 & % ! " $ ! " #! " 0 / $ & ! " # & & 1 1 & & & C E 2 , ! " C 1 2 ()*+ *-.F2G2 +:+) (,+ 6)+! -./0+1)2 /03+4 # 2 2 +8+4+1.
& ? F & F ! " I I = # & ! " & & & & & & 1 & # ? & 66 7 5 % & = 2 649B64+2.-19()(-1 I # I # F ! " = 0(1(2 2 & & & & H H ! " 2 ! " = 3 " #$ % & ' ( ) * + , * -, ()*+ )6196492 1)+486.+: (,+ 6)+! -./0+1)2 /03+4 # 2 2 +8+4+1.
51 1 = /2 # = /2 2 1 2= #! " & 1 2 2= 8 & 2 2= #! " = 6 # 1 = 1 1 2 2= & & / & & = # 1 #! " 1 & 2 9 2= & #! " . / ()*+ /9(-2 1)+486.+: (,+ 6)+! -./0+1)2 /03+4 # 2 2 +8+4+1.
! " & & & & ! " & & ? # # ? & ? ! " > > >$ >$ E> $ ! " ! " & : * * < ' + ' ( 3; 3 ; 4 4 ; & : ( ; ! .=<2 ( / #$ % & ' . ' * 3 @7 @ ' < 4; ( ) 5> +? ) / ( ;;;;;;; ; * +" '< 6 A: 3 ) " '++% #* & '6 * ( ) #D3: A+# ;;;; 5 ;;;; ; : ) ; A 4 ; A 3 ; A 3 3B ; A 4& ; 3 8 ;;;; " ( ! B ()*+ ! C 619 *6:7 3 (,+ 6)+! -./0+1)2 /03+4 # 2 2 +8+4+1.
Atmel Corporation 2325 Orchard Parkway San Jose, CA 95131 Tel: 1(408) 441-0311 Fax: 1(408) 487-2600 Regional Headquarters Europe Atmel Sarl Route des Arsenaux 41 Case Postale 80 CH-1705 Fribourg Switzerland Tel: (41) 26-426-5555 Fax: (41) 26-426-5500 Asia Room 1219 Chinachem Golden Plaza 77 Mody Road Tsimshatsui East Kowloon Hong Kong Tel: (852) 2721-9778 Fax: (852) 2722-1369 Japan 9F, Tonetsu Shinkawa Bldg.