cancel
Showing results for 
Search instead for 
Did you mean: 

SPI communication (Receive Only Master)

pass3master
Senior

We are trying to develop a device that uses SPI communication (Receive Only Master).

Are there any sample programs for SPI communication (Receive Only Master)?

Which should be executed first: "Receive Only Master HAL_SPI_Receive" or "Transmit Only Slave"?

I think it is "Receive Only Master HAL_SPI_Receive", is that correct?

3 REPLIES 3
gbm
Lead III

Slave must be ready to respond to master, so slave must be started first.

SPI protocol is designed in such a way that slave implementation in a microcontroller may not be easy. Normally, the slave is a logic circuit, always ready for communication with master and able to initialize the session immediately after detecting -SS going low. This is impossible with an MCU.

My STM32 stuff on github - compact USB device stack and more: https://github.com/gbm-ii/gbmUSBdevice

”slave must be started first.”

I see. That's how it was.

 

Does this mean that "Transmit Only Slave" cannot be achieved with a MUC program?

Is there any way to achieve this by combining the following APIs?

・HAL_SPI_TransmitReceive
・HAL_SPI_Transmit
・HAL_SPI_Receive
・HAL_SPI_TransmitReceive_IT
・HAL_SPI_Transmit_IT
・HAL_SPI_Receive_IT
・HAL_SPI_TransmitReceive_DMA
・HAL_SPI_Transmit_DMA
・HAL_SPI_Receive_DMA
・HAL_SPI_TxCpltCallback

 

Hi,

Unfortunately, you are looking for a "crisp" black-white answer. But there is not one for the description you have given. There are many subtle differences between the different modes that may or may not suit your application.

You really need to read the Reference Manual for your device to assist with good choices...

Kind regards
Pedro

AI = Artificial Intelligence, NI = No Intelligence, RI = Real Intelligence.