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
Slave SPI is not collecting data
Slave SPI is not collecting data
- Attachments
-
- TerminalOutput.txt
- (4.95 KiB) Downloaded 7 times
-
- OsziPic.jpg (57.22 KiB) Viewed 232 times
Re: Slave SPI is not collecting data
Sorry,
the mistake by insertion of the att. files. But the problem is visible.
Henry
the mistake by insertion of the att. files. But the problem is visible.
Henry
Re: Slave SPI is not collecting data
Hi, for esp32 it use an old design, If you using DMA and actual transaction length (master side) not align to 4 byte, slave can't receive those not aligned bytes.
So for your solution: change PIC master side that transaction length align to 4 bytes, Or not use DMA on esp32 spi slave.
Thanks for your report!
So for your solution: change PIC master side that transaction length align to 4 bytes, Or not use DMA on esp32 spi slave.
Thanks for your report!
Re: Slave SPI is not collecting data
Hi wanckl,
thank you for your replay.
right now, I'm not on my desk, so I cannot verify your solution. But I will check it out when I`m back. I give a feedback to you, if I did it.
One more question:
is the number of bytes exact four? Or is this the minimum for a transaction together with the DMA and it could be more?
Greetings
Henry
thank you for your replay.
right now, I'm not on my desk, so I cannot verify your solution. But I will check it out when I`m back. I give a feedback to you, if I did it.
One more question:
is the number of bytes exact four? Or is this the minimum for a transaction together with the DMA and it could be more?
Greetings
Henry
Re: Slave SPI is not collecting data
It needs to align to four, in other words, be an integer multiple of four. So 0 bytes, 4 bytes, 8 bytes, 12 bytes, 16 bytes, 20 bytes etc all should work.
Re: Slave SPI is not collecting data
Hi Sprite,
thank you for clarifikation. It's moving me ahead.
Great.
Henry
thank you for clarifikation. It's moving me ahead.
Great.
Henry
Re: Slave SPI is not collecting data
Hi Sprite and wanckl,
thank you for your great support. I checked out your advices (with/without DMA) and could verify the solution.
Greetings
Henry
thank you for your great support. I checked out your advices (with/without DMA) and could verify the solution.
Greetings
Henry
Who is online
Users browsing this forum: Qwantbot and 4 guests
