2025-03-22 3:03 PM
Hi,
I'm trying to set up SPI communication between a STM32H753ZI (Master, using SPI2) and an ESP32-S (Slave), using the ESP32SPISlave library.
STM32 SPI2 pins:
PB10 (SCK) → ESP32 GPIO18
PC2 (MISO) ← ESP32 GPIO19
PC3 (MOSI) → ESP32 GPIO23
PE11 (CS) → ESP32 GPIO5
SPI Mode 0, 8-bit, NSS controlled manually (software)
GND is shared, 3.3V logic
The STM32 sends 0x55 and expects a reply (ESP32 sends 0xAB via transfer()), but I always receive 0x00.
CS is pulled LOW just before HAL_SPI_TransmitReceive() and HIGH after. The transfer function does not block.
Why is STM32 always reading 0x00 on MISO, even though the ESP32 slave is responding with data? Any ideas or STM32-specific SPI2 issues I should check?
I don't know how I have to configure the ESP's clock, same with the STM32..
Thanks in advance!
2025-03-22 4:02 PM
Remove the ESP32 and connect MOSI to MISO on the STM32 to see if it receives what it sends. If it does, STM32 is doing its job.
Use a logic analyzer to figure out what is being sent on the line.
2025-03-23 11:35 AM
If I connect the MOSI to MISO of the stm, I get the correct value.
I will think about buying a logic analyzer, thank you for the advice, I didn't know this device!
2025-03-23 12:53 PM
> If I connect the MOSI to MISO of the stm, I get the correct value.
Good, shows STM32 working/receiving as expected.
Since you're controlling CS manually, not much else could be to blame other than the ESP32 behavior.