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.
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 »

Hannu wrote: Wed 2018-03-21 9:09 ...
In HRTITLE main.c, there is GetMenuItem which calls ButtonPressed. If the button pressed is the power button, just return the poweroff item

Code: Select all

if (lastButton == HRB_NW)return 2;
That should work if I didn't count wrong. That is rather ugly hack but I think does what you wish.
...
doesn't work, PwrBtn work as reset key..
Hannu
VLSI Staff
Posts: 532
Joined: Mon 2016-05-30 11:54
Location: Finland
Contact:

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

Post by Hannu »

The reset function is loaded in CONFIG.TXT.
PwrReset is the driver.

Comment that out and it shouldn't reset then.
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 »

Hannu wrote: Wed 2018-03-21 12:50 The reset function is loaded in CONFIG.TXT.
PwrReset is the driver.

Comment that out and it shouldn't reset then.
YES, It's work!
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 »

Hannu wrote: Wed 2018-03-21 9:09
Real solution would be start progress bar where another power button press should come in later half. All other actions would cancel shutdown. At least that would be my preferred UI. It is irritating when pocket turns the device off.
I agree.

I'm just testing the possibilities to configure HiRes player "another way".

Now I have menu items:

Play Music ( Play D:\Music directory)
Browse Music ( not implemented yet )
Access SD card ( USBMSC D )
Access Flash ( USBMSC S )
Power Off (not needed now)
Dev shell (HRTITLE)

now I'm studying how to correctly reboot the device. Is it right way to use ybitcle/ybitset comands for that?

I
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 »

One more question (sorry :) ):

When I load USBMSC S or USBMSC D from program, Windows can "see" new device, but this device work _very_ slow. When system flash published after reset (EAST button pressed during startup) - disk work well. What am I doing wrong? Is it possible that one driver (SDSDR) competes with another (USBMSC)?
Hannu
VLSI Staff
Posts: 532
Joined: Mon 2016-05-30 11:54
Location: Finland
Contact:

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

Post by Hannu »

For reseting, the answer can be found from our old friend powerreset solution. Take the interrupt handler and see how it handles the watchdog registers and waits for ever. You can write it to your own solution and put it to the main() or just copy as function. Or just poke with ybits the watchdog to reset the chip. in memory budget I believe code could be smaller.

The USB speed... VS1005g is USB Full speed device. 12Mbps -> about 1 megabyte/second.

The SDSDR is read only driver and the boot up USB uses SDSDMONO which is R/W driver. That might be the difference and might give some head ache for windows. And there is easy way to test. Change the SDSDMONO to SDSDR in config.txt and try to access the disk then through boot. Or other way around. Load SDSDMONO in stead of SDSDR.

Also... The S: drive is external flash chip which communicates through SPI and that is compiled straight to kernel.
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 »

mar_tin wrote: Wed 2018-03-21 11:33 Hi technic,

I had that same question, yesterday I found out that you can. This simply works for me:

Code: Select all

RunProgram("PLAYFILE","D:hello.MP3");
...
Thank you, Martin, for your post!
And how do you process the result of a RunProgram call?
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 »

Hannu wrote: Thu 2018-03-22 8:35 For reseting, the answer can be found from our old friend powerreset solution.
Okay, I will try code from 'PowerButton' solution

Code: Select all

void IntReguC(void) {
	vo_stdout = vo_stderr;
	printf("WDRST");
	PERIP(WDOG_CF) = 1;
	PERIP(WDOG_KEY) = 0x4ea9;	
	while(1);
}
The SDSDR is read only driver and the boot up USB uses SDSDMONO which is R/W driver. That might be the difference and might give some head ache for windows. And there is easy way to test. Change the SDSDMONO to SDSDR in config.txt and try to access the disk then through boot. Or other way around. Load SDSDMONO in stead of SDSDR.
config.txt from HiRes Player looks like (without comments):

Code: Select all


[0]
###>>PwrReset
HRHW
ShellEnv
run SETPIN 22,1
SDSDR
AUODAC s
RUN YBITCLR FC00,D
RUN YBITCLR FC00,C
RUN auoutput -l-12 -s8192
LCD177HR
unifont2 s:sys/unifont.dat
run SetClock -v -l100 
run SetClock -v 92
UARTIN
run auoutput -l-12
run hrtitle2
S:SHELL.AP3
....
My modifications is:
###>> PwrReset
and
run hrtitle2

where hrtitle2 is modified HRTITLE solution.

Hannu,
Do I understand correctly that I should try instead of SDSDR load SDSDMONO?
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 »

reset function work for me,

I added a few lines of code in main.c

Code: Select all

		if (lastButton == 5) {
			vo_stdout = vo_stderr;
			printf("WDRST");
			PERIP(WDOG_CF) = 1;
			PERIP(WDOG_KEY) = 0x4ea9;
			while(1);
		}
Menu Items:
0 Play Music
1 Browse Music
2 SD card
3 System flash
4 Power Off
5 Reset
Hannu
VLSI Staff
Posts: 532
Joined: Mon 2016-05-30 11:54
Location: Finland
Contact:

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

Post by Hannu »

technic wrote: Thu 2018-03-22 12:56
Hannu,
Do I understand correctly that I should try instead of SDSDR load SDSDMONO?
You could try that and test if the speed changes. If there are noticeable differences, then it should be feasible to change the driver during running the USBMSC. Have a look in Readme.txt document SDSD solution in RootAndSourceCode package about different SD-card drivers. Actually SDSD might be the best driver with write access.

The idea behind using SDSDR is the code size reduction when all the writing stuff to SD card is left out, more memory is available for codecs.

However I wonder how do you detect USB disconnection? The ending condition must be thought over. APP_FLAG_QUIT isn't good for it as you can't sen ctrl-c to it.

Anyway, test how to get the best USB performance and let's solve the rest of the problems after that.
Post Reply