cancel
Showing results for 
Search instead for 
Did you mean: 

Synchronize 2 STM32 micro using UART and DMA

HDevi.1
Associate II

Hello,

I am trying to synchronize 2 STM32 microcontroller's using UART and DMA. System clock is 80MHz. Timer1 is set to interrupt at 1ms with 1us resolution. Synchronization logic is executed every 1ms, Serial Transmission at master/slave side is every 1ms. In-order to synchronize perfectly reception at both the ends should be at the same time (1ms). Ideal skew should be 0. If Skew is more the Timer period tries to adjust according to skew.....this is intended sync logic I am trying to implement. Please let me know if you have any suggestions or questions as Sync is achieved sometimes but not always.

Thanks!

13 REPLIES 13

Purpose of two different external oscillator:

If clock source of one mcu fails.....other MCU (working) would atleast know that it cannot communicate with failed mcu(report a fault)...and can switch the I/O's into safe state atleast. SPI communication is good option...but it would atleast need 3/4 dedicated pins..right?

Piranha
Chief II

> In-order to synchronize perfectly reception

Why is it necessary?

STM32 SPI usually have half duplex option. So two pins: clock and data. Chip select can be permanently active (not connected between the MCUs).

I dont see idea n your design, but normal use is HALF or FULL DUPLEX.

If slave waits for receive data in Receive_IT , then on master start sending, slave start receive in same time, no sync required. = HALF DUPLEX.

If next code same time on slave wait receive start and initiate transmit = FULL DUPLEX