VS1010 USB I2S ADC

Designing hardware and software for systems that use the VS1010 MP3 Audio DSP Microcontroller.
Hannu
VLSI Staff
Posts: 546
Joined: Mon 2016-05-30 11:54
Location: Finland
Contact:

VS1010 USB I2S ADC

Post by Hannu »

Hello vs1010 users,

I have written a new USB driver. Master I2S to USB as ADC.

Key features are:
  • Low latency: 1 ms from I2S to USB. So I2S ADC and computer side buffering are biggest causes of delays
  • USB audio class 1
  • Pure direct: What ever the I2S is giving, it is passed to USB. No controls to accidentally break the signal.
  • DAC monitor: When Samples are going to USB, they are copied to DAC through DAOSET. (-6dB level), leaving stdaudioout for user programs.
  • Modest resource requirements: I 1151, X 234, Y 172 when example stats program compiled, I 964, X 126, Y 172 without stats.
  • 48kHz 16 bit
The big things are that it is totally interrupt driven. So as long as interrupt load doesn't grow and Disable() times are low, it works. And running own main programs is possible and easy.

I've tested this with Win 10, Linux and Mac. Seems to work.

Code: Select all

usb 3-3: new full-speed USB device number 94 using xhci_hcd
usb 3-3: New USB device found, idVendor=19fb, idProduct=eeed
usb 3-3: New USB device strings: Mfr=1, Product=2, SerialNumber=0
usb 3-3: Product: VS1010d Low-latency USB I2S ADC
usb 3-3: Manufacturer: VLSI Solution
There are in usbadc.h on top of the file two defines. ENABLE_STATS and ENABLE_MONITOR_OUTPUT which control the build of the driver. Comment them out if not needed. If stats aren't needed the driver stays in memory and main() returns.

I left the stats code to this driver so it is easier to debug on different circuit. This is developed on VS1010 developer board.

Code: Select all

Relocked (3007)
Ready
A:          0 l: 252 z:          0 d:          1 B1:          0 B2:          0E0 1
E0 2
E0 3
A:          0 l: 252 z:          1 d:          1 B1:          0 B2:          0E0 9
E0 11
A:          0 l: 252 z:          2 d:          1 B1:          0 B2:          0E0 13
E0 16
A:          0 l: 252 z:          2 d:          3 B1:          0 B2:          0E0 18
A:          0 l: 252 z:         26 d:          5 B1:          0 B2:          0E0 21
A:          0 l: 252 z:         34 d:          6 B1:          0 B2:          0E0 22
A:       3331 l: 252 z:         37 d:          7 B1:       1666 B2:       1665E0 23
A:       3331 l: 252 z:         37 d:          7 B1:       1666 B2:       1665E0 25
E0 28
A:       3331 l: 252 z:         39 d:          7 B1:       1666 B2:       1665E0 31
E0 34
A:       3331 l: 252 z:         40 d:          7 B1:       1666 B2:       1665E0 36
E0 38
E0 40
E0 42
A:       8805 l: 108 z:         42 d:         12 B1:       4403 B2:       4402E0 43
A:       8809 l: 252 z:         44 d:         13 B1:       4405 B2:       4404E0 44
A:      21309 l: 252 z:         53 d:         17 B1:      10655 B2:      10654E0 48
A:      27546 l:  88 z:         53 d:         18 B1:      13774 B2:      13772E0 49
A:      27713 l: 252 z:        421 d:         19 B1:      13857 B2:      13856
A: Audio packets sent to USB
l: Audio buffer pointer
z: count of left and right zero value samples
d: dropped I2S samples
B1 and B2: Buffer usage count.
Lines end with E0 and number. It is count of Endpoint 0 packets.
Attachments
usbadc-2023-02-13.zip
I2S->USB
(123.26 KiB) Downloaded 327 times
shehold
User
Posts: 19
Joined: Tue 2023-01-31 8:51

Re: VS1010 USB I2S ADC

Post by shehold »

