cancel
Showing results for 
Search instead for 
Did you mean: 

USART Synchronous Clock Question

apatel
Associate II
Posted on November 22, 2011 at 12:54

Hi

I have an accelerometer which works with synchronous serial. I would like to read this data into my STM32 Discovery board.

My question is, does the USART need to be transmitting for the Clock signal to run? I ask this as I would like to just receive data from the sensor without having to transmit data to it.

Thanks in advance

Amir

#usart #stm32 #synchronous
3 REPLIES 3
Posted on November 22, 2011 at 13:12

Maybe you want to be using SPI, where the master generates the clock, and both master/slave share the same clock for synchronization.

The synchronous USART is a different beast, but you should be able to define if it generates a clock, or uses an external one.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
apatel
Associate II
Posted on November 22, 2011 at 13:25

Thanks for the quick reply.

I will check it out. Does the SPI module also have acces to the DMA?

Also, my application requires me to receive the (synchronous) serial data from the sensor and then output this (asynchronously) to another UART. In essence, I'm trying to create a synchronous to asynchronous converter module.

Regarding the DMA, is it possible for me to tell the DMA to take the received USART data buffer straight to the asynchronous UART's tx buffer? That way, I will only need one DMA channel (I think).

Also, what if the receiver data is of variable length? Would I need some sort of timeout?

Thank you again for all the help.

Posted on November 22, 2011 at 17:25

I think you need to thoroughly read the technical manuals.

You will need a separate DMA channel for each transfer path, you'll need to review what channels are tied to what peripherals.

You can DMA from one peripheral into a buffer, and then DMA out of that buffer to a different peripheral, using a different channel. Managing this will be difficult, and yes you''ll probably want timeouts, and catch the transfer half/complete interrupts. There are no interlocks between DMA channels so catching/preventing overruns/underruns is impossible, ie you must only commit DMA transfers to data you actually have on hand.

DMA Transmit channels are relatively straight forward.

I would suggest you prove your tunnelling/forwarding with a simple FIFO polling/interrupt model. Then implement DMA Transmission.

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