VS1005 Hi-Res Player (March 2017 Demo) source code

Discussion about writing software for VS1005 and the VSOS Operating System. Also posts about VS1005-related hardware design and device drivers should be posted here.
Post Reply
User avatar
Panu
VLSI Staff
Posts: 2512
Joined: Tue 2010-06-22 13:43

VS1005 Hi-Res Player (March 2017 Demo) source code

Post by Panu » Tue 2017-06-06 19:12

Dear VS1005 users,

Here's the source code of the March 2017 demo version of VS1005 Hi-Res player.
IMG_2173_HIRES.JPG
IMG_2173_HIRES.JPG (287.66 KiB) Viewed 1206 times
If you have questions on how to use it, please reply here.

-Panu
Attachments
HiresPlayerMaster_source_and_root_Demo2017March.zip
Hi-Res Player, demo version, source code and flash root image.
(3.25 MiB) Downloaded 78 times
Info: Line In and Line Out, VS1000 User interface, Overlay howto, Latest VSIDE, MCU Howto, Youtube
Panu-Kristian Poiksalo, VLSI Solution Oy

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

Re: VS1005 Hi-Res Player (March 2017 Demo) source code

Post by Panu » Thu 2017-09-07 9:01

Kitano8 wrote:Hello, this is an interesting project. How is your production going? I would like to try its performance. best regards
Hi!

If you like, you can be in contact with our distributors or you can ask a more specific question here.

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

technic
Senior User
Posts: 47
Joined: Mon 2017-11-20 10:23

Re: VS1005 Hi-Res Player (March 2017 Demo) source code

Post by technic » Tue 2018-02-06 12:58

Is this the right place to ask questions about Hi-Res player?
I just got this device. Thank you, VLSI team, for nice device.
Player work well. I tested mp3, ogg, flac, wav files from sd card - no problems, perfect sound.

Where can I find more Hi-Res player documentation (hardware/software/programming)?
For example, how to connect to PC with VSIDE, how to upgrade VSOS, how to load patches, etc...

User avatar
Henrik
VLSI Staff
Posts: 1101
Joined: Tue 2010-06-22 14:10

Re: VS1005 Hi-Res Player (March 2017 Demo) source code

Post by Henrik » Wed 2018-02-07 12:54

Hello Technic!
technic wrote:
Tue 2018-02-06 12:58
Is this the right place to ask questions about Hi-Res player?
It certainly is!
I just got this device. Thank you, VLSI team, for nice device.
Player work well. I tested mp3, ogg, flac, wav files from sd card - no problems, perfect sound.
Glad you're happy!
Where can I find more Hi-Res player documentation (hardware/software/programming)?
Panu, the author of the player is out of office today, so he can't answer to you now, but I'll take the other questions.
For example, how to connect to PC with VSIDE, how to upgrade VSOS, how to load patches, etc...
Panu has created some nice YouTube videos that show how to do upgrade VSOS and how to load update your own applications to the VS1005 Boards. See videos #001 and #002 on our YouTube channel:
http://www.youtube.com/channel/UCATOzqz ... ity_view=3

As for patches, they are built into VSOS, so unlike with e.g. VS1053, you don't need to load them separately.

Kind regards,
- Henrik
Good signatures never die. They just fade away.

technic
Senior User
Posts: 47
Joined: Mon 2017-11-20 10:23

Re: VS1005 Hi-Res Player (March 2017 Demo) source code

Post by technic » Wed 2018-03-07 10:38

Thank you for answer!

I plan on the basis of a HiRes player PCB to make a mp3-player (as gift for my wife). Here's how he might look (many thanks for my brother for design and sketches):
vs1005hrp01.jpg
vs1005hrp01.jpg (172.76 KiB) Viewed 642 times
vs1005hrp02.jpg
vs1005hrp02.jpg (145.03 KiB) Viewed 642 times
vs1005hrp03.jpg
vs1005hrp03.jpg (153.26 KiB) Viewed 642 times
vs1005hrp04.jpg
vs1005hrp04.jpg (179 KiB) Viewed 642 times
Is it possible to ask your help for software writing? I'm not professional programmer, but I have microcontrollers programming experience (PIC, AVR, TI). VSIDE is new tool for me :)

I plan to implement basic functionality:
Play file from SD
Play directory from SD (alphabetically order)
Download/uplad songs to SD via USB

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

