- viewthread_userinfo_credits
- 27
|
When used as a slave mode, it is also important to note that the SPI adapter operates in full-duplex mode in slave mode, meaning that the slave is also receiving data while it is sending data, so while the master is reading data , The slave will receive the data, but this data is often meaningless data. Slave machine receives and dispatches the data flow generally as follows:
1, from the machine initialisation, prepares to receive the data;
2, calls the machine read data function inquires if has received the host computer sends the data;
3, if the slave machine has received the host computer sends the data, then judges the data Is valid, if legitimate data is processed data;
4, if the slave needs to send data to the host call the slave write data function to write data into the adapter internal buffer waiting for the host to read;
5, the host take the initiative to produce a clock, The data is shifted out, since the slave is full duplex mode, the same amount of data will be received while sending data;
6, the slave calls the read data function again, the data received in step 5 is read back and throw away.
Step 6 is best to deal with, otherwise the next time you read the data there will be a result of garbage data generated when the host reads the data.
|
|