AnsweredAssumed Answered

chip select - and deselect command come too early

Question asked by Jens.Waeling on Dec 12, 2011
Latest reply on Dec 14, 2011 by Jens.Waeling


I am trying to read Data from an SAR - ADC - Converter to a BF518 via SPI, using the visualDSP system - services and device drivers.

The SPI - Device is configured in DMA - Mode as inbound, my buffers do not invoke a callback - function. and are one 16 - Bit word large.

The idea is the following: first I execute some sort of dummy - read into a dummy buffer with my chip - select left high to give the ADC some clock - cycles to sample. The ADC would just need three clock cycles, but I don't care if it gets 16. Then I want to pull the chip - select and read into a buffer that actually stores the Data I want to process.

the code looks like this:


result = adi_dev_Read(Handle,     //a handle to my spi - device


                                 (ADI_DEV_BUFFER *)&Dummy_Buffer); //the dummy buffer

//read out the dummy buffer so it can be used again

pDaten = Dummy_Buffer.Data;

Daten = *pDaten;


//pull Slave

result = adi_dev_Control(Handle,


                                    (void *) slave);   //my slave select line


result = adi_dev_Read(Handle,     //a handle to my spi - device


                                 (ADI_DEV_BUFFER *)&Inbound0_Buffer);

//read inbound buffer

pDaten =Inbound0_Buffer.Data;

channel_zero_return = *pDaten;


result = adi_dev_Control(Handle,


                                    (void *) slave);



The problem is, that my chip select line goes low at about the fifth clock cycle of my dummy read and goes high again at about the first clock cycle of the inbound - buffer. I don't know why it's asynchronous. Earlier in my programm, I wrote a pretty similar SPI - Write function, that did not have that problem.


Does anyone have any idea why?