2011-11-22 03:54 AM
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 advanceAmir #usart #stm32 #synchronous2011-11-22 04:12 AM
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.2011-11-22 04:25 AM
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.2011-11-22 08:25 AM
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.