MCUdude / SigmaDSP

A versatile Arduino library for interfacing with the ADAU1401, ADAU1701 and ADAU1702 audio DSPs
GNU Lesser General Public License v3.0
165 stars 33 forks source link

demux #18

Closed ara9329 closed 3 years ago

ara9329 commented 3 years ago

Hey great work I love to work with it at the moment with an ttgo t-display and a adau1701 as preamp xover eq 3d volume and input select MUX works perfect.

i am struggling with the demux syntax its 1 2xn so 2 in 3 out

 dsp.demux(MOD_2XN_1_ALG0_STEREODEMUXSLEW10_ADDR, 1, 4); 
    dsp.demux(MOD_2XN_1_ALG0_STEREODEMUXSLEW11_ADDR, 0, 4);
    dsp.demux(MOD_2XN_1_ALG0_STEREODEMUXSLEW12_ADDR, 0, 4);

Can you explain howto use the parameters?

Thanks

MCUdude commented 3 years ago

Can you post a screenshot so I can see what the mux looks like in the SigmaStudio GUI. IIRC there are two types of demuxes that need to be controlled in two separate ways. One with index, another one without.

ara9329 commented 3 years ago

preamp

ara9329 commented 3 years ago

Thanks for reacting so fast

MCUdude commented 3 years ago

I don't have a Windows computer at hand, so I can't help you directly by looking at the SigmaStudio project file.

However, if you look at the SigmaStudio capture window you'll see that there are probably several registers changing when you change the demux state. This is the SigmaDSP::demux function:

https://github.com/MCUdude/SigmaDSP/blob/3b2f61dc13eeb872a248c108a01451be624b24c0/src/SigmaDSP.cpp#L102-L117

I'll assume you'll refer to the one with three possible combinations, all the way to the right. This one has three indexes, not four. If you look in the capture window after you've compiled, you can see that it sends a sequence of three bytes depending on which position is set.

I'll guess the syntax would be something like dsp.demux(start_address, 1, 3); to select the middle one of the three.

ara9329 commented 3 years ago

thanks again:

Ill give another try although I think ive tried that already.

ara9329 commented 3 years ago

void chng_output(int t){ //change output channel switch (t){ Serial.print("output t =");Serial.println(t); case 0: //AN1 dsp.demux(MOD_2XN_1_ALG0_STEREODEMUXSLEW10_ADDR, 1, 3); Serial.println("dsp=1"); break; case 1: //AN1 dsp.demux(MOD_2XN_1_ALG0_STEREODEMUXSLEW10_ADDR, 1, 3); Serial.println("dsp=2"); break; case 2: //DAC1 dsp.demux(MOD_2XN_1_ALG0_STEREODEMUXSLEW10_ADDR, 2, 3); Serial.println("osp=3"); break;
} This what i have tried i hear output when downloaded when the output is changed i can hear the slew but when selecting the first again I do not get the output back

ara9329 commented 3 years ago

I have made a copy of your volume example and changed it for testing de Demux volume_demux.zip