cancel
Showing results for 
Search instead for 
Did you mean: 

Clocked Data receive with SPI or USART?

nico
Associate II

Hi Guys,

I have an F7 and want to read in a data stream.

Transfer is synchronous, constantly on and data rate is about 2kBaud.

1 Frame consist of 64 bits, in which i have to find a pattern for the start.

I want to use a DMA with maybe 128 bit transfer width to get at least 1 frame in there, while i do not need to grab every frame.

I do not have a lot of experience in USART and SPI peripherals of the F7. But i think both should work.. Does somebody has any suggestion which works better for my usecase?

Cheers

3 REPLIES 3
TDK
Guru

I would use UART at that speed simply because it uses less wires and doesn't need to be synced up with a CS line and it has some amount of built-in protocol checks in that errors in the start/stop/parity bits will likely be caught.

Receive into a circular buffer and process on the half and full complete interrupts, or poll periodically.

If you feel a post has answered your question, please click "Accept as Solution".

The USART Synchronous mode doesn't take an INPUT CLOCK, it only outputs one.

The SPI can be used in a SLAVE mode which will take an INPUT CLOCK.

You could probably do it on a continuous loop, you'd need to fish out the data dealing with any sync/preamble data, and the byte/frame alignment.

With DMA you can trigger an interrupt at half and full buffer points to fish the bit stream.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

That's a clear plus to SPI. I thougth USART can also input clock. However i could use UART without clock since i have a fixed clock, but why not using it when having it ;-).

Thanks for both comments