STM32 receive ONLY on SPI peripheral
Hi, I've worked a bit on STM32 before (STM32F7 to be more precise), so I have little knowledge about the STM platform. I normally don't need to ask question on forum because Google is a very good professor, but this time I'm not sure to have found enough informations.
So here's the problem I have:
I work on a project where I need (at least) to read a MAX31855 thermocouple converter with the help of a bluepill (STM32F103C8). It is done with the SPI 1 (remapped). The thing is, the readed data make absolutely no sense. I know thought that the hardware and software work because on an other project based on stm32duino, the temperature reading is ok. For my needs, I want to transfert everything from Arduino to good old C++ code with SW4STM32.
What I think is the problem: The thermocouple IC is read-only, so from what I can see it begin to push his data as soon the CS is low and that the SCK begin. The thing is, HAL_SPI_Receive (function from HAL provided by STM) uses HAL_SPI_TransmitReceive when in full duplex. So from what I can understand, it send one byte to receive one. This is why I've change hspi1.Init.Direction = SPI_DIRECTION_2LINES; to hspi1.Init.Direction = SPI_DIRECTION_2LINES_RXONLY; thinking it would work... but it didn't.
Anyway sorry for the very long message and my not so good english, but if someone have an idea, I'll appreciate it. Thanks!
