xCORE-AUDIO Hi-Res DAC/HPA Platform Hardware(DAC) volume Topic is solved

Sub forums for various specialist XMOS applications. e.g. USB audio, motor control and robotics.
russwyte
Junior Member
Posts: 6
Joined: Mon Dec 05, 2016 9:42 pm

xCORE-AUDIO Hi-Res DAC/HPA Platform Hardware(DAC) volume

Post by russwyte »

I would like to utilize xcore audio in a new design - optimally it would expose hardware level volume control (done via I2C commands to the DAC) expose via UAC2.

I see there are events for various format changes etc.. but none for volume change... I am curious why?

Can this be done without custom firmware? It seems it would be fair easy to add this functionality and have very high value to people designing xcore audio solutions.

Can anyone point me in the right direction?

Cheers!
Russ


View Solution
Choughtosh
Member++
Posts: 22
Joined: Thu Apr 10, 2014 9:39 am

Post by Choughtosh »

Hi Russ,

Have you looked at the using xCORE-200 and the USB device reference design?

The USB design guide describes the features (https://www.xmos.com/download/private/s ... ha1%29.pdf).

You may be able to adapt the design to suit your needs.

Rob
User avatar
infiniteimprobability
XCore Legend
Posts: 1126
Joined: Thu May 27, 2010 10:08 am
Contact:

Post by infiniteimprobability »

Hi Russ,
the xCORE-AUDIO device is fixed function (and lower cost) device with limited customisation. As Choughtosh suggests, you can drop in one of the standard xCore 200 devices and use our royalty free USB Audio reference design (supplied as source) and customise to your heart's content.

Actually, the standard reference design also uses digital gain (rather than I2C commands) but you could certainly modify this so that the endpoint zero request to change volume sent an I2C command to the DAC. This is arguably a better way of doing it, if your DAC supports it, because you may get nice step-less change and don't lose dynamic range at lower volumes.
russwyte
Junior Member
Posts: 6
Joined: Mon Dec 05, 2016 9:42 pm

Post by russwyte »

infiniteimprobability wrote:Hi Russ,
the xCORE-AUDIO device is fixed function (and lower cost) device with limited customisation. As Choughtosh suggests, you can drop in one of the standard xCore 200 devices and use our royalty free USB Audio reference design (supplied as source) and customise to your heart's content.

Actually, the standard reference design also uses digital gain (rather than I2C commands) but you could certainly modify this so that the endpoint zero request to change volume sent an I2C command to the DAC. This is arguably a better way of doing it, if your DAC supports it, because you may get nice step-less change and don't lose dynamic range at lower volumes.
Well if you do a rev. 2 of this device that would be a killer option and would be what would convince me to use it in my modules. For now I have a bit simpler and lower cost solution than using the raw xCore 200 design.

This seems like such a simple option to add - it would make the device far more appealing.
russwyte
Junior Member
Posts: 6
Joined: Mon Dec 05, 2016 9:42 pm

Post by russwyte »

Thanks - very cool! I will take a look today.
russwyte
Junior Member
Posts: 6
Joined: Mon Dec 05, 2016 9:42 pm

Post by russwyte »

Oh the other benefit BTW is that it will work for DSD and DSD via DoP as well as PCM.
User avatar
infiniteimprobability
XCore Legend
Posts: 1126
Joined: Thu May 27, 2010 10:08 am
Contact:

Post by infiniteimprobability »

Oh the other benefit BTW is that it will work for DSD and DSD via DoP as well as PCM.
Indeed - digital volume control will not behave nicely with either DSD or DoP.. The DAC will handle it properly though.

The way the architecture works at the moment is that, during stream/sr changes, I2S stops and audio_hw.xc is called which makes the necessary changes to GPIO and DAC. This generally means I2C accesses too during changes. It means that I2C is called from the core doing I2S and consequently interrupts I2S streaming. This is fine during SR changes and saves on core usage..

So to make this work without interrupting I2S, you need to call I2C from a different core than I2S. It obviously has to be on the same tile as I2S because that's where the physical pins for the I2C master are. If you have a two tile system, you will need a slave task (core) somewhere on the the I2S tile to take a request to do an I2C transaction. If a single tile system, then you will be able to just call the i2c write function from EP0 (you can nak endpoint 0 for up to a second I think). The best place to intercept the volume changes will be from audiorequest.xc (which is part of the endpoint0 task) around here:

Code: Select all

  switch( unitID )
        {
            case FU_USBOUT:
            {
That is where you would either call i2c write or send a message to the remote i2c server.

Make sure you use the following i2c library:

Code: Select all

module_i2c_shared
I think it is used by default, but it handles locking of the i2c resource during calls from multiple clients.

There's a little bit of work here but it all feels feasible.
User avatar
Ross
XCore Expert
Posts: 962
Joined: Thu Dec 10, 2009 9:20 pm
Location: Bristol, UK

Post by Ross »

Re: volume control in DAC and DSD volume control in DAC.

It all depends on the DAC, some just have basic digital volume control

DSD volume control can just be digital after DSD->PDM conversion

Case in point, WM8742

You should consult the data sheet of your DAC.
russwyte
Junior Member
Posts: 6
Joined: Mon Dec 05, 2016 9:42 pm

Post by russwyte »

Ross wrote:Re: volume control in DAC and DSD volume control in DAC.

It all depends on the DAC, some just have basic digital volume control

DSD volume control can just be digital after DSD->PDM conversion

Case in point, WM8742

You should consult the data sheet of your DAC.
Sure this is true. I am aware of that point and I wouldn't care to use WM8742 for this app :) - but it is nice to at least have the option for those DACs (like ESS) which do support it very well - even the DAC on XMOS' own module could do a far better job of volume control vs doing it at the processor for a number of reasons most of which have already been mentioned.
diyinhk
Junior Member
Posts: 7
Joined: Mon Dec 26, 2016 10:06 am

Post by diyinhk »

it is really an important feature for bit perfect lossless audio playback from the DAC chip,
I do not know why it seems got less than normal attention in the audiophile world,
it was on the highest priority and my engineer has done it since two year ago.
Post Reply