VS1005 MP3 Player with USB Host

Installing and using VSIDE tools for VLSI Solution's devices that contain a VSDSP signal processor.
Posts: 10
Joined: Thu 2016-08-18 9:03

Re: VS1005 MP3 Player with USB Host

Post by Srikanth » Mon 2016-10-03 12:32

Dear Panu and Hannu,

Thank you for your valuable response. Currently I am looking at the youtube video that panu has shared. The searching devices and printing files part in that youtube video link is really worthy. I guess this is same for USB device as well.

after looking at Panu and Hannu comments. I guess VSOS automatically detects the USB drives before starting the application, i.e. sending SOF will be done automatically and internally by VSOS. If any USB device is connected before starting the application, the internal USB library loads the USB device with drive letter 'U' and will be ready for use in vs_pdevices.

once it is connected. we can create File handle for that USB Device to search for files in that drive. VSOS supports FAT or FAT16 or FAT32 filesystem.

I have to handle the situation where USB connection and disconnection occurs while application is running.
Let me know if I am not correct.

Dear Hannu,

I don't have VSOS development board. I am working on one of our project in which MP3 is a part of it. I will be working directly on our customised board.
currently I don't have the hardware to check for that config.txt file.

Thank you,

Senior User
Posts: 40
Joined: Mon 2016-05-30 11:54

Re: VS1005 MP3 Player with USB Host

Post by Hannu » Mon 2016-10-03 13:49

So you have UART and USB access? From VSOS Shell you can share S: by commanding

Code: Select all

usbmsc s:
Remember safely remove the disk before hitting CTRL-C on terminal which exits from sharing.

Another option is to pull high GPIO0_0 pin during boot which is what S1 button does on dev board.

Without knowing all the details how and what features your design will have, I'll say you are on the right track.
There is a lot of info in VSOS guide http://www.vlsi.fi/fileadmin/manuals_gu ... _guide.pdf Also the

And now that you mentioned filesystems, VSOS supports all FAT12/16/32 but not exFAT which can be found from some 64GB and bigger USB disks and SD cards.

Posts: 5
Joined: Mon 2018-01-01 21:19

Re: VS1005 MP3 Player with USB Host

Post by sreilly » Sun 2018-01-28 8:32

Hello VLSI team,

I'd like to use GPIO0_4 and GPIO0_5 for interrupt routines.
I added tact switches and 5.6kohm resistors pulled up to IOVDD and set GPIO0_4 and GPIO0_5 as inputs.
I tried your code on my development board GPIO0_4 and GPIO0_5 will not trigger the interrupt routine.
Why will your code only read buttons GPIO0_0 through GPIO0_3 on the development board where the function GpioReadPin will read the GPIO0_4 and GPIO0_5 pin?


Henrik wrote:
Thu 2016-09-01 9:44
Hello again!

You have lots of good thought in your code, but there are certain points which will prevent it from working.

As a point of reference, I made a very simple code example that reads buttons from GPIO0_0 through GPIO0_3 using an interrupt, then handle those button presses in a main program.

The reason for doing it this way is to keep the interrupt as short as possible. Long interrupts sooner or later cause trouble with real-time features, like glitches in audio playback or e.g. SPI communications (if an application has such features). This is here avoided by using a very short interrupt to collect the data, but to handle these events in a main program that doesn't have strict real-time requirements.

From the example you will also see other recommended stylistical habits, like using the PERIP() macro, which makes peripheral accesses easier to read.

Code: Select all

#include <vo_stdio.h>
#include <volink.h>     // Linker directives like DLLENTRY
#include <apploader.h>  // RunLibraryFunction etc
#include <timers.h>
#include <consolestate.h>
#include <string.h>
#include <vs1005g.h>
#include <vo_gpio.h>

u_int16 gpioState=0, gpioPend=0;

#pragma interrupt y 0x27
void Gpio0Interrupt(void) {
  /* Let's make the interrupt as short as possible. */
  gpioPend |= PERIP(GPIO0_INT_PEND); /* Get which bits have changed. */
  PERIP(GPIO0_INT_PEND) = 0xFFFF;    /* Clear the flags. */
  gpioState = PERIP(GPIO0_IDATA);    /* Get the actual GPIO data. */

ioresult main(char *parameters) {
  int quit = 0;

  if (!strcmp(parameters, "-h")) {
    printf("Usage: GpioDemo [-h]\n");
    goto finally;

  /* Make GPIO0_0 through GPIO0_3 inputs */

  /* We are interested in the rising edges of GPIO0_0 through GPIO0_3... */
  /* ... as well as the falling edges. */

  /* Activate GPIO0 interrupt at lowest interrupt priority */
  /* Run main loop until Ctrl-C is pushed. */
  while (!(appFlags & APP_FLAG_QUIT)) {
    u_int16 localGpioPend, localGpioState;

    /* Disable interrupts */
    /* Take local copy of the variables */
    localGpioPend = gpioPend;
    localGpioState = gpioState;
    /* Clear main variables. */
    gpioPend = 0;
    /* Re-enable interrupts */

    if (localGpioPend) {
      int i;
      for (i=0; i<4; i++) {
	if ((localGpioPend >> i) & 1) {
	  printf("GPIO0_%d = %d\n", i, (localGpioState>>i) & 1);
    } else {
      /* Wait for one millisecond */

  /* Remove the interrupt */

  return S_OK;
For your convenience, the demonstration Solution is attached below.

Kind regards,
- Henrik

User avatar
VLSI Staff
Posts: 2561
Joined: Tue 2010-06-22 13:43

Re: VS1005 MP3 Player with USB Host

Post by Panu » Sun 2018-01-28 13:11

Why will your code only read buttons GPIO0_0 through GPIO0_3 on the development board
Here's why:

Code: Select all

  /* We are interested in the rising edges of GPIO0_0 through GPIO0_3... */
(0x000F is 0000000000001111 in binary so only the lowest four bits are read. Use 0x0030 (0000000000110000b) to trigger GPIO0_4 and GPIO0_5)

Info: Line In and Line Out, VS1000 User interface, Overlay howto, Latest VSIDE, MCU Howto, Youtube
Panu-Kristian Poiksalo, VLSI Solution Oy

Post Reply