AnsweredAssumed Answered

SPI question (0xff in DR)

Question asked by st.and.art1 on Apr 22, 2015
Latest reply on Apr 23, 2015 by st.and.art1
Hello everyone, 

I checked the data sheet but couldn't find an answer to the following question: 

What should happen if master initiates transmission but slave is detached or powered down?   In my tests once master sends the first byte, both TXE and RXNE are set high as if there is input data ready. I also checked DR and it contains 0xFF, so the first and all subsequent reads all return FF's. This is a valid data that could be returned by slave so there is no way to tell that slave is detached.  I am pretty sure the first time I tried I got all zeroes in DR in this case, now they are all FF's.  I checked the GPIO configuration and the MISO pin is configured as input floating so it happens to always be high. If I pull it down, I got all zeroes as before.  So my quick fix was to configure the MISO pin as input pulled down, but this contradicts  recommendations in the data sheet.  And of course it is a simple coincidence that in my case zeros indicate an error.  I must be missing something. If MISO is floating, then its state is unpredictable so there must be some other way to tell that slave is not communicating. I would think that would the RXNE flag, so I don't understand why it is set if there is no input.   This is stm32f100c6 (LD VL)

Thanks

Outcomes