2021-07-01 02:20 AM
2021-07-06 07:37 AM
Hello,
Is your SPI is running in receiver mode only (RXONLY) or do you need to use it in real half duplex mode (transmitting some time and receiving sometimes too .. ? Please could you tell me which MCU you are using ?
2021-07-06 08:14 AM
But yes I presume you need to write a Dummy data to SPI TX FIFO as master to generate the clock, each time you need to receive data from the slave in Half duplex mode. For sure, the slave needs to be ready to send the data before receiving the clock by the master.
BR
2021-07-06 08:43 AM
Hi CPINA.
Thank you for your help.
I use STM8L152C6.
In fact in paralle I have found the reference manual applicable for this µP (cd00218714).
So I was wrong but I have my response to use SPI as Master in simplex communication mode with BDM=1 and direction selected by BDOE.
Nevertheless, that is not fully clear for me is the correct condition to stop RX to avoid extra clock. I have understood that setting SPE starts SPI clock. But on which event I can clear SPE to stop clock at good time. Signal RXNE seems good signal but I need to manage under interrupt or poll on this signal. Could you confirm my approach or is there another way ?
Thank you in advance for your support.
BR
2021-07-07 01:49 AM
Hello,
So if I summarize, you are master with your SPI in half duplex mode using BDM and BDOE to change direction. It looks like the procedure to STOP the SPI In RX is the same as for master RXONLY (unidirectional line). as described in page 575 of the reference manual.
It is easiest for the TX Mode, since the clock is stopped when the TX buffer is empty. It is only need to check the TXE and the BSY=0 to stop the SPI.
Hope it helps,
Best regards,
2021-07-07 02:17 AM
Thanks a lot.
All is fine.
BR
2021-07-07 02:26 AM
Welcome !
Have a nice summer !
In order to give better visibility on the answered topics, please click on 'Select as Best' on the reply which solved your issue or answered your question. See also 'Best Answers'