Slave SPI is not collecting data
Posted: Fri Jul 18, 2025 3:23 pm
Dear Community,
I'm using a ESP32 WROOM-32D. It should work as a SPI slave connected to a PIC32. This SPI is working very well, cecause there are some other devices connected.
I adapted the SPI excample from the Espressif to my setup (see att. main.c, he_spi.h). In the main loop I inserted a timer with a counter, just to see the progran is alive. To have a visible pattern, I preload the first Byte of the SPI-receive-buf with 20 and print this Byte out, bevore and after the SPI is receiving a Byte. The PIC-MCU ist sending a 0xA5 (see OsziPIC MOSI signal).
The problem is, the Byte after receive is not changed in the receive buf. I expect the 0xA5 (165 dec) but it is still the 20 (dec). The Oszi-PIC is showing, that the ESP SPI is sensing the transfer, because the MISO line is clocking the 1, whitch is preset in the ESP SPI send-buf. As you can see in the TerminalOut, I tryed it several times (after Main Loop 11, 19, 25).
[*]
SPI ready
wait for PIC
start wait for PIC 20
Main Loop 0
Main Loop 1
.
.
.
.
.
Main Loop 11
post wait for PIC 20
start wait for PIC 20
Main Loop 12
.
.
.
.
[*]
Each time with the same result. I checked the ESP MOSI pin. I configured it as a ordinary GPIO input and verified the correct high/low lewel. For my verivication, I puted the relevant code into the main.c, but with the same failure.
I attached my .c files for your information.
For my opinion, there should be somthing wrong with the memory setup. But up to now no idea about a solution.
What could be wrong?
Greetings
Henry
I'm using a ESP32 WROOM-32D. It should work as a SPI slave connected to a PIC32. This SPI is working very well, cecause there are some other devices connected.
I adapted the SPI excample from the Espressif to my setup (see att. main.c, he_spi.h). In the main loop I inserted a timer with a counter, just to see the progran is alive. To have a visible pattern, I preload the first Byte of the SPI-receive-buf with 20 and print this Byte out, bevore and after the SPI is receiving a Byte. The PIC-MCU ist sending a 0xA5 (see OsziPIC MOSI signal).
The problem is, the Byte after receive is not changed in the receive buf. I expect the 0xA5 (165 dec) but it is still the 20 (dec). The Oszi-PIC is showing, that the ESP SPI is sensing the transfer, because the MISO line is clocking the 1, whitch is preset in the ESP SPI send-buf. As you can see in the TerminalOut, I tryed it several times (after Main Loop 11, 19, 25).
[*]
SPI ready
wait for PIC
start wait for PIC 20
Main Loop 0
Main Loop 1
.
.
.
.
.
Main Loop 11
post wait for PIC 20
start wait for PIC 20
Main Loop 12
.
.
.
.
[*]
Each time with the same result. I checked the ESP MOSI pin. I configured it as a ordinary GPIO input and verified the correct high/low lewel. For my verivication, I puted the relevant code into the main.c, but with the same failure.
I attached my .c files for your information.
For my opinion, there should be somthing wrong with the memory setup. But up to now no idea about a solution.
What could be wrong?
Greetings
Henry