Skip to content

Matiasus/VS1053

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Library for VS1053

The main aim was create library to initialize codec vs1053 with atmega microcontroller to simple sound test - say 'hello'.

VS1053 Description

Detailed information are described in Datasheet VS1053, Application Notes VS10XX.

Library

C library is determined for controlling Ogg Vorbis/MP3/AAC/WMA/FLAC/MIDI AUDIO CODEC using 7 pin SPI Bus. It contains only primitive functions for testing purposes.

Hardware connection

Connection for VS1053 MP3 Shield for Arduino Uno R3.

PIN VS10XX PIN ATMEGA328P Description
5V 5V Supply Voltage
AGND GND Ground
SCLK PB5 Clock for serial bus
MISO PB4 Master IN slave OUT
MOSI PB3 Master OUT slave IN
XCS PB6 Chip select input
DREQ PD2 Data request, input bus
XDCS PD7 Data chip select
XRES PB0 Reset

Usage

Prior defined for MCU Atmega328p, Atmega8.

Tested

Library was tested and proved on a VS1053 MP3 Shield with Arduino UNO R3. The Arduino was without a bootloader installed, it was only raw Atmega328P microcontroller. This hardware configuration was chosen for simplicity

Init sequence

Init sequence (according to source code documentation):

// +---------------------------------------------+
// |           INIT VS10XX MP3 DECODER           |
// +---------------------------------------------+
//                        |
// +---------------------------------------------+
// |            PORTs / PINs SETTINGS            |
// |---------------------------------------------|
// | OUTPUTs:VS10XX_MOSI, VS10XX_SCK, VS10XX_XCS |
// |         VS10XX_XDCS, VS10XX_XRES            |
// |  INPUTs:VS10XX_MISO, VS10XX_DREQ (pullup)   |
// +---------------------------------------------+
//                        |
// +---------------------------------------------+ 
// |      SPI SLOW SPEED INIT / F = 125 kHz      |
// |---------------------------------------------|
// |     SPCR <= SET (SPE, MSTR, SPR1, SPR0)     |
// +---------------------------------------------+
//                        |
// +---------------------------------------------+ 
// |                    RESET                    |
// -----------------------------------------------
// |          activate RESET (low level)         |
// |        wait 22000 clk cycle (1.8 ms)        |
// |             send SPI dummy byte             |
// |      deactivate XCS, XDCS (high level)      |
// |         deactivate RESET (high level)       |
// | activate analog powerdown mode (VOL=0xffff) |
// |    set clock, mul, add => (CLOCKF=0x8800)   |
// |              wait for DREQ high             |
// |    slow sample rate 10 Hz (AUDATA=0x000A)   |
// |                 wait 100ms                  |
// |      turn on analog parts (VOL=0xfefe)      |
// |           8kHz mono (AUDATA=0x1F41)         |
// |     set volume, for exmaple (VOL=0x6666)    |
// +---------------------------------------------+
//                        |
// +---------------------------------------------+ 
// |                 SOFT RESET                  |
// -----------------------------------------------
// |  native SPI modes,soft reset (MODE=0x0804)  |
// |                  wait 1ms                   |
// |              wait for DREQ high             |
// |    set clock, mul, add => (CLOCKF=0x8800)   |
// |                  wait 1ms                   |
// |              wait for DREQ high             |
// |       activate data (XDCS low level)        |
// |         send data four times 0x00           |
// |      deactivate data (XDCS high level)      |
// +---------------------------------------------+
//                        |
// +---------------------------------------------+ 
// |      SPI FAST SPEED INIT / F = 1 MHz        |
// -----------------------------------------------
// |            SPSR <= SET (SPI2X)              |
// |       SPCR <= SET (SPE, MSTR, SPR0)         |
// +---------------------------------------------+

Test Functions

Demonstration version v1.0.0

Links

Acknowledgement

About

Library for driving VS1053 Codec

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published