VS1010D has enough resources to handle ADC/DAC bidirectional 48k32-bit data?
User avatar
pasi
VLSI Staff
Posts: 2162
Joined: Thu 2010-07-15 16:04

Re: VS1010 USB I2S ADC

Post by pasi »

shehold wrote: Tue 2023-02-28 13:41 VS1010D has enough resources to handle ADC/DAC bidirectional 48k32-bit data?
Yes, vs1010 can do it. There is not anything specially difficult with DAC + ADC in the same USB Audio Device, but the example here is optimized specifically for ADC only (in interrupt-driven fashion).
Visit https://www.facebook.com/VLSISolution VLSI Solution on Facebook
Hannu
VLSI Staff
Posts: 546
Joined: Mon 2016-05-30 11:54
Location: Finland
Contact:

Re: VS1010 USB I2S ADC

Post by Hannu »

Hello everyone,

Here is an minor feature update to low latency USB I2S ADC.

Added feature:
Led connected PWM (GPIO0_0) in three functions:
- Slow dim breath when USB host isn't reading audio.
- Blink on input audio level when USB host is reading audio
- Blink longer and brighter when signal is clipping or near clipping.

This version supports the USB ADC demo board. The blinking led is naturally the pink one.
I2S->USB ADC demo board
I2S->USB ADC demo board
usb_adc board.jpg (212.96 KiB) Viewed 3670 times
Web page for USB ADC board: https://www.vlsi.fi/en/support/evaluati ... apter.html
Attachments
usbadc.dlx
I2S->USB ADC firmware binary
(8.38 KiB) Downloaded 323 times
usbadc-2023-05-12.zip
I2S->USB ADC firmware source code
(39.55 KiB) Downloaded 307 times
shehold
User
Posts: 19
Joined: Tue 2023-01-31 8:51

Re: VS1010 USB I2S ADC

Post by shehold »

When to make a driver that supports 32BIT :lol: :lol: :lol:
Hannu
VLSI Staff
Posts: 546
Joined: Mon 2016-05-30 11:54
Location: Finland
Contact:

Re: VS1010 USB I2S ADC

Post by Hannu »

Two things has to happen:
1) I need to have time for that
2) There has to be a real use case and technical demand for such driver.

Or I need to have a feeling that writing USB audio device would be enjoyable somehow.
shehold
User
Posts: 19
Joined: Tue 2023-01-31 8:51

Re: VS1010 USB I2S ADC

Post by shehold »

Almost all USB AUDIO solutions on the market support at least 24-32bit sampling rates, so 16BIT solutions do not have much market value
User avatar
pasi
VLSI Staff
Posts: 2162
Joined: Thu 2010-07-15 16:04

Re: VS1010 USB I2S ADC

Post by pasi »

Declaring 24-bit and 32-bit sample sizes in the USB Audio descriptor is easy.

However, most of the time 16 bits is already enough to reach the limit of the digital to analog converter. The extra bits can be ignored and the result is exactly the same. Even when using an (external) ADC and/or DAC that work with more than 16 bits, the analog design needs to have high enough performance for the extra bits to matter.

Having 24/32-bit sample sizes does not guarantee actual performance.

But, the world nowadays is a strange place.
Visit https://www.facebook.com/VLSISolution VLSI Solution on Facebook
winwan
Senior User
Posts: 86
Joined: Fri 2014-07-04 15:51

Re: VS1010 USB I2S ADC

Post by winwan »

I have an idea, is to use 1010D to design a recording sound card (similar to USB microphone), only support recording, support 4CH (IIS interface) input, support 48K/16BIT-24BIT. Does this idea work。
Hannu
VLSI Staff
Posts: 546
Joined: Mon 2016-05-30 11:54
Location: Finland
Contact:

Re: VS1010 USB I2S ADC

Post by Hannu »

I2S can give one stereo pair to VS1010. How would you bring the rest of two channels in?

You have SPI, MEMS mic. SAR could do one channel 12-bit. Maybe UART but with very high interrupt load.

Due to clock domains the S/PDIF isn't usable.
Post Reply