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,
Srikanth
VS1005 MP3 Player with USB Host
Re: VS1005 MP3 Player with USB Host
So you have UART and USB access? From VSOS Shell you can share S: by commanding 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.
Code: Select all
usbmsc s:
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.
Re: VS1005 MP3 Player with USB Host
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?
Thanks,
Sean
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?
Thanks,
Sean
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.
For your convenience, the demonstration Solution is attached below.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 */ GpioSetAsInput(0x00); GpioSetAsInput(0x01); GpioSetAsInput(0x02); GpioSetAsInput(0x03); /* We are interested in the rising edges of GPIO0_0 through GPIO0_3... */ PERIP(GPIO0_INT_RISE) = 0x000F; /* ... as well as the falling edges. */ PERIP(GPIO0_INT_FALL) = 0x000F; /* Activate GPIO0 interrupt at lowest interrupt priority */ PERIP(INT_ENABLE0_LP) |= INTF_GPIO0; PERIP(INT_ENABLE0_HP) &= ~INTF_GPIO0; /* Run main loop until Ctrl-C is pushed. */ while (!(appFlags & APP_FLAG_QUIT)) { u_int16 localGpioPend, localGpioState; /* Disable interrupts */ Disable(); /* Take local copy of the variables */ localGpioPend = gpioPend; localGpioState = gpioState; /* Clear main variables. */ gpioPend = 0; /* Re-enable interrupts */ Enable(); 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 */ Delay(1); } } /* Remove the interrupt */ PERIP(INT_ENABLE0_LP) &= ~INTF_GPIO0; printf("End.\n"); finally: return S_OK; }
Kind regards,
- Henrik
Re: VS1005 MP3 Player with USB Host
Here's why:Why will your code only read buttons GPIO0_0 through GPIO0_3 on the development board
Code: Select all
/* We are interested in the rising edges of GPIO0_0 through GPIO0_3... */
PERIP(GPIO0_INT_RISE) = 0x000F;
-Panu
Info: Line In and Line Out, VS1000 User interface, Overlay howto, Latest VSIDE, MCU Howto, Youtube
Panu-Kristian Poiksalo
Panu-Kristian Poiksalo
Re: VS1005 MP3 Player with USB Host
Hi!
The "MP3MODEL" that you announced is a very nice and lean code which works better than the solution that we coded ourselves. But how can you rewind in a song? I mean not skipping to the previous file, but go back for a few seconds inside a playing song. Is there a solution?
Best regards,
Martin
The "MP3MODEL" that you announced is a very nice and lean code which works better than the solution that we coded ourselves. But how can you rewind in a song? I mean not skipping to the previous file, but go back for a few seconds inside a playing song. Is there a solution?
Best regards,
Martin
Re: VS1005 MP3 Player with USB Host
Hi!
Should be. There's a CodecServices::goTo property that sets the current decode time in seconds. In MP3MODEL I can see that the message at least is interpreted.
So you can set the current position by sending the UIMSG_U32_PLAY_TIME_SECONDS message.
You can get the current play time in seconds by receiving the UIMSG_U32_PLAY_TIME_SECONDS message.
-Panu
Should be. There's a CodecServices::goTo property that sets the current decode time in seconds. In MP3MODEL I can see that the message at least is interpreted.
Code: Select all
case UIMSG_U32_PLAY_TIME_SECONDS:
if (auDec) {
auDec->cs.goTo = value;
}
You can get the current play time in seconds by receiving the UIMSG_U32_PLAY_TIME_SECONDS message.
-Panu
Info: Line In and Line Out, VS1000 User interface, Overlay howto, Latest VSIDE, MCU Howto, Youtube
Panu-Kristian Poiksalo
Panu-Kristian Poiksalo
Re: VS1005 MP3 Player with USB Host
Thank you Panu for the fast reply. There is a rewind-function, but it is not so smart as the wind-function. When you wind forward, the audio plays faster, when you rewind, it only jumps from one point to another. Is there a possibility to do this nicer?
Re: VS1005 MP3 Player with USB Host
Hi,
do you mean, like, play audio backwards? Not realistically - first of all, would you really want that? And second of all, none of the music file formats (except PCM WAV, which could techinically be played in either direction) are designed to support such operations - there's no backwards linked lists of blocks, only forward and thus it would mean at least double the memory consumption and even more CPU consumption to seek backwards for blocks, decode them, play backwards, filter - an unbelieveable amount of work for a result you probably wouldn't like at all...
All you can do is experiment in the amount of how much you jump backwards and how much, I'd say.
-Panu
do you mean, like, play audio backwards? Not realistically - first of all, would you really want that? And second of all, none of the music file formats (except PCM WAV, which could techinically be played in either direction) are designed to support such operations - there's no backwards linked lists of blocks, only forward and thus it would mean at least double the memory consumption and even more CPU consumption to seek backwards for blocks, decode them, play backwards, filter - an unbelieveable amount of work for a result you probably wouldn't like at all...
All you can do is experiment in the amount of how much you jump backwards and how much, I'd say.
-Panu
Info: Line In and Line Out, VS1000 User interface, Overlay howto, Latest VSIDE, MCU Howto, Youtube
Panu-Kristian Poiksalo
Panu-Kristian Poiksalo