dsPIC33 SPI problem or deficiency
Please bear with me as I'm new to SPI and the Microchip products. I'm trying to use the SPI interface of dsPIC33FJ256 demo board with the explorer16. I wanted to interface to the MCP4922 DAC from Microchip. However, I'm having a problem controlling the SSx pin from the dsPIC. When I do write to the DAC, I do see the clock and data out signals ok. But the SSx pin stays silent. As far as I can see on the SPI datasheet of the dsPIC, the SSx pin is used only in slave mode or in master frame mode. The DAC does need to have the CS input activated to accept new data. I don't want to use an I/O port to bit bang the CS input of the DAC as I want to update the DAC @ over 1MHz using the DMA to do a burst transfer.
Here is some code to do a signle dac update without using the DMA. This is a simple test without involving interrupts.
void DAC_Init( void )
// Configure SPI1 for dac control
SPI1STAT = 0; // disable SPI1
SPI1CON1bits.DISSCK = 0; //Internal Serial Clock is Enabled.
SPI1CON1bits.DISSDO = 0; //SDOx pin is controlled by the module.
SPI1CON1bits.MODE16 = 1; // select 16bit operation
SPI1CON1bits.SMP = 0; //Input Data is sampled at the middle of data output time.
SPI1CON1bits.CKE = 1; //Serial output data changes on transition from
SPI1CON1bits.CKP = 0; //Idle state for clock is a low level;
SPI1CON1bits.SSEN = 0; //disable slave select bit
SPI1CON1bits.MSTEN = 1; // select master mode
SPI1CON1bits.PPRE = 2; // select 4:1 primary prescaler
SPI1CON1bits.SPRE = 0; // selelct 8:1 secondary prescaler
Writing to the DAC
SPI1STATbits.SPIEN = 1; // enable SPI1
SPI1BUF = out; //
What am I missing? Why can't the silly SPI have the SSx act as CS output?
Separate topic assuming I get the above resolved--
Ultimately I want to use the DMA in continuous ping pong operation with HALF data transfer interrupt mode. The question is when I get the interrupt for bufferA, can I change the start address offset for bufferB without disrupting the DMA operation and vice versa?
Please help. I appreciate any input.