vs1005 vos366 main.c

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.
winwan
Senior User
Posts: 87
Joined: Fri 2014-07-04 15:51

vs1005 vos366 main.c

Post by winwan »

line 410-412

Code: Select all

// Optional: Activate 1-bit digital sound output (pins GPIO2.1 and GPIO2.2)
 	// GpioSetAsPeripheral(0x21); //1-bit Digital Out
	// GpioSetAsPeripheral(0x22); //1-bit Digital Out
What do these two pieces of code mean? What format is the output 1bit data? Is it DSD L/R?
If I activate SRC function, pin52 BCK, pin32-3 L/R is also SRC sample rate synchronous output
Hannu
VLSI Staff
Posts: 561
Joined: Mon 2016-05-30 11:54
Location: Finland
Contact:

Re: vs1005 vos366 main.c

Post by Hannu »

Thank you for a code review. Please tell if you find something which seems broken.

Code lines: Some stale comments which should receive ^k, ^k and ^k. Totally wrong place for them to exist. Even as comments.

Those pins are 6.144 MHz digital signals from DAC. The clock is available on GPIO1_15.

If you hook up RC-filter to those digital signals, you'll reconstruct the analog signal. But why would you do that because you already have a better analog output on the chip.

Another option to use those pins, would have two VS1005 synchronized to same XTALI and feed to DIA input. I haven't tested that.

I think DSD has base frequency of 44.1 kHz so I wouldn't call that DSD either.

So. What do you want to do those signals?
winwan
Senior User
Posts: 87
Joined: Fri 2014-07-04 15:51

Re: vs1005 vos366 main.c

Post by winwan »

I want to connect to an external DAC. Is this data converted from I2S? Is it a fixed sampling rate? Is a driver needed in the system (is it a software component or hardware component)

If this feature is enabled, does it consume CPU resources
Hannu
VLSI Staff
Posts: 561
Joined: Mon 2016-05-30 11:54
Location: Finland
Contact:

Re: vs1005 vos366 main.c

Post by Hannu »

For I2S use I2S.

Have a look at https://www.vlsi.fi/fileadmin/software/ ... _Audio.pdf and select correct driver for your application. Also roots and sources package which can be found from kernel thread has the solutions directory and projects in there have README.TXT.

Loading auoi2sma from contfig.txt or with
driver +auoi2sma s

is the cheapest driver as everything which goes to stdaudioout, goes to DAC and I2S. Naturally auodac has to be loaded with s to hook up with stdaudioout.
winwan
Senior User
Posts: 87
Joined: Fri 2014-07-04 15:51

Re: vs1005 vos366 main.c

Post by winwan »

I used a new board today to try to verify the 1-bit Digital Out interface, and the result was no DCK signal, I received GPIO1-15

Code: Select all

	// Optional: Activate 1-bit digital sound output (pins GPIO2.1 and GPIO2.2)
 	 GpioSetAsPeripheral(0x21); //1-bit Digital Out
	 GpioSetAsPeripheral(0x22); //1-bit Digital Out
I turned on the function of the two IO ports and found that there was data output, but no DCK.
I executed two instructions

Code: Select all

driver +auodac s
sine 3000 0 0
Earphone signal output sine wave normally,
Hannu
VLSI Staff
Posts: 561
Joined: Mon 2016-05-30 11:54
Location: Finland
Contact:

Re: vs1005 vos366 main.c

Post by Hannu »

You didn't enable the GPIO1_15 clock. It is still in GPIO mode. And accessing for example SPI flash will probably put it also back to GPIO mode.

But what are you going to connect those pins? I'm not aware of any chip which would support the format. It isn't I2S and for DSD it is on the wrong frequency 48 kHz * N vs. 44.1 kHz * N.

Connect your external DAC to I2S load the driver. That is proven to work.
winwan
Senior User
Posts: 87
Joined: Fri 2014-07-04 15:51

Re: vs1005 vos366 main.c

Post by winwan »

How do I enable the clock function for GPIO1_15?
Hannu
VLSI Staff
Posts: 561
Joined: Mon 2016-05-30 11:54
Location: Finland
Contact:

Re: vs1005 vos366 main.c

Post by Hannu »

You put it to peripheral mode. However any HW access will reset it. So put your code to own program and load it last if you really want to play with this feature.
winwan
Senior User
Posts: 87
Joined: Fri 2014-07-04 15:51

Re: vs1005 vos366 main.c

Post by winwan »

I tried it and it didn't seem to work

Code: Select all

GpioSetAsPeripheral(0x15); 
Hannu
VLSI Staff
Posts: 561
Joined: Mon 2016-05-30 11:54
Location: Finland
Contact:

Re: vs1005 vos366 main.c

Post by Hannu »

Hannu wrote: Mon 2023-10-30 10:50 And accessing for example SPI flash will probably put it also back to GPIO mode.
Hannu wrote: Mon 2023-10-30 13:28 However any HW access will reset it. So put your code to own program and load it last if you really want to play with this feature.
Any library load and access to iochannel features will reset the pin back to GPIO. Write a small program which is loaded last.

Features of the program:
First load paramspl to memory with LoadLibrary(), then load sine. Set the pins to perip mode and call main() from sine program with unLibraryFunction(lib, ENTRY_MAIN, (int)params). That way you get around the HW access restriction. if you aren't running anything extra.
Post Reply