VS1053 UART code

Writing software that controls the system and peripherals such as displays, SD cards, Buttons, LEDs, Serial Ports etc.
andrewee
User
Posts: 3
Joined: Sun 2014-11-16 17:34

VS1053 UART code

Postby andrewee » Sun 2014-11-16 17:48

Hi,
from the user manual i was able to adress the VS1053 trough the UART and managed to set volume and to play songs. What i like to do is switch loudness on and off or manage to set Treble and Bass Volume up and down by the UART. Can somebody please help me with this uart code? (would be great) :?

User avatar
pasi
VLSI Staff
Posts: 1345
Joined: Thu 2010-07-15 16:04

Re: VS1053 UART code

Postby pasi » Mon 2014-11-17 12:56

Is this a vs1053 application such as the standalone player?

As you know from the documentation, the UART control of the standalone player is not very good due to historical reasons (there is too little instruction memory in vs1003). You can write any register using the WriteRegThroughUart function. If you already succeed with volume, you should be able to write to BASS easily as well.

//set loudness
WriteRegThroughUart(0x33d9, 2);

(Alternatively you can enable UART_BUFFERED from the source code and implement human-readable/writable functions in IdleHook to adjust loudness and volume.)
Visit https://www.facebook.com/VLSISolution VLSI Solution on Facebook

andrewee
User
Posts: 3
Joined: Sun 2014-11-16 17:34

Re: VS1053 UART code

Postby andrewee » Mon 2014-11-17 23:18

so what would be the full string to sent trough the uart to set loudness on and off? I think it starts with 0x02 (write) and then ? a register adress , and then 0x33d9 , i cant figure out the complete string. :?

first byte = read(03) / write(02) ... see vs1053 manual page 20
second/third byte register adress = H/L
Fourth byte= register value 0x33d9 (to set loudness on)

----

than i have the VS1053 standalone player manual explaining to set volume starts with 0x00 which is total confusing for me because i believe that had to be started with write instruction 0x02. am i right?

thank you and hope to solve this mistery :)

User avatar
pasi
VLSI Staff
Posts: 1345
Joined: Thu 2010-07-15 16:04

Re: VS1053 UART code

Postby pasi » Tue 2014-11-18 11:05

The UART protocol of the standalone player has nothing to do with the SCI (serial control interface) commands from the datasheet. The UART protocol of the standalone player is the shortest possible implementation for something that can write to SCI registers. The interrupt handler checks the high bit of the UART. If it is set, the previously collected value is written to the SCI register that is specified in the received byte. If the high bit is not set, another 7 bits are added to the current data value.

So, WriteRegThroughUart first sends 3 bytes to send the 2+7+7 bits of the value, then the register number with the high bit of the UART byte set.

Code: Select all

/* putch() sends a 8-bit value through UART */
void WriteRegThroughUart(unsigned short value, unsigned short reg) {
    putch((value>>14) & 127);
    putch((value>>7) & 127);
    putch(value & 127);
    putch(reg | 0x80);
}

So, you would send 0x00, 0x67, 0x59, 0x82 to write 0x33d9 to SCI register 2.
Visit https://www.facebook.com/VLSISolution VLSI Solution on Facebook

andrewee
User
Posts: 3
Joined: Sun 2014-11-16 17:34

Re: VS1053 UART code

Postby andrewee » Sat 2017-04-15 23:32

Hi Pasi.

My project started in 2014 and is still not fully operational after all these years breaking my head over how to steer the VS1053 through the UART.
Regarding your reply i was able to switch on the Loudness on, (2+7+7) thanks for that.

Mainly i have 2 questions remaining.

1. in the latest manual have seen that the VS1053 is able to receive simple ASCII characters to steer the uart and adres the playback functions. But the character table seems incomplete. Can you please give me the characters for:
- STOP MP3 playback (stop asap) = "C" ??
- Repeat (Loop after Song) =
- Stop playback right after the Song =

2. im breaking my mind over the memory maps. In the manual i found that the VS1053 contains 3 memory banks, right? These banks are no further explained in the document.
Then i wend to find a proper Memorymap to find the full location adress of register AICTRL3 and is not specified anywere. I find that the addres range probably could start at C000 and AICTRL3 adres it selve starts at 0xF. So, my assumtion is that the adress could be C00F, right?
To stop the MP3 song (my assumption) i have to send 0x10 to the UART.
Compleet UART string (AICTRL3 / C00F) in sequence : 83- 80- 8F - 10 but it aint working

thanks in advance :)
Andre

User avatar
pasi
VLSI Staff
Posts: 1345
Joined: Thu 2010-07-15 16:04

Re: VS1053 UART code

Postby pasi » Wed 2017-04-19 14:19

It looks like you are mixing two ways to control the player.

The old / ancient version only allowed control through SCI registers. Due to shortage of instruction memory, the UART control of the vs10xx players just allowed you to use UART to write to SCI registers, in effect indirectly using the SCI control.

But vs1053b and vs1063a have more memory, so newer versions (VSIDE solutions) also contain the possibility to control the player with direct UART commands (like the vs1000 audio module or vs1103 spi player).

The features depend on which exact standalone player version you are using and what options are enabled in the standalone.h (and standalone.c).

Some versions use 'l' for loop mode, 'c' for continuous play mode, 'f' for file mode, 'C' for cancel play, etc.


If you are still using the very old version, writing a new song number with the high bit set in AICTRL0 will cancel the current song (0x02 0x00 0x00 0x8c), and setting the pause bit in AICTRL3 would pause the song (0x00 0x00 0x10 0x8f).
Visit https://www.facebook.com/VLSISolution VLSI Solution on Facebook


Return to “System Software”

Who is online

Users browsing this forum: No registered users