	*** OLIMEX demo project for the MOD-MP3-X ***

1. Requirements
	- MOD-MP3-X demo board by Olimex
	- Compatible debugger, for example ARM-USB-OCD-H by Olimex, or any Cortex capable JTAG debugger.
	- IAR EW IDE for ARM v6.30.7 or later by IAR systems
	- RS232 port with TTL level shifter (like the MOD-USB-RS232 board by Olimex) and a terminal program (Hyper Terminal, PuTTY, etc.)
	- microSD card - non-HD, up to 2GB for music files storage (and with block size no bigger than 64KB)
	- USB B cable connected to a PC
	
2. Description

	Note that the main workspace file (MP3_Player.eww) is located in MP3_player folder.
	
	The demo implements an MP3 player controlled via UART commands. Commands include directory listing, playing specific file and playback control. MP3 files to be played are stored on the SD card. Mass storage functionality is also included in the project for easy manipulation of the files on the SD card.
	
	Upon power-on the program checks for connected USB cable and if one is detected mass storage function is started. When in this mode user can use the board as a general purpose card reader and format, read and write files on the card.
	*Note: In most cases no drivers on the host PC should be needed to use the mass storage device.
	
	When USB cable is disconnected the programs starts MP3 player function. In order to perform proper initialization an SD card should be present, FAT formatted and preloaded with the MP3 files to play. This demo currently supports only MP3 playback although the codec supports other formats. Status messages are displayed in the terminal during initialization and any problems are described as correctly as possible. When initialization is complete you can enter any of the following commands:
	- "L" - lists the current directory and return its contents, directories are marked with a <DIR> tag
	- "CDIRNAME <name>" - switch the current directory to <name>, name should be up to 8 characters long
	- "cnum <index>" - switch the current directry to the one with given <index>, as displayed with the "L" command
	- "." - returns to the parent directory, no higher than the root directory
	- "PSONGNAME <name>" - plays file in the current directory by its <name>, <name> should be in 8+3 format and the only extension supported is ".MP3"
	- "pnum <num>" - plays file in the current directory by its <index>, starting from 0. <index> may be calculated by the sequence number displayed with the "L" command minus the number of directories in the current directory.
	- "OFF" - turns the codec chip OFF, may be executed at any time
	- "ON" - turns the codec chip ON, may be executed at any time
	
	These commands have meaning only when playback is started:
	- "C - stop playing current file, returns "Stopped."
	- "+" - increase volume by 0.5dB step, 0 refers to max volume value, 254 is minimal value.
	- "-" - decrease volume by 0.5dB step, 0 refers to max volume value, 254 is minimal value.
	- "p" - play/pause toggle during playback, returns "Paused"/"Playing" respectively.
	- "?" - display information on supported commands.
	
	*Note: All of the commands should be followed by a newline character ('\n' or "\r\n")!
	
	Meaning of the status LED (STAT1) activity:
	- When in mass storage mode the LED indicates SD card read/write activity.
	- When playing a file in MP3 player mode LED is constantly ON.
	- When playback is paused in MP3 player mode LED is blinking with 0.5Hz period.
	
	Battery level status LED (STAT2) activity:
	When powered by the battery the MOD-MP3-X indicated low battery level. If voltage of the battery falls below 3.3V then the STAT2 LED starts to blink.
	If an external power source is connected then battery starts charging. In this case STAT2 LED is constantly lit while battery is charging and turns off when battery is fully charged.
	
3. How to use this demo
	The board ships with demo firmware preinstalled which has the same functionality as in this project. In order to run the demo
	please consult the board's user manual considering power supply requirements and jumper settings.
	
	*Note: There are many jumpers on this board because of its high configurability. The board is configured by default to be used in standalone mode so please reconfigure according to the manual and double check before using.

	In order to get things going you:
	
	1) Insert a microSD card
	
	1)  Connect a serial adapter to the board. As mentioned above the MOD-USBRS232 may be used as a serial adapter. In this case you need to change positions of the jumpers on the bottom side of the MOD-USBRS232 to swap Tx and Rx pins and use the supplied UEXT cable to connect to MOD-MP3-X. If using some other solution please ensure 3.3V levels on these pins.
	
	2) Open a terminal program selecting the port in use and configure to 9600-8-N-1
	
	3) Connect a USB cable to the board and start expecting a mass storage device to appear a s available on your PC. Then load your favourite MP3 files on the SD card.
	
	4) disconnect the USB cable and power via the External power jack or the battery connector.
	
	5) You should see startup messages in the terminal like these:
			Starting...
			Codec initialized.
			SD card initialized.
			Root dir found and opened.
			
	6) Enter commands to contol the board. For example use "L" to display contents of the root folder and "pnum 0" to play the first file in the root folder.
	
	You may as well debug this project using IAR EW:
	
	1) Open the workspace file: .\MOD-MP3-X_demo\MP3_player\MP3_Player.eww
	
	2) Press F7 to compile the project.
	
	3) Connect the debugger to the PC and to the target board. Power supply the board as needed.
	
	4) Press Ctrl+D to download the executable to the target.
	
	5) Start debugging (F5)
	
5. Further reading
	Please consult the user manual that comes with this board, it may be downloaded form our site. Also take a look in STM32 reference manual for the onboard processor and the datasheet of the codec chip

6. Support
	http://www.st.com/
	https://www.olimex.com/
	http://www.vlsi.fi/