cancel
Showing results for 
Search instead for 
Did you mean: 

Synchronization of SPI and DMA for Block data transfer using DMAMUX

MGons.1
Associate II

Hi, I am trying to synchronize a SPI Block data transfer between two MCU's (Ti MSP430 Master, STM32G0 Slave). The idea is to use the DMA to transfer the data to memory and use the DMAMUX to Sync with a timer. 

For demonstration, the data is transmitted to USART.

Here is my result:

SPI_DMA.jpg

The red cycle mark the sync point generated by the timer interrupt of LPTIM1.

For testing, a defined pattern with 6Byte is transmitted via the SPI. And you can see that the data is not in sync with the block transmission. 

Has anyone an idea how to solve this?

SPI1 is configured to receive the data in Slave mode and use DMA.

image.png

DMA Channel 3 is configured to transmit data from SPI1Rx to memory

image.png

DMAMUX Channel 2 is configured to SPI1Rx synced by LPTIM1

image.png

 

1 ACCEPTED SOLUTION

Accepted Solutions
MGons.1
Associate II

Today I was able to solve the problem by myself. 

The solution was to set the FRXTH bit from the SPI configuration.

MGons1_0-1692018508743.png

Now all data is transmitted via the DMA.

View solution in original post

3 REPLIES 3
TDK
Guru

Can you draw your desired waveform? Consider using an SPI slave to drive that line if you want each byte to be perfectly in sync.

If you feel a post has answered your question, please click "Accept as Solution".

Hi, TDK

Sorry I do not understand you. Currently, the Master (MSP430) is driving the communication. 

The goal is that the bytes that are send by the MSP will be received in sync by the STM32G0. 

Like shown in the picture above the received bytes are shifted by 2 bytes. And that is what I have to avoid.

MSP is sending 0x31;0x32;0x33;0x34;0x34;0x35;0x36

STMG0 has received (DMA TC ISR) 0x25;0x26;0x31;0x32;0x33;0x34

The first 2 bytes are from the last data block.

I want to use the synchronization signal of the DMAMUX raised by the LPTIM1 to solve this problem.

MGons.1
Associate II

Today I was able to solve the problem by myself. 

The solution was to set the FRXTH bit from the SPI configuration.

MGons1_0-1692018508743.png

Now all data is transmitted via the DMA.