Showing posts with label avr. Show all posts
Showing posts with label avr. Show all posts

Thursday, November 8, 2012

Very advanced AVR attiny2313 WAV music player. Read files from SD card / microSD / MMC.





Player controls: UART or/and One button "Select / Play" or/and binary code "Select track"

Pinouts and Switches

UART - send upper symbol "A" to start first track, "B" for second, etc... (check below for more info). To stop playback enter any other symbol.
Dir1 / Dir2 - Select directory with WAV files. Required 2 directory with names "1" and "2". Dir "1" selected by default
Select / Play - button launches a track to play. One click play first track, double click second, etc...
Select track - play track by binary code. If 0001 play first track, if 0010 play second, etc... Counting in binary

Monster - can slow (2 times) track play. The switch works "on the fly"
Helium - speeds up the track (1/3). The switch works "on the fly"
Repeat - if the switch is shorted to ground, the selected track will be forever played.

Debug LED information


The red LED flashes - no SD card or its type is not supported by the device

Red LED lights - SD card is supported and successfully initialized, but the card was not formatted in FAT16

Green LED lights - SD card is initialized successfully, locate the file system and the device is ready to play a track - waiting for the team

Green LED flashes - the device plays the track
The green goes to red, the green again - not found a track
The green briefly goes out and the green again - pressed to choose track

Debug UART information

After each successful step in the UART sends the appropriate symbol:
S - (Start) of the microcontroller peripherals initialized properly
C - (Card Init) SD card is initialized properly and supported
F - (FAT Init) FAT system is supported
1 - (No 1 Dir) no folder "1" is read from the root directory
2 - (No 2 Dir) no folder "2" will be read from the root directory
R - (Ready) the device is fully ready. Waiting for the command to start the track
In addition, each time a track is transferred to the UART capital track name.

File system and WAV file format

microSD/SD/MMC card must be formated in FAT16. 2GB maximum supported flash card size.
WAV file should be Mono with 32000Hz Sample rate and 8 Bit Depth.
In order for the unit knew what file first, second, third, etc. the first character of the file name must be uppercase letters (the rest of the name as the file extension - is ignored.)



Uploading Attiny2313 WAV player firmware in 4 steps
4. Open terminal and run next command: avrdude -c avrisp -b 19200 -P com13 -p t2313 -U lfuse:w:0xe4:m -U hfuse:w:0xdf:m -U flash:w:SDC_Talking.hex

My device photos

AVR Attiny2313 WAV player with Sparkfun FTDI attached

attiny2313 SD card WAV player



Arduino as AVRISP programmer









 

 

 

Credits and source code