Hi Friends,
I have to implement a SPI request_response function for 8-bit microcontroller. This function has two arguments one is request command structure and other is response structure which is filled after getting response. Its 8-bytes i.e.,
There are 3-4 set of request and response. Which is sent one by one.
When request0 is sent first response must be discarded as there is 8-bytes(64 bits) gap in response from the other slave system. When request1 is sent response0 is gotten. Same way request2 is sent response1 is received. Same way request..n ...response..n-1 and request_dummy will be sent in the last to receive response..n.
I have to collect the correct response for a request. Means need to map response0 for request0 , response1 for request1 and response2 for request2 for further processing.
How to manage this? Please help.
Thanks,
david.
I have to implement a SPI request_response function for 8-bit microcontroller. This function has two arguments one is request command structure and other is response structure which is filled after getting response. Its 8-bytes i.e.,
Code:
typdef struct{
uint16_t data0;
uint16_t data1;
uint16_t data2;
uint16_t data3;
}data_st;
extern data_st *request;
extern data_st *response;
request_response(&request, &response);
When request0 is sent first response must be discarded as there is 8-bytes(64 bits) gap in response from the other slave system. When request1 is sent response0 is gotten. Same way request2 is sent response1 is received. Same way request..n ...response..n-1 and request_dummy will be sent in the last to receive response..n.
I have to collect the correct response for a request. Means need to map response0 for request0 , response1 for request1 and response2 for request2 for further processing.
How to manage this? Please help.
Thanks,
david.