connecting TDA1543 DAC - I2S protocol

Hi...

i'm trying to operate a philips TDA1543 DAC (http://www.datasheetcatalog.org/datasheet/philips/TDA1543.pdf), but i can't seem to get it working.
the DAC uses an I2S protocol, and therefore i cannot use the wire library.

has anyone tried this before? i've searched the forum and the internet, but i wasn't able to find a working solution.

I am using a Maple mini board (Maple | LeafLabs) which is almost identical to an arduino program-wise, except that it runs at 72 MHz, so hopefully it will be able to handle the interrupt routine.

i worked on this program, but it doesn't work...

int Rate = 10/32/16/2;   //16 interrupts=1 channel... 2 channels= 1 step... 32 steps = 1 wavePeriod     
                         // frequency=milliseconds/16/32/2 --> 1KHZ=1/16/32/2
                         // calls interrupt at aprox 1 MHz, which i hope a 72 MHz 32 bit microcontroller can handle

volatile int bck=30;  //bit clock pin
volatile int data=27; //data pin
volatile int chan=25;  //channel select pin

volatile byte pos=16;
volatile byte channel=0;
volatile byte k=16;

volatile unsigned int table[32];

void setup()
{
    arraysetup();
    
    // Setup Timer
    Timer2.setChannel1Mode(TIMER_OUTPUTCOMPARE);
    Timer2.setPeriod(Rate); // in microseconds, sets the interrupt call rate
    Timer2.setCompare1(1); // overflow might be small
    Timer2.attachCompare1Interrupt(Clock_Out);
}

void arraysetup(void){
  table[0]=127;  // Put 32 step 8 bit sine table into array.
  table[1]=152;
  table[2]=176;
  table[3]=198;
  table[4]=217;
  table[5]=233;
  table[6]=245;
  table[7]=252;
  table[8]=254;
  table[9]=252;
  table[10]=245;
  table[11]=233;
  table[12]=217;
  table[13]=198;
  table[14]=176;
  table[15]=152;
  table[16]=128;
  table[17]=103;
  table[18]=79;
  table[19]=57;
  table[20]=38;
  table[21]=22;
  table[22]=10;
  table[23]=3;
  table[24]=0;
  table[25]=3;
  table[26]=10;
  table[27]=22;
  table[28]=38;
  table[29]=57;
  table[30]=79;
  table[31]=103;
  
  for (int i=0;i<32;i++)
  table[i]=map(table[i],0,255,0,65535); //8 bit to 16 bit conversion
}


void loop() {
  
}

void Clock_Out(void) {    
    digitalWrite(bck, LOW);   // bck = Bit Clock pin    
    pos--;
    digitalWrite(data, !!(table[k] & (1 << pos)));   //data= data output pin , Outputs each single bit (MSB)
    
    if (pos=0) {     //when all bits are sent it switches channel
      pos=16;
      channel ^=1;
      digitalWrite(chan, channel); //chan= channel select pin (HIGH = right channel)
      
      if (channel==1) {  //when both channels are set it selects the next array
        k++;
      if (k=32) k=0;
    }   
   
      digitalWrite(bck, HIGH);   //brings the clock HIGH when all data is sent
}
}

any suggestions?

int Rate = 10/32/16/2;   //16 interrupts=1 channel... 2 channels= 1 step... 32 steps = 1 wavePeriod

10/32 = 0
0/16 = 0
0/2 = 0
So, Rate = 0.

Never aeen any implementation of I2S on arduino yet !!

PaulS:

int Rate = 10/32/16/2;   //16 interrupts=1 channel... 2 channels= 1 step... 32 steps = 1 wavePeriod

10/32 = 0
0/16 = 0
0/2 = 0
So, Rate = 0.

oh... it didn't give me any compile errors, so i just assumed that it worked on decimals too (eg. rate=0.5, the interrupt was called twice per millisecond).
ok i'll fix that, try it and see how it works...
thanks

There are a couple of problems in this bit of code:

    digitalWrite(data, !!(table[k] & (1 << pos)));   //data= data output pin , Outputs each single bit (MSB)
    
    if (pos=0) {     //when all bits are sent it switches channel
      pos=16;

when pos is 16, 1<<pos will equal zero. You need to initialize pos to 15. I would also change the way that you select the bit in digitalWrite. Finally, "if(pos=0)" doesn't test for equality, it sets pos to zero.
So, initialize pos to 15 and then replace the above with this:

    digitalWrite(data, (table[k] >> pos) & 1));   //data= data output pin , Outputs each single bit (MSB)
    
    if (pos == 0) {     //when all bits are sent it switches channel
      pos = 15;

Pete