Hi,
I am using DLN-4S adapter as SPI slave and my MCU as SPI master. The master sent 16 bytes of data to DLN-4S slave. The data clock is 2MHz. I sent out 16 bytes of data each time as below:
for( i = 0; i < 16U; i++ )
{
SPI_CS_LOW;
SSP1->DR = i; // send out data
Delay(2); // wait for data finish
SPI_CS_HIGH;
}
The 16 bytes of data sent are: 000102030405060708090A0B0C0D0E0F (verified from ocilloscope waveform). Chip select set to low then send out 1 byte of data, then chip select set to high.
I downloaded dln.2.0.3 package. I ran visual basic project SpiSlave from DLN/examples/VB.wfa folder out of dln.2.0.3 package. I checked "SPI Slave Enabled" box, "Events Enabled" box, CPOL set to 0, CPHA set to 0, Frame Size set to 8, Event Size set to 16, Reply Mode set to SSBased, Replay Shortage Action set to SendZeros, SS Idle Timeout set to 1000. The Incoming Data field shows 000081018202830308090A0B0C0D0707.
The problem is that each time when my MCU send out 16 bytes of data, the data stream in the Incoming Data field of visual basic project is not the same and only a few bytes are correct.
What is the parameter requirement on the SPI master to make visual basic example work, such as chip select low to frame time, end of byte to chip select high time? I attached waveform of SPI transmission, the data are correctly sent.
Thanks, Jian