VS1010 Interrupts

Designing hardware and software for systems that use the VS1010 MP3 Audio DSP Microcontroller.
Post Reply
Jere
User
Posts: 9
Joined: Thu 2017-07-20 11:26

VS1010 Interrupts

Post by Jere »

Hi,

how to initialize interrupts (including vectors and handlers) for timers and gpio on VS1010 development board (V1.1)?

Target application is standalone mp3-player controlled with I/O and capability to detect short and long button presses is required.
I have been searching for solution throughout the forum and found some examples (mainly for VS1005), tried them, but no success.

So far I'm just figuring out how to implement different functionalities so the software is based on the default demo10 template from the SD-card delivered with the development board.

- Jere
User avatar
Panu
VSDSP Expert
Posts: 2829
Joined: Tue 2010-06-22 13:43

Re: VS1010 Interrupts

Post by Panu »

Hi!

There's two different categories of button control that you need in your product:
A) Controls that work between playing songs (select song etc)
B) Controls that work during playing songs (change volume, end song for moving to the next song etc)

These are different and both are covered in the example you can find in the topic viewtopic.php?f=15&t=2128 and in the PDF file there (download/file.php?id=1426). Generally...

- The A controls do something that decides which file to play and then ends up calling PlayerPlayFile to play a song
- The B controls manipulate the state of the chip and the decoder (volume etc) and may end up canceling the playback so that the A controls will work again.

Code that handles the A controls will be written in your main program.
Code that handles the B controls will be written in a function that is called by "interrupt" handler 97, PlayerCallback.

PlayerCallback is not a hardware interrupt, it's kind of like a software interrupt that is called by the audio decoder periodically. To use it, implement a function that reads the buttons and manipulates the hardware (to set the volume etc) or sets cs.cancel to 1 to make the current song to stop. Then the PlayerPlayFile will return and your main program can again read the buttons to do stuff that needs to be done between songs.

There's no need to use hardware interrupts to handle the buttons, because the PlayerCallback software handler method is designed to be used for just this purpose. Hardware interrupts are concurrency dangerous and offer no real benefit here.

To find out how much time has passed since the previous call to PlayerCallback (so that you can detect a long press etc), use the ReadTimeCount() function. It's a milliseconds counter, practically. To get the state of the buttons, use the GpioReadPin() function.

Please study the DEMO10 example in the PDF (download/file.php?id=1426) and the other examples (such as the UART controlled player example, viewtopic.php?f=15&t=2131#p11233) written at the forum and then I'll help you to customize your firmware to do what you need!

I'm looking forward to assisting you,
-Panu
Jere
User
Posts: 9
Joined: Thu 2017-07-20 11:26

Re: VS1010 Interrupts

Post by Jere »

Thanks, that worked just as intended!

Next I would like to learn how to use the memsmic and I2S interfaces. (I'm using the vs1010 development board)

For the mic, how to read mic level? I followed steps in the vs1010 datasheet (http://www.vlsi.fi/fileadmin/datasheets/vs1010ds.pdf):

Code: Select all

ioresult main (char *params) 
{
	u_int16 tempCnt = 0;		// counter for slowing down the read cycle from the mic registers
	
	GpioSetAsInput(0x09);		// memsmic data input
		
	PERIP(PERIP_CF) |= PERIP_CF_MEMSCK1;
	PERIP(MEMSMIC_CF) = MEMSMIC_CF_SELIO | MEMSMIC_CF_ENA;
	
	
	while(1) 
	{
		if(tempCnt == 0)
		{
			tempCnt = 200;
			printf("MIC: %d | %d\n", PERIP(MEMSMIC_LDOUT), PERIP(MEMSMIC_RDOUT));
		}
		tempCnt--;
	}
	return S_OK;
}
And for result I get endless list of:
MIC: -16384 | -16384
MIC: -16384 | -16384
MIC: -16384 | -16384
MIC: -16384 | -16384
MIC: -16384 | -16384
MIC: -16384 | -16384

Is there something else to initialize or is INT_MEMS interrupt needed for reading the registers when whole sample is ready..?


For the I2S interface, I would like to have an option to choose whether to play audio from the SD card or from the interface (i.e. aux input).
- How to accomplish this? Which sholud be chosen as master, vs1010 or AK5358B?
- How to initialize I2S interface in vs1010?
- Again is an interrupt required for this?


- Jere
User avatar
Panu
VSDSP Expert
Posts: 2829
Joined: Tue 2010-06-22 13:43

Re: VS1010 Interrupts

Post by Panu »

Hi!

I solved the I2S question first and wrote the answer into a new post. It is here:
viewtopic.php?t=2155&p=11335#p11335

I'll take a look at the MEMS mic next. At least all the pins must be configured as peripherals, not as inputs.

[Edit] I completed a simple example of using the mems microphone. It uses interrupts, but is otherwise as simple as possible. Please see here: viewtopic.php?f=15&t=2156

-Panu
Post Reply