Re: VS1005 Hi-Res Player (March 2017 Demo) source code

Post by Hannu » Thu 2018-03-08 9:31

Hello!

Your brother has done very nice design on the enclosure.
Just a few thoughts. Those buttons look quite much capacitive touch buttons. If you plan to use them, you need some kind of key lock and reader for them. Otherwise they will trigger all the time in the pocket. And the original board won't work with capacitive buttons. But if those are intended as key caps, they are OK.

The display part in the UI in your sketch is quite much designed for touch screen phone. The display which comes with player isn't one.

Near the bottom end is the 4-pin UART connector. When developing software, you might want to have access for it. So make the enclosure openable or close it after you are sure everything is done right.

And speaking of software, you had quite short list and I have strong belief that you can put check marks on almost every line. I'm not sure if the play directory alphabetically is implemented.

VSIDE is quite nice environment. When board is connected with USB and UART, make code change, reset VS1005 with S1 pressed, hit F7 on keyboard, unmount the disk, reset the VS1005 and try the application. Unfortunately, XRESET signal isn't the easiest to access on hi-res player.

Here is link to getting started document: http://www.vlsi.fi/fileadmin/app_notes/ ... tarted.zip It is for written for developer board but I believe it can help. And as usual we are here to help with the problems.

technic
Senior User
Posts: 47
Joined: Mon 2017-11-20 10:23

Re: VS1005 Hi-Res Player (March 2017 Demo) source code

Post by technic » Thu 2018-03-08 11:54

Thank you, Hannu, for answer.
Hannu wrote:
Thu 2018-03-08 9:31
Just a few thoughts. Those buttons look quite much capacitive touch buttons. If you plan to use them, you need some kind of key lock and reader for them. Otherwise they will trigger all the time in the pocket. And the original board won't work with capacitive buttons. But if those are intended as key caps, they are OK.
Buttons looks like touch, but actually this buttons are only key caps
The display part in the UI in your sketch is quite much designed for touch screen phone. The display which comes with player isn't one.
Picture on display is not real applications interface, this picture are for example only (screenshot from mobile phone player).
Near the bottom end is the 4-pin UART connector. When developing software, you might want to have access for it. So make the enclosure openable or close it after you are sure everything is done right.
Yes, it is possible to open enclosure to change SD card or connect to UART
VSIDE is quite nice environment. When board is connected with USB and UART, make code change, reset VS1005 with S1 pressed, hit F7 on keyboard, unmount the disk, reset the VS1005 and try the application. Unfortunately, XRESET signal isn't the easiest to access on hi-res player.

I have some kind of "developer board" for HiRes Player (selfmade (by my brother too) pcb with pci slot) for development:
hiresdev02.jpg
hiresdev02.jpg (1.6 MiB) Viewed 625 times
hiresdev01.jpg
hiresdev01.jpg (1.62 MiB) Viewed 625 times
I can access any signal from HiResPlayer connector on this "developer board"
Here is link to getting started document: http://www.vlsi.fi/fileadmin/app_notes/ ... tarted.zip It is for written for developer board but I believe it can help. And as usual we are here to help with the problems.
Thank you for help! I'll try to make first step.

P.S. 2018-04-18 Update:
There is post about Hi-Res Player enclosure and "devboard":
viewtopic.php?f=9&t=2238
Last edited by technic on Wed 2018-04-18 12:21, edited 1 time in total.

technic
Senior User
Posts: 47
Joined: Mon 2017-11-20 10:23

Re: VS1005 Hi-Res Player (March 2017 Demo) source code

Post by technic » Thu 2018-03-08 11:59

One more question:
Can you explain directory structure in archive "HiresPlayerMaster_source_and_root_Demo2017March.zip"?

Which file/directory is "main"?

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

Re: VS1005 Hi-Res Player (March 2017 Demo) source code

Post by Hannu » Thu 2018-03-08 13:15

First there is directory root which is the system disk root (external SPI flash) and there is the file config.txt This file configures what drivers are loaded.
The option [0] is no butttons pressed boot. Last lines are run hrtitle and then it loads shell

The main.c for hrtitle is in HRTITLE directory and in main() function there is screen setup and reading buttons. It executes other programs. So this is the place where to start figuring out how the system works.

So if you want enable spdifout you just add the line

Code: Select all

AUOSPDA v
before before hrtitle. If you want to run your own program, prepend the name with command run yourprog and in startup s:sys/yourprog.dl3 is executed

