Count the number of times the ESP32's SPI CS pin goes low. Ignore the first go low and process the other go-lows. After a small time reset the csGoLowCount.
Also putting the ESP32 to sleep for 5 seconds does not make sense when trying to receive a string of SPI packets.
That is going to sit for 5 seconds after reading the first messages and before adding a new slave to the input queue. I suspect the second message comes in during those 5 seconds and is ignored because no receive buffer is available for it.
Just have the Master drop the CS line to the slave and count the number of times the CS line drops.
Which pin on the slave are you using for the CS line?
Or are you just receiving all the SPI traffic without a CS line to use to discriminate traffic to a device?
Not sure to anderstand "just have the master drop the CS line..."
I can't control the master, is a "blackbox"
I use the pin 15 for the CS (blue signal in my picture)
How I can count a drop ?
That is going to sit for 5 seconds after reading the first messages and before adding a new slave to the input queue. I suspect the second message comes in during those 5 seconds and is ignored because no receive buffer is available for it.
I already try to delete the delay or have a longer, same result
Thanks for this. The problem is I use arduino with the ESP32. I'm a noob in this field, I don't know how to use esp-idf. I'm afraid it be more diffuclt for me to use it.
I found someone who has the same problem here and resolve it by force the CS line and to low?
Unfortunately, I don't understand how to do with arduino lib...
I was able to move forward thanks to your remarks which inspired me.
What I have done :
Instead of using the CS of the master, I use an ESP32 pin configured in OUTPUT and connected to the CS_slave. This way I can decide to switch this pin to LOW only after having received the 1st frame. So I know how to read the message from the 2nd frame.
The problem is that, in this way, I can read only the 2nd frame but not the following ones.
I'm still stuck...
How to read all frames every time CSB signal goes 0...
With this current code, I can only read the 1st frame. I understabd that each time the CSB signal switch low to high, the reading is over. So it can't read next frame.
You may struggle to do this. How do you know which is the "first" message/byte? If the master is already sending when your ESP32 boots, then you have missed the first message/byte and potentially many others.
Is there a detectable gap between groups if messages so that you can use that to re-sync with the master. Or have I misunderstood the question.
Finally, it's ok if I read all frames, include the 1st one.
So as I explain in my previous message, with the code I showed, I only display the 1st message. Now I need help to display every following messages (see the picture).