Hi,
I would like to use a DAC 7734 with the 2812 DSP. The DAC uses a 24 bit register. The DSP SPI Register are 16 bits.
I do not manage to program the 2812 SPI protocole to send words of 24 bits.
The programme of spi configuration :
void
InitSpi(void)
{
EALLOW;
GpioDataRegs.GPFDAT.bit.GPIOF6 =
1; //desactivation /CS du DAC
GpioDataRegs.GPBDAT.bit.GPIOB1
= 1; // tous les dac reg
latched
GpioDataRegs.GPBDAT.bit.GPIOB3 =
1; // input reg sel
latched
GpioDataRegs.GPDDAT.bit.GPIOD0 =
1; // resetsel
high
GpioDataRegs.GPBDAT.bit.GPIOB5 =
0; // reset de toutes les
sorties
SpiaRegs.SPICCR.all
= 0x000F;
// Bit 7
, Reset = 0 :
// Bit 6 , Clock Polarity = 1 : data output on
falling edge of CLK
// ,
together with CLOCK PHASE = 1 : data output is one half cycle before
// , falling edge pf SPICLK
// Bit 5 ,
reserved
// Bit 4 , SPILBK = 0 : no loopback
mode
// Bit 3-0 , Chars = 1111 : 16 bit data transfer
SpiaRegs.SPICTL.all
=0x000E;
// Bit 7-5 :
reserved
// Bit 4 , Overrun INT Enable = 0 : Disable
Receiver Overrun Interrupt
// Bit 3 , Clock-Phase = 1 , one half clock
delay
// Bit 2 , Master/Slave = 1 ,
MASTER
// Bit 1 , Talk = 1 , Enable
Transmission
// Bit 0 , SPI INT ENA = 0 , No SPI -
Interrupts
SpiaRegs.SPIBRR = 0x7F; //11
minimum a ne pas depasser
//
SPI Baud Rate = LSPCLK / ( SPIBRR + 1)
//
= 37,5 MHz / ( 124 + 1 )
//
= 300 kHz (3.125Mhz si
11)
SpiaRegs.SPICCR.bit.RESET = 1; // relinquish SPI from
reset
//
SpiaRegs.SPIFFTX.bit.TXFIFORESET=1; // SPI
FIFO out of reset
GpioDataRegs.GPBDAT.bit.GPIOB5 = 1;
// fin reset DAC
EDIS;
}
In the main loop :
GpioDataRegs.GPFDAT.bit.GPIOF6 = 0; // activation du chip avec /cs
SpiaRegs.SPITXBUF = 0x8888;
while
(SpiaRegs.SPISTS.bit.INT_FLAG == 0) ;
dummy=SpiaRegs.SPIRXBUF; clear 'SPI
INT FLAG' by reading SPIBRXUF
SpiaRegs.SPITXBUF =
0x5555;
while
(SpiaRegs.SPISTS.bit.INT_FLAG == 0) ;
dummy=SpiaRegs.SPIRXBUF; clear 'SPI INT
FLAG' by reading SPIBRXUF
With this code, there is a delay between both words of 16 bits. This delay depends on the period of sampling. I shall like sending a word of 24 bits without delay after the first 16 bits.
Can you help me please ?