Re: Getting SPI to work on STM32F7
Posted: Wed Mar 04, 2020 2:55 pm
We seem to be talking about different things
I am aware that one SPI instance (e.g. SPI1) can't be used at the same time, however SPI1 and SPI2 can run very close to each other (see the image below).
So my use case is:
High Priority Path:
GPIO Interrupt -> SPI5 Exchange -> SPI1/2/3 send (<---- as fast as possible), Wait for next GPIO Interrupt
Low Priority Path:
SPI1/2/3 Exchange, Wait (200us)
I solved this over events, the highest Prio SPI5 Exchange fires an event at the end, SPI1/2/3 within their respective threads consume this event. The SPI1 Thread has the highest priority of the three and starts sending, getting suspended after talking to the DMA, in the meantime SPI2 starts sending and so on. When SPI1 is done it returns to the thread and releases the bus. Another SPI1 Thread with lower priority can take over and send its async message. In the screenshot you can see the 2nd message being sent after a while.
I am aware that one SPI instance (e.g. SPI1) can't be used at the same time, however SPI1 and SPI2 can run very close to each other (see the image below).
So my use case is:
High Priority Path:
GPIO Interrupt -> SPI5 Exchange -> SPI1/2/3 send (<---- as fast as possible), Wait for next GPIO Interrupt
Low Priority Path:
SPI1/2/3 Exchange, Wait (200us)
I solved this over events, the highest Prio SPI5 Exchange fires an event at the end, SPI1/2/3 within their respective threads consume this event. The SPI1 Thread has the highest priority of the three and starts sending, getting suspended after talking to the DMA, in the meantime SPI2 starts sending and so on. When SPI1 is done it returns to the thread and releases the bus. Another SPI1 Thread with lower priority can take over and send its async message. In the screenshot you can see the 2nd message being sent after a while.