This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

SPI_Transfer usage

Expert 1635 points

Other Parts Discussed in Thread: CC2640

Hi,

I would like to use in a Simplelink app the SPI driver provided by TI-RTOS. I was reading the available information and it seems that on the slave side I cannot use a single SPI_Transfer() in the way I intended because it would respond back to the master with the Tx buffer contents as soon as a "command" is received, making impossible to parse and process the command and prepare the response before it is sent back.

I would normally separate the functionality into two tasks caring each for each buffer. Now, I imagine (I have not tried anything yet, I am looking for information) that setting the pointer to the Tx buffer to NULL will end the transfer as soon as the "command" is received (I have read about the use of PARTIAL to accommodate to variable length commands) and things will be dealt with as per the selected mode (blocking or callback). Then a signal/event/message would be issued and the command be parsed, etc. If that is the case, I would like to know which is the fastest way to change the configuration of the SPI controller from slave to master to send the "response" I can use SPI_close() and then SPI_open() but that probably is very inefficient. On the other side, SPI_control() seems a better alternative but I could not find any list of possible parameters to be passed (something like (MODE, MASTER).

It also seems that one may assign "channels" to the same controller and use them for their respective purpose (receiving and transmitting).

I would appreciate more information on the topic. Thank you,

Pibe