SPI slave MISO delay on STM32F401
I am attempting to communicate between ESP32 and STM32F401 using SPI Mode 0.
I am achieving approximately 6MHz reliably and note data corruptions at 8MHz or so.
Both MPUs are using DMA.
I can improve performance by dropping APB1 prescaler from 2 to 1 changing APB1 from 36MHz to 72MHz (naughty, I know).
The working theory is that we are failing at 8MHz through SCK/MISO violations, see:
Looking at the STM32 datasheet however and MISO is set initially from NSS and then SCK with tsu(NSS) 4*APB1and Tv(SO) of max 17nS.
I have meaured NSS to SCK as 180nS+
What does not make sense to me is that:
- NSS setup > 180nS but the issue seems improved by increasing APB1.
- Tv(SO) = 17nS should give me >=20MHz bus speed.
Also, the regular MISO output delay Tv(SO) is 17nS which is short of APB1 of 28 nS.
I could accept that once loaded the STM output might be driven by SCK but to load the output shift register itself then we must cross clock SCK/APB1 domains and hence have delays?
That is too say the STM output is fed by DMA (no software delays) but the bytes/words still have to be loaded regularly into the shift register - where is this delay shown?
Any pointers/corrections gratefully received!
