Getting SPI to work on STM32F7 Topic is solved

Report here problems in any of ChibiOS components. This forum is NOT for support.
JSStabl
Posts: 78
Joined: Tue Feb 25, 2020 4:06 pm
Has thanked: 3 times
Been thanked: 2 times

Re: Getting SPI to work on STM32F7

Post 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
User avatar
Giovanni
Site Admin
Posts: 14893
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 997 times

Re: Getting SPI to work on STM32F7

Post 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
Post Reply