So in VS1005 there is no single main() function , but a nice operating system which makes many things much easier.

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

Re: VS1005 Hi-Res Player (March 2017 Demo) source code

Post by Panu » Thu 2018-03-08 13:29

The project consists of several drivers and libraries, which are compiled in separate directories. Each has a .SOLUTION file that can be opened in VSIDE to edit and recompile that library. It's probably a good idea to use a VSIDE version from around March 2017.

To understand the structure, please take a look at some of the key lines in root/config.txt:

Code: Select all

# CONFIG.TXT - VSOS3 Boot Configuration File //I've added comments like this
PwrReset                    // Power button reset handler
HRHW                        // HiRes Player Hardware Driver (buttons, battery)
run SETPIN 22,1
SDSDR                       // SD card driver
AUODAC s                    // DAC driver
RUN auoutput -l-12 -s8192
LCD177HR                    // LCD hardware driver
unifont2 s:sys/unifont.dat  // Unifont font support
run SetClock -v -l100 92
UARTIN                      // UART driver
run auoutput -l-12
run hrtitle                 // Hires Player Main Menu
The config.txt file is executed by the VSOS kernel upon boot. There you will see that it loads different drivers, such as HRHW to handle the battery and push-buttons, SDSDR to handle the SD card, LCD177HR to handle the LCD. And finally it starts HRTITLE, which is the hires player main menu. That then calls other libraries to do different things.

This is to save memory. Some of the HiRes codecs require a lot of memory to run, so only the bare minimum of libraries is loaded during playing.

If you take a look at the Main Menu solution, "HRTITLE", in HRTITLE's main.c you can find the contents of the menu:

Code: Select all

struct MenuItemStruct menuItems[] = {
	{0, "Play SD Root Dir",    "HRCORE", "D:*" },
	{1, "Play D:\\Music\\*",   "HRCORE", "D:MUSIC/*" },
	{2, "Power Off",           "POWEROFF", "" },
	{4, "Update from SD",      "D:UPDATE.AP3", "" },
	{5, "Update from UART/VSIDE", "VS3EMUC", "" },
	{6, "UART Console Debug",  "S:SHELL.AP3", "" },
	{0, ""}
};
This specifies just a list of other programs to run. HRCORE is the player core, which is very simple again to save memory:

Code: Select all

ioresult main(char *parameters) {
	ioresult hresult = S_OK;

	vo_stdout = vo_stderr;
	strcpy(hrCore.fileSpec,"D:HIRES/*"); /**/
	if (parameters[1]==':') strcpy(hrCore.fileSpec,parameters);
		
	strcpy(currentDirectory, hrCore.fileSpec);
	currentDirectory[strlen(currentDirectory)-1] = '\0';
	hrCore.lastSongNumber = RunLibraryFunction("DIR",ENTRY_1,(int)playVector);
	
	while (hresult == S_OK) {		
		if (S_OK != RunLibraryFunction("HROPEN",ENTRY_1,(int)&hrCore)) break;
		hresult = RunLibraryFunction("HRPLAY",ENTRY_1,(int)&hrCore);			
	}
	return S_OK;
}
It just basically sets up the current directory and then alternates between two programs: File selector (HROPEN) and player proper (HRPLAY) until there is no file left to play.

Code: Select all

	while (hresult == S_OK) {		
		if (S_OK != RunLibraryFunction("HROPEN",ENTRY_1,(int)&hrCore)) break;
		hresult = RunLibraryFunction("HRPLAY",ENTRY_1,(int)&hrCore);			
	}
This should give you an idea of the player's structure. HROPEN opens the file to be played and also draws the song information to the LCD screen. HRPLAY setus up a cyclic task to read buttons and then loads and calls a decoder library to play the music.

HRCORE contains a core memory structure, which has the filespec of files to be played (something like "D:MUSIC/WhatEverAlbum/*" and the number of the current song to be played, as well as the FILE pointer to the file to be played. This is always loaded in memory so that each of the programs knows which file they should be handling.

-Panu

PS. Very Nice Motherboard! A LOT nicer than the one I have! :D I'm a little jealous actually :D !
Info: Line In and Line Out, VS1000 User interface, Overlay howto, Latest VSIDE, MCU Howto, Youtube
Panu-Kristian Poiksalo, VLSI Solution Oy

Post Reply