Hi everyvone, today i`m start working with VS1005 dev board. After learning the forum, i connected virtual uart and see this:
1.There is command reference for UART?
2.What sciences need to be studied in order to write applications?
3.Why VLSI classic player 0.2 does not support FLAC with parameters more than 44/16 (SD from the box)?
Questions:VS1005 from zero/UART commands
Re: VS1005 from zero/UART commands
Hello and welcome to the forum,
The UART settings are 115200 8N1.
Some resources for VS1005:
https://www.vlsi.fi/fileadmin/app_notes ... tarted.zip
https://www.vlsi.fi/fileadmin/software/ ... _Shell.pdf
https://www.vlsi.fi/fileadmin/software/ ... _Audio.pdf
It depends what you want to do. If I write some control software, most of the time I keep checking which way fwrite() takes parameters.
So common knowledge of C-programming is needed. The architecture creates some limitations and features like no 8-bit datatype, two memories, no memory protection, no asserts, not all standard functions are implemented and there are some interesting functions which aren't available on desktop C. And there is limited amount of memory and CPU time.
For hardware drivers, I keep reading datasheets and for DSP stuff, I ask help from Henrik
For code examples, take a look roots and sources package's solution directory. There are sources for the drivers.
viewtopic.php?p=15638#p15638
And most programs start from VSIDE's file-> new->project/solution->VS1005 VSOS application->VSOS3 driver or console application - universal
The UART settings are 115200 8N1.
Some resources for VS1005:
https://www.vlsi.fi/fileadmin/app_notes ... tarted.zip
https://www.vlsi.fi/fileadmin/software/ ... _Shell.pdf
https://www.vlsi.fi/fileadmin/software/ ... _Audio.pdf
It depends what you want to do. If I write some control software, most of the time I keep checking which way fwrite() takes parameters.
So common knowledge of C-programming is needed. The architecture creates some limitations and features like no 8-bit datatype, two memories, no memory protection, no asserts, not all standard functions are implemented and there are some interesting functions which aren't available on desktop C. And there is limited amount of memory and CPU time.
For hardware drivers, I keep reading datasheets and for DSP stuff, I ask help from Henrik

For code examples, take a look roots and sources package's solution directory. There are sources for the drivers.
viewtopic.php?p=15638#p15638
And most programs start from VSIDE's file-> new->project/solution->VS1005 VSOS application->VSOS3 driver or console application - universal
Re: VS1005 from zero/UART commands
Now I want to try to enable playback by command through UART.
The whole device looks like this:
The whole device looks like this:
- Attachments
-
- magic.png (25.61 KiB) Viewed 7255 times
Re: VS1005 from zero/UART commands
So far this all can be done through shell.
For spdif input you need auispd and i2s output auoi2s[s|m][a] depending on your configuration. Simplest is master out automatically auosma s
for testing you can use driver command to load the
So your config.txt should have
auispd s
auoi2sma s
Now your stdinaudio would come from S/PDif and stdaudioout would go to DAC and I2S
If you want to play from SD-card send cd d:music and playdir.
These are documented in https://www.vlsi.fi/fileadmin/software/ ... _Shell.pdf
For spdif input you need auispd and i2s output auoi2s[s|m][a] depending on your configuration. Simplest is master out automatically auosma s
for testing you can use driver command to load the
So your config.txt should have
auispd s
auoi2sma s
Now your stdinaudio would come from S/PDif and stdaudioout would go to DAC and I2S
If you want to play from SD-card send cd d:music and playdir.
These are documented in https://www.vlsi.fi/fileadmin/software/ ... _Shell.pdf
Re: VS1005 from zero/UART commands
1.How to upload something to the S drive (I found this answer myself by pressing the buttons with Reset). The way to upload new VSOS releases is very interesting. I saw a topic where a person asked how to upload firmware from an SD card. Probably, it is necessary to explain why this is all. I have a customer for a batch of micro all-in-one systems of fairly high quality. It is supposed to connect VS1005 <-> STM32 via uart, I really liked it. And not doctors of sciences will be engaged in production at all, some simple solution is needed. I tried to compile 3.66 in VSIDE, got an error.
2. In fact, there is only one I2S terminal (GPIO10-14). How to make an I2S route through VS1005? Probably, you will have to switch AUII2SS / AUOI2SM during operation? Yes, I will have an external device with I2S output. This device has an option with an SPDIF output, but I don’t really want to install a microcircuit for switching.
3.How to play a folder/file by index in alphabetical order, not by name? Is it possible to make control on playfile command send letters to uart like it is done with playdir?
4.How to make mic mixing with any source?
5.How to output sample rate of external I2S sources to UART?
6.Where can I get the AUXSPD, FTINOISE files (they are simply not inside the microcircuit on the devboard, version 3.65)?
7.How to get rid of AUXPLAY panic when choosing auiadc (out underflow +####)?
8. How to select line input after RDSRADIO (no sound)? If you turn it on right after the reboot, it works.
9. Please teach me how to make routes
A: LineIn —> I2S&SPDIF
B: SPDIF —> I2S&SPDIF
C: I2S —> I2S&SPDIF
D: Mic Mixing with all
10. I really want funny commands like gettrackartist, gettrackalbum, gettracdiscnumber. I don’t even dream of transferring pictures from the covers.
11.What should the FM antenna look like? I am in the countryside, I use a 3 meter wire ring, but it works worse than a push-button mobile phone with headphones.
12. How to send ctrl+c command via UART from microcontroller?
2. In fact, there is only one I2S terminal (GPIO10-14). How to make an I2S route through VS1005? Probably, you will have to switch AUII2SS / AUOI2SM during operation? Yes, I will have an external device with I2S output. This device has an option with an SPDIF output, but I don’t really want to install a microcircuit for switching.
3.How to play a folder/file by index in alphabetical order, not by name? Is it possible to make control on playfile command send letters to uart like it is done with playdir?
4.How to make mic mixing with any source?
5.How to output sample rate of external I2S sources to UART?
6.Where can I get the AUXSPD, FTINOISE files (they are simply not inside the microcircuit on the devboard, version 3.65)?
7.How to get rid of AUXPLAY panic when choosing auiadc (out underflow +####)?
8. How to select line input after RDSRADIO (no sound)? If you turn it on right after the reboot, it works.
9. Please teach me how to make routes
A: LineIn —> I2S&SPDIF
B: SPDIF —> I2S&SPDIF
C: I2S —> I2S&SPDIF
D: Mic Mixing with all
10. I really want funny commands like gettrackartist, gettrackalbum, gettracdiscnumber. I don’t even dream of transferring pictures from the covers.
11.What should the FM antenna look like? I am in the countryside, I use a 3 meter wire ring, but it works worse than a push-button mobile phone with headphones.
12. How to send ctrl+c command via UART from microcontroller?
Re: VS1005 from zero/UART commands
Normally VS3emu and UART is used to write the kernel to flash. This depends a lot of production setup. How the communication to VS1005 is handled in production. Field update of the kernel is also possible, but removing power while writing the kernel would brick the system.RWS wrote: Fri 2023-05-26 15:22 1.How to upload something to the S drive (I found this answer myself by pressing the buttons with Reset). The way to upload new VSOS releases is very interesting. I saw a topic where a person asked how to upload firmware from an SD card. Probably, it is necessary to explain why this is all. I have a customer for a batch of micro all-in-one systems of fairly high quality. It is supposed to connect VS1005 <-> STM32 via uart, I really liked it. And not doctors of sciences will be engaged in production at all, some simple solution is needed. I tried to compile 3.66 in VSIDE, got an error.
auxi2s[sm] with s parameter hooks up stdaudioin and stdaudioaout. After that auxplay would do the copying audio from DI to DO pins.2. In fact, there is only one I2S terminal (GPIO10-14). How to make an I2S route through VS1005? Probably, you will have to switch AUII2SS / AUOI2SM during operation? Yes, I will have an external device with I2S output. This device has an option with an SPDIF output, but I don’t really want to install a microcircuit for switching.
Splitting audio to also S/PDIF would need loading auospd, getting the FILE* for S/PDIF driver and writing the data. If the I2S operates as a master, there aren't clocking problems.
I don't think there is a player with playlist support but writing a parser for your playlist and running playfile for each file shouldn't be hard.3.How to play a folder/file by index in alphabetical order, not by name? Is it possible to make control on playfile command send letters to uart like it is done with playdir?
This isn't an easy task. Generally I would read mic with ADC, send it to DAOSET and call it a day. However S/PDIF makes life little bit harder and gives clocking and sample rate constrains Fs needs to be 48 kHz or 96 kHz (if there is CPU left for that).4.How to make mic mixing with any source?
I2S has to be a master. With AUXI2SM get the input and output FILE *s, AUOSPD the output FILE * Also from AUIADC get input FILE *
Then read from ADC and I2S, sum together and write to both I2S and S/PDIF output FILE *s
see https://www.vlsi.fi/fileadmin/software/ ... _Audio.pdf there are ioctl interface. And to debug stuff auinput can show something but I don't know if it handles the I2S slave sample rate.5.How to output sample rate of external I2S sources to UART?
Did you checked this thread? viewtopic.php?p=15664#p156646.Where can I get the AUXSPD, FTINOISE files (they are simply not inside the microcircuit on the devboard, version 3.65)?
Your input and output sample rates doesn't match. DAC side is going faster than AD side or its running in 32-bit mode while ADC isn't.7.How to get rid of AUXPLAY panic when choosing auiadc (out underflow +####)?
auinput and auoutput are the commands you are looking for.
tell AUIADC to select correct inputs and sample rates with auinput command.8. How to select line input after RDSRADIO (no sound)? If you turn it on right after the reboot, it works.
Autch. This will make life interesting.9. Please teach me how to make routes
A: LineIn —> I2S&SPDIF
B: SPDIF —> I2S&SPDIF
It is perfectly possible to do this and there are driver support for this. AUOI2SMA can output this to I2S. However mic mix won't be possible to S/PDIF out as it takes input from SRC output registers.
Take a look at data sheet's playback interfaces diagram. S/PDIF is core clock (CLKI) dependent and DAC, I2S and ADC are XTALI clock domain.
Also if the clocks aren't same, sample rate isn't same. So reading S/PDIF or I2S slave will need to go through sample rate converter or somewhere happens over or underrun. It is only matter of time when it will happen.
I don't know if there is a software for parsing the ID3 tags. Most of the those are handled by skipping them. However I can be wrong as I haven't written VS1005 software lately.C: I2S —> I2S&SPDIF
D: Mic Mixing with all
10. I really want funny commands like gettrackartist, gettrackalbum, gettracdiscnumber. I don’t even dream of transferring pictures from the covers.
Break out board has the external filters and for my use I have 75 cm wire connected to sleeve. The wire has pink insulation so it has to be important. To be honest, I don't exactly know the RF magic behind the radio receiver.11.What should the FM antenna look like? I am in the countryside, I use a 3 meter wire ring, but it works worse than a push-button mobile phone with headphones.
However FM radio and S/PDIF are mutually exclusive and I2S takes also penalty from it because FM outputs 32 kHz.
In this case I would suggest to take a look at VS1010 simple radio project which has a very inexpensive TEA5767 FM radio module FM radio receiver module.
viewtopic.php?t=2764 and viewtopic.php?t=3042
Simply sending the charactrer. Its value is 3 or 27. One is esc and other is CTRL-C12. How to send ctrl+c command via UART from microcontroller?
Re: VS1005 from zero/UART commands
Hello!
I will make some additions to Hannu's answers. This is going to be a long one, so I hope it doesn't get too confusing.
Hannu already answered the lot of this, but I'll try to give more perspective.
A: Line In --> I2S + SPDIF
A.1: VS1005 is I2S clock master
If VS1005 is the master of the system, this is ok, and there is actually a very easy way to do this. There are two alternatives, and I show here one of them. Put the following lines in S:CONFIG.TXT:
AUIADC s line1_1 line1_3
AUODAC s
AUOI2SMA
AUOSPDA
Now, AUIADC will be connected to file handle stdaudioin, and AUODAC to stdaudioout. For I2S and SPDIF we start automatic (A) drivers that automatically copy the contents sent to AUODAC. That way you get the exactly same output to the Line out/Headphone out and I2S and SPDIF.
If you want to add a microphone, replace AUIADC with the all-new 3-channel input driver AUI3ADC. Then you can either downmix the data to 2 channels by hand, or alternatively use the FTI3TO2 downmixer driver to automatically downmix the 3 input channels to stereo.
AUI3ADC & FTI3TO2:
viewtopic.php?p=15663
A.2: VS1005 is I2S clock slave
If we are an I2S slave, we will need to synchronize to the incoming data because it will never be exactly the nominal rate. The method I will present here will only work if the I2S sample rate is nominally 48 kHz. It will not work for 44.1, 32, 88.2, or 96 kHz inputs.
There is a S/DPIF driver that modifes the S/PDIF sample rate slightly to adapt to the actual sample rate. However, due to how VS1005's hardware is implemented, this adjustment is made by turning the VS1005's master clock around 61.44 MHz, so it is a pretty intrusive method.
Put this into S:CONFIG.TXT:
AUXI2SS s
AUOSP48S
This will connect the AUXI2SS driver to both file handles stdaudioin and stdaudioout. Then you need to take a file handle to AUOSP48S, and copy also the data to that driver. The code would be something like this:
With S/PDIF, we can never control the input sample rate, so we need to be able to adapt to input sample rate variation.
B.1: VS1005 is I2S clock master
A way to do this would be the have this in S:CONFIG.TXT:
AUXSPD s
AUODAC
AUOI2SMA
The AUXSPD driver will adjust VS1005's clock around 61.440 MHz if input sample rate is nominally 48 kHz, and around 56.446 MHz if input sample rate is nominally 44.1 kHz. With this method you would copy samples from stdaudioin to stdaudioout (both connected to AUXSPD), then also copy data to AUODAC's output handle. AUOI2SMA would then automatically copy AUODAC's data to I2S output. Synchronization would be implemented by comparing the sample rate counters of stdaudioin and AUODAC, the adjusting AUODAC's sample rate slightly.
For an example of how to synchronize see how AUOSP48S calculates the newDiff variable in AudioDrivers/AUXSPDIF/auosp48s/auosp48s.c function AuiSpdCyclicFunc().
If this all seems overwhelming, we can help you with implementation after you have decided if you want to go this path.
B.2: VS1005 is I2S clock slave
This would need software synchronization to a level we don't currently have.
This is a straightforward case. Put this in S:CONFIG.TXT:
AUXI2SM s
AUOSPD
Then use code something like this (very similar to the previous code example):
C.2: VS1005 is I2S clock slave
Here we would need to adjust SPDIF output sample rate to the actual I2S sample rate. We don't currently have code to implement this synchronization method.
So, adding microphone to different cases:
A.1: Easy, and presented in the answer.
A.2: Would need new synchronization / resampling code.
B.1: Would need new synchronization / resampling code.
B.2: Would need new synchronization / resampling code.
C.1: Easy, just add AUIADC, it will automatically keep in sync with AUXI2SM.
C.2: Would need new synchronization / resampling code.
So you see that things are definitely much easier if VS1005 acts as the I2S Master.
To not make this answer longer than it already is, let me ask you about your application: how important is the microphone input? Is it something like a karaoke machine where you need to have it active for a long time and really good quality? Or what is its function?
Kind regards,
- Henrik
I will make some additions to Hannu's answers. This is going to be a long one, so I hope it doesn't get too confusing.
Exactly. Which driver you need to use depends on whether VS1005 is the master or slave in the system. If VS1005 is the master, use AUXI2SM. If VS1005 is the slave, use AUXI2SS. Both of these drivers provide both input from file handle stdaudioin and output to stdaudioout.Hannu wrote: Mon 2023-05-29 10:17auxi2s[sm] with s parameter hooks up stdaudioin and stdaudioaout. After that auxplay would do the copying audio from DI to DO pins.RWS wrote: Fri 2023-05-26 15:22 2. In fact, there is only one I2S terminal (GPIO10-14). How to make an I2S route through VS1005? Probably, you will have to switch AUII2SS / AUOI2SM during operation? Yes, I will have an external device with I2S output. This device has an option with an SPDIF output, but I don’t really want to install a microcircuit for switching.
This is one way, and in this case probably the preferable way. Note what Hannu said about synchronization: if VS1005 is the I2S master, then clocking is easy (just set both I2S and S/PDIF to e.g. 48000 Hz, and they will keep in sync forever. If VS1005 is the I2S slave, we run into potentially very difficult synchronization issues because then we cannot control the I2S sample rate.Splitting audio to also S/PDIF would need loading auospd, getting the FILE* for S/PDIF driver and writing the data. If the I2S operates as a master, there aren't clocking problems.
It will. Let's see now.Autch. This will make life interesting.9. Please teach me how to make routes
A: LineIn —> I2S&SPDIF
Hannu already answered the lot of this, but I'll try to give more perspective.
A: Line In --> I2S + SPDIF
A.1: VS1005 is I2S clock master
If VS1005 is the master of the system, this is ok, and there is actually a very easy way to do this. There are two alternatives, and I show here one of them. Put the following lines in S:CONFIG.TXT:
AUIADC s line1_1 line1_3
AUODAC s
AUOI2SMA
AUOSPDA
Now, AUIADC will be connected to file handle stdaudioin, and AUODAC to stdaudioout. For I2S and SPDIF we start automatic (A) drivers that automatically copy the contents sent to AUODAC. That way you get the exactly same output to the Line out/Headphone out and I2S and SPDIF.
If you want to add a microphone, replace AUIADC with the all-new 3-channel input driver AUI3ADC. Then you can either downmix the data to 2 channels by hand, or alternatively use the FTI3TO2 downmixer driver to automatically downmix the 3 input channels to stereo.
AUI3ADC & FTI3TO2:
viewtopic.php?p=15663
A.2: VS1005 is I2S clock slave
If we are an I2S slave, we will need to synchronize to the incoming data because it will never be exactly the nominal rate. The method I will present here will only work if the I2S sample rate is nominally 48 kHz. It will not work for 44.1, 32, 88.2, or 96 kHz inputs.
There is a S/DPIF driver that modifes the S/PDIF sample rate slightly to adapt to the actual sample rate. However, due to how VS1005's hardware is implemented, this adjustment is made by turning the VS1005's master clock around 61.44 MHz, so it is a pretty intrusive method.
Put this into S:CONFIG.TXT:
AUXI2SS s
AUOSP48S
This will connect the AUXI2SS driver to both file handles stdaudioin and stdaudioout. Then you need to take a file handle to AUOSP48S, and copy also the data to that driver. The code would be something like this:
Code: Select all
#define BUF_SIZE 128
#define LIB_NAME "auosp48s"
s_int16 myBuf[BUF_SIZE];
myfunc(void) {
u_int16 *lib = NULL;
FILE *spfp = NULL;
lib = LoadLibrary(LIB_NAME);
if (!lib) {
printf("Cannot load " LIB_NAME ".DL3 library\n");
goto finally;
}
/* Open */
spfp = (FILE *)RunLoadedFunction(lib, ENTRY_3, 0);
if (!spfp) {
printf("Cannot open " LIB_NAME ".DL3 audio file\n");
goto finally;
}
while ((!(appFlags & APP_FLAG_QUIT)) {
fread(myBuf, sizeof(s_int16), BUFSIZE, stdaudioin);
fwrite(myBuf, sizeof(s_int16), BUFSIZE, stdaudioout);
fwrite(myBuf, sizeof(s_int16), BUFSIZE, spfp);
}
[... etc ...]
B: SPDIF —> I2S&SPDIFB: SPDIF —> I2S&SPDIF
With S/PDIF, we can never control the input sample rate, so we need to be able to adapt to input sample rate variation.
B.1: VS1005 is I2S clock master
A way to do this would be the have this in S:CONFIG.TXT:
AUXSPD s
AUODAC
AUOI2SMA
The AUXSPD driver will adjust VS1005's clock around 61.440 MHz if input sample rate is nominally 48 kHz, and around 56.446 MHz if input sample rate is nominally 44.1 kHz. With this method you would copy samples from stdaudioin to stdaudioout (both connected to AUXSPD), then also copy data to AUODAC's output handle. AUOI2SMA would then automatically copy AUODAC's data to I2S output. Synchronization would be implemented by comparing the sample rate counters of stdaudioin and AUODAC, the adjusting AUODAC's sample rate slightly.
For an example of how to synchronize see how AUOSP48S calculates the newDiff variable in AudioDrivers/AUXSPDIF/auosp48s/auosp48s.c function AuiSpdCyclicFunc().
If this all seems overwhelming, we can help you with implementation after you have decided if you want to go this path.
B.2: VS1005 is I2S clock slave
This would need software synchronization to a level we don't currently have.
C.1: VS1005 is I2S clock masterC: I2S —> I2S&SPDIF
This is a straightforward case. Put this in S:CONFIG.TXT:
AUXI2SM s
AUOSPD
Then use code something like this (very similar to the previous code example):
Code: Select all
#define BUF_SIZE 128
#define LIB_NAME "auospd"
s_int16 myBuf[BUF_SIZE];
myfunc(void) {
u_int16 *lib = NULL;
FILE *spfp = NULL;
lib = LoadLibrary(LIB_NAME);
if (!lib) {
printf("Cannot load " LIB_NAME ".DL3 library\n");
goto finally;
}
/* Open */
spfp = (FILE *)RunLoadedFunction(lib, ENTRY_3, 0);
if (!spfp) {
printf("Cannot open " LIB_NAME ".DL3 audio file\n");
goto finally;
}
while ((!(appFlags & APP_FLAG_QUIT)) {
fread(myBuf, sizeof(s_int16), BUFSIZE, stdaudioin);
fwrite(myBuf, sizeof(s_int16), BUFSIZE, stdaudioout);
fwrite(myBuf, sizeof(s_int16), BUFSIZE, spfp);
}
[... etc ...]
C.2: VS1005 is I2S clock slave
Here we would need to adjust SPDIF output sample rate to the actual I2S sample rate. We don't currently have code to implement this synchronization method.
This is a pretty big ask, we run into even more synchronization issues than before.D: Mic Mixing with all
So, adding microphone to different cases:
A.1: Easy, and presented in the answer.
A.2: Would need new synchronization / resampling code.
B.1: Would need new synchronization / resampling code.
B.2: Would need new synchronization / resampling code.
C.1: Easy, just add AUIADC, it will automatically keep in sync with AUXI2SM.
C.2: Would need new synchronization / resampling code.
So you see that things are definitely much easier if VS1005 acts as the I2S Master.
To not make this answer longer than it already is, let me ask you about your application: how important is the microphone input? Is it something like a karaoke machine where you need to have it active for a long time and really good quality? Or what is its function?
To be exact, Ctrl-C is character code 3, and ESC is 27.Simply sending the charactrer. Its value is 3 or 27. One is esc and other is CTRL-C12. How to send ctrl+c command via UART from microcontroller?
Kind regards,
- Henrik
Good signatures never die. They just fade away.