cancel
Showing results for 
Search instead for 
Did you mean: 

how to sync two stm32 chips' DMA section?

wonss
Associate
Posted on November 04, 2013 at 00:36

i have three stm32f1x chips working with one  oscillator on the same pcb board. it works well. the three chips, let's say A, B, C, A as master chip, B and C as slave chips. now i need to achieve very high speed communication between the master chip(A) and the slave chips(B & C) without CPU's intervention.

i want to use SPI function to sync the DMA sections between A and B/C. first, to set up two seperate DMA sections inside chip A, as DMA_A_1 and DMA_A_2. i want to sync DMA_A_1 with DMA_B, to sync DMA_A_2 with DMA_C all the time. but STM32 doesn't support QSPI function. is there any feasible way to do this? any idea?

#sync-dma #spi-dma
4 REPLIES 4
jpeacock2399
Associate II
Posted on November 04, 2013 at 16:00

This depends on what you mean by synchronize.   Does this mean the same data being sent to B and C from A, or two separate data sets?  Is it a bidirectional transfer, with data being transferred back to A on the opposite SPI clock edge?

Not sure what quad SPI has to do with this, other than the data rate.  If you use SPI1 on both sides you can get transfer rates over 30Mbits/sec.  If you need a higher transfer rate (120Mbit/sec would be the equivalent for QSPI) then you might be better off using the FSMC, parallel transfers and trigger with timers to control the DMA.

Otherwise it's straightforward to set up 2 DMA channels per data transfer to handle write and read (4 total, 2 for B, 2 for C).  You can use circular buffers and half transfer interrupts to move data in and out of the SPI buffers.

  Jack Peacock
frankmeyer9
Associate II
Posted on November 05, 2013 at 09:34

i have three stm32f1x chips working with one  oscillator on the same pcb board.

 

I'm having trouble to imagine a problem that is solved best with 3 separate, identical MCUs. That reminds me on the saying ''When all you have is a hammer, everthing begins to look like a nail.''

Perhaps a more performant MCU or specialized peripheral hardware (FPGA/CPLD ?) could do the job better.

jpeacock2399
Associate II
Posted on November 05, 2013 at 15:47

Single chip controllers are a cheap and plentiful resource, no reason not to use several on one board.  SPI links work great at moving information around, or RS-485 and a UART for lower rates. 

I can think of several applications where a bunch of STM32's would be ideal...think of running 6 or 8 motors, a mix of stepper and BLDC.  Each STM32 can run two motors with advanced timers, two or three phase, and the software would be common to all.  Only one part to stock in inventory and it's more flexible than using discrete motor controllers.

   Jack Peacock
frankmeyer9
Associate II
Posted on November 05, 2013 at 16:45

Agreed, as long as the single units (MCUs) running mostly autonomous, and do not require permanent synchronisation of states.

And I would interpret the OP's description of the problem as such a case.