This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

PurePath Mono Mux question



I am having some trouble using the Mono Mux component. PurePath publishes the I2C Interface

as Page 44, register 8. When I look at the generated driver I see it is using a 24 bit number to select

the input ( address 10 holds the selection). The Mux. Help says that this interface is a 32 bit number,

possibly shifted 1bit, it is a little unclear. What I am seeing is that I can set the input at compile time

through PurePath Studio. And I can also set the input at run time using a 24 bit number. But about 10ms

after the DSP init. I lose access to the mux. I am thinking that I am not writing  the wrong value because

the mux help says that "MuxSelect values outside the indicated range will result in a data ouput of zero".

And what I see is multiple selections working until 10 ms after the PPS driver gets loaded with the last

selection not changing. Any help would be appreciated.

Thanks

  • Bruce,

    See image below. You can always use the memory tool to verify the data that should be written to the coefficient memory.

    Regards,

    J-

  • Hello,  and all...


    why am I not permitted to look at the picture?

    I want to control mono mux using an Arduino SPI control.

    I did use below pseudo code but failed:

    void loop(){

    controlmux(0x00,0x30,0x2C,0x00000001);

    }//end loop

    void controlmux(byte PageSelectionRegister,byte I2CRegister,byte I2CPage,unsigned long muxcoeff){
    digitalWrite(SS, LOW);
    SPI.transfer(PageSelectionRegister<<1);
    SPI.transfer(I2CPage);
    digitalWrite(SS, HIGH);

    digitalWrite(SS, LOW);
    SPI.transfer(I2CRegister << 1);
    SPI.transfer(muxcoeff>>24);
    SPI.transfer(muxcoeff>>16);
    SPI.transfer(muxcoeff>>8);
    SPI.transfer(muxcoeff&0xff);
    digitalWrite(SS, HIGH); // disable Slave Select
    }

    please help me?

    Thanks and Best Regards,
    kal

  • Hi Kal,

    The device coefficients are 24-bit. The register space is 32-bit, in which the coefficients are left aligned. You can fix your code two ways:

    1. Only send first 3 leftmost bytes of the 32-bit muxcoeff.

    SPI.transfer(I2CRegister << 1);
    SPI.transfer((muxcoeff>>16)&0xFF);
    SPI.transfer((muxcoeff>>8)&0xFF);
    SPI.transfer(muxcoeff&0xFF);
    SPI.transfer(0x00);

    2. Shift muxcoeff to the left:

    muxcoeff = muxcoeff << 8;

    Regards,

    J-

    0x5468616E6B7321

  • Hi J Arbona, Thanks for the reply.

    The result was a great success!

    what I did as per pseudo code below with my own SPI write library ,

    byte data1[] = {0x00,0x00,0x01};
    byte data2[] = {0x00,0x00,0x02};

    void loop(){
    delay(2000);
    dsp.SPIwrite(0x00,0x2C); //select page
    dsp.SPIwriteCoeff(0x30,data1,3); //write data of mux selection to register.
    dsp.SPIwrite(0x01,0x05);//switch buffers

    delay(2000);
    dsp.SPIwrite(0x00,0x2C); //select page
    dsp.SPIwriteCoeff(0x30,data2,3); //write data of mux selection to register.
    dsp.SPIwrite(0x01,0x05);//switch buffers

    }

    /********************library*************************/
    void Dsp::SPIwrite(byte first,byte second){
    digitalWrite(SS, LOW);
    SPI.transfer(first<<1);
    SPI.transfer(second);
    digitalWrite(SS, HIGH);
    }

    void Dsp::SPIwriteCoeff(byte Register,byte* data,byte length){
    digitalWrite(SS, LOW);
    SPI.transfer(Register<<1);
    for(byte c = 0; c < length; c++){
    SPI.transfer(data[c]);
    }
    digitalWrite(SS, HIGH);
    }
    /********************library*************************/

    simplify algo:

    1. select page.

    2. write data of mux selection to register.

    3. switch buffer.

    4. repeat 1.

    Hope it helps others too.

    Thanks again J,

    Best regards,
    kal
  • kal,

    Thanks for following up!

    Regards,

    J-