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: 53
Joined: Tue Feb 25, 2020 4:06 pm
Been thanked: 1 time

Re: Getting SPI to work on STM32F7

Postby JSStabl » 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.

spi123-async-events.png

User avatar
Giovanni
Site Admin
Posts: 12747
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 694 times
Been thanked: 572 times
Contact:

Re: Getting SPI to work on STM32F7

Postby Giovanni » Wed Mar 04, 2020 6:32 pm

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


Return to “Bug Reports”

Who is online

Users browsing this forum: Bing [Bot], Google Adsense [Bot] and 3 guests