Vs1063 - UART controlled start and stop encoding

Designing hardware that use VLSI Solution's devices as the system controller for the entire design.
Post Reply
bomba
User
Posts: 3
Joined: Mon 2017-09-25 15:21

Vs1063 - UART controlled start and stop encoding

Post by bomba » Wed 2018-06-20 15:06

Hello,

I wrote a stand-alone application for my VS1063 that:
  • streams MP3 audio throught UART
  • accepts a couple of commands via UART
  • monitors continuously if the volume is above a certain threshold - if it is, it fires a GPIO.
I would like to extend the set of commands to be able to change encoding, bitrate, samplerate, volume and more.

To do so, I need to pause the encoding, set the new values and then restart it - that's where I'm currently stuck.

In my UserHook routine:

Code: Select all

/*      Processing serial input (if any) */
if (flg_cmd_valid == 1) {
	if (cmd_type == TYPE_ACTION) {
		if (cmd_action == ACTION_START) {
                	[..] /* Some stuff */
			USEX (SCI_MODE) &= (1<<SCIMB_CANCEL);
			SET_LED_3_ON;
			((void (*)(void))(0x0050))();
		} else if (cmd_action == ACTION_STOP) {
			[..] /* Other stuff */
			USEX (SCI_MODE) |= (1<<SCIMB_CANCEL);
			SET_LED_3_OFF;
		} else if (cmd_action == ACTION_RESET) {
			/*      TODO */
		}
	}
}
This piece of code actually stops the UART stream, but it never restarts it.

I am attaching the whole project for your convenience, it is still under heavy development.
Any hints on this would be highly appreciated.
Attachments
project.tar.gz
(7.24 KiB) Downloaded 31 times

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

Re: Vs1063 - UART controlled start and stop encoding

Post by pasi » Thu 2018-06-21 16:37

For one, you're missing the bitwise inverse in

Code: Select all

USEX (SCI_MODE) &= ~(1<<SCIMB_CANCEL);
Due to a hardware bug if the ADC is stopped and restarted, the channels may get swapped. (There's a workaround in the patches package, but it isn't usable in standalone.) The standalone recorder thus watchdog-resets the vs1063 after each recording. (It was recently updated, so take a look at how it does things. A hardware reset will clear all registers and reload the code from SPI memory, but you might be able to pass information through the reset using uninitialized variables.)

Unfortunately Juhannus is upon us, so I don't have time to take a closer look. Have a nice Solstice.
Visit https://www.facebook.com/VLSISolution VLSI Solution on Facebook

bomba
User
Posts: 3
Joined: Mon 2017-09-25 15:21

Re: Vs1063 - UART controlled start and stop encoding

Post by bomba » Fri 2018-06-22 13:17

Pasi,

actually, adding the missing bitwise inverse resolved the issue;
I have been testing it for a while now, stopping and starting every five minutes:
It does not look like the channels get swapped. Am I missing something?

Another question, after issuing:

Code: Select all

USEX (SCI_MODE) |= (1<<SCIMB_CANCEL);
Will I be able to change encoding parameters (bitrate, samplerate, etc)?

I hope you've had a nice Juhannus! I've never heard of it before, what a fascinating holiday!

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

Re: Vs1063 - UART controlled start and stop encoding

Post by pasi » Mon 2018-06-25 13:11

bomba wrote:
Fri 2018-06-22 13:17
It does not look like the channels get swapped. Am I missing something?
Could be luck. The encoder disables the ADC after you stop encoding, so on the next init it could happen.
bomba wrote:
Fri 2018-06-22 13:17
Will I be able to change encoding parameters (bitrate, samplerate, etc)?
Depends on your main loop. Before starting encoding you can set the suitable parameters.
Visit https://www.facebook.com/VLSISolution VLSI Solution on Facebook

Post Reply