Page 3 of 3

Re: Getting SPI to work on STM32F7

Posted: Wed Mar 04, 2020 2:55 pm
by JSStabl
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.

spi123-async-events.png

Re: Getting SPI to work on STM32F7

Posted: Wed Mar 04, 2020 6:32 pm
by Giovanni
Understood, note that using asynchronous API you may start an SPI operation from the callback of another/same SPI or any other peripheral able to fire callbacks.

This would avoid going through an event and wake up a thread. In this case, of course, you need to take care of the driver state and make sure that it is in the ready state before trying to start an operation.

Giovanni