cancel
Showing results for 
Search instead for 
Did you mean: 

''Simulate'' 16-bit SPI Transfer w/ USART in Synchronous?

jvavra
Associate III
Posted on January 06, 2015 at 20:19

I've got a project with three ASICs that expect 16-bit words to be received via SPI, transferred via DMA . Unfortunately, due to a pin conflict, I only have SPIs 1 and 3 available. So. I was thinking about trying to use a USART in synchronous mode. Obviously, I'm limited to 8 bits (or 9). But is there a way to ''fool'' the DMA into completing two 8-bit transfers from the USART of my 16-bit word?

4 REPLIES 4
Chris1
Senior III
Posted on January 07, 2015 at 20:43

You may find this discussion regarding TIM triggered DMA interesting:

https://my.st.com/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/Is%20there%20anaybody%20that%20have%20a%20TIM%20triggered%20DMA%20working%20Code

It should be possible to drive a USART similarly.

Posted on January 07, 2015 at 22:16

The DMA can handle multiple bytes, half-words (16-bit), and words (32-bit).

Somehow I don't think the synchronous serial is likely to get the results you want, you'd have to experiment.

You could presumably send two back to back bytes, but not sure how you'd separate 16-bit pairs.
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
jpeacock
Associate III
Posted on January 07, 2015 at 22:56

In synchronous mode the USART is essentially a shift register so you can shift in/out any number of bits along with the clock.  Even if there's a gap between bytes it's transparent to SPI because data is triggered on a clock edge, not time dependent.  This assumes you don't have to switch the SPI chip select after every word (I seem to recall either TI or Motorola had an SPI interface like that).

Where you might have a problem is clocking data in and out on the right edge of the USART clock.  If your ASICs use bidirectional transfers this can be a real problem.  Not sure how you can control clock edge in USART synch mode.

  Jack Peacock

jvavra
Associate III
Posted on January 22, 2015 at 19:33

What I was completely forgetting: my ASICs on the other end of the USART are just 16-bit shift registers at the front end, too, so I just shift data one byte at a time, and let the clock move the data into place.

Thanks for the help guys!