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.

tms320F2809 communicating with DAC8552 over SPI

Other Parts Discussed in Thread: TMS320F2809, DAC8552

I think this is just a standard software question. I took over some tms320F2809 code that talks to a DAC8552 over SPI. There are no other devices on the SPI bus. I believe the data going across the SPI bus is not correct (I am planning to look at it on an oscilliscope today).

My question is, what is the correct way to transmit the 24 bits the DAC wants over the SPI bus? Right now I believe it is set to 12 characters at a time. But I read on the DAC8552 datasheet that if u send less than 24 bits, you need to manually control the SYNC* line on the DAC so it goes high after the 24th bit is sent. Here is some of the code.

 

[code]

  SpiaRegs.SPICCR.bit.SPISWRESET        = 0;      // Reset SPI
    SpiaRegs.SPICCR.bit.SPICHAR            =11;    // 12 characters
    SpiaRegs.SPICTL.bit.MASTER_SLAVE    = 1;    // Master Mode
    SpiaRegs.SPICCR.bit.CLKPOLARITY        = 0;    // clock active high
    SpiaRegs.SPICTL.bit.CLK_PHASE        = 1;    // data changes on falling edge of the clock
    SpiaRegs.SPICTL.bit.TALK             = 1;    // Enable transmission
    SpiaRegs.SPICTL.bit.SPIINTENA        = 1;    // Enable interrupts
    SpiaRegs.SPIBRR                     = SPIABAUD;    // 6.25 MHz
    SpiaRegs.SPICCR.bit.SPISWRESET         = 1;    // Release from Reset
// Initialize SPI FIFO registers
    SpiaRegs.SPIFFTX.all=0xE040;
    SpiaRegs.SPIFFRX.all=0x2042; // 0x2062;
    SpiaRegs.SPIFFCT.all=0x0;
    /* Enable interrupts required for SPI A.
    */
    PieCtrlRegs.PIECTRL.bit.ENPIE = 1;  //Enable the PIE block
    PieCtrlRegs.PIEIFR6.bit.INTx2 = 0;  //Clear any pending interrupt
    PieCtrlRegs.PIEIER6.bit.INTx2 = 1;  //Enable transmit interrupt only
    PieCtrlRegs.PIEIFR6.bit.INTx1 = 0;  //Clear any pending interrupt
    PieCtrlRegs.PIEIER6.bit.INTx1 = 1;  //Enable transmit interrupt only
    PieCtrlRegs.PIEACK.bit.ACK6 = 1;
    IER |= PIEACK_GROUP6;   //Enable CPU INT6
    EINT;                   //Enable Global Interrupts

 

-----------------------

Uint16 output = 0x???? ;

SpiaRegs.SPITXBUF = (output>>8) & 0xFFF0;
SpiaRegs.SPITXBUF = (output<<4) & 0xFFF0;

SpiaRegs.SPITXBUF = (0x3400 | (output>>8)) & 0xFFF0;
SpiaRegs.SPITXBUF = (output<<4) &0xFFF0;

[\code]