cancel
Showing results for 
Search instead for 
Did you mean: 

DMA between 2 SPIs and FSMC

florianlabastie9
Associate II
Posted on July 17, 2013 at 13:40

The original post was too long to process during our migration. Please click on the attachment to read the original post.
6 REPLIES 6
Amel NASRI
ST Employee
Posted on July 17, 2013 at 16:26

But the internal memory just receive the SPI2->DR without increment the SPI memory address. So we have always the same data copied.

 

Did you checked that the data in SPI2->DR is correctly updated? May be the problem isn't in DMA side.

-Mayla-

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

Posted on July 17, 2013 at 20:10

Well you'd have to generate some outbound SPI traffic to be able clock back data from the slave device.

DMA1 Stream4 Channel0 is SPI2_TX (OUTBOUND) To SPI2->DR

DMA1 Stream3 Channel0 is SPI2_RX (INBOUND) From SPI2->DR

So you're using the wrong stream for inbound data ie SPI to FSMC

You will need to fix the stream you have configured, and create a second one
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
florianlabastie9
Associate II
Posted on July 18, 2013 at 10:18

Thank you for your replies.

@ Mayla : The SPI->DR is not updated, it's always the same data. But we don't understand how increment the memory adress to progress into.

The SPI protocol is OK, we can write in our memory where we want, but the SPI protocol with the DMA protocol is NOK.

@clive1 : If we try the other stream (

DMA1 Stream3 Channel0 is SPI2_RX (INBO

UND) From SPI2->D

R)

, the data isn't copied into our board (variable in soft to do SPI -> Flash). But we agree with you, we use the bad DMA ! But it works with the bad.

And why do you want to create a second DMA ? We can't use only one DMA to do SPI -> FSMC ?
Posted on July 18, 2013 at 14:02

The SPI master (STM32) only generates an SPI clock for out bound data, the in bound received data is clocked back as a side effect of this singular clock. Reading SPIx->DR does not generate clocks, it just returns the value in a holding register. You said it keeps reading the same value, which wouldn't be surprising if it never clocks the interface.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
florianlabastie9
Associate II
Posted on July 19, 2013 at 10:09

OK, it's our problem.

So  how can we increment the adresss pointer of the SPI-DR by the DMA?

DMA doesn't be able to command the clock of the Rx data of SPI ?

Posted on July 19, 2013 at 10:56

You don't increment the SPIx->DR, it's an STM32 side register. The process you describe is one of streaming data from an SPI memory, which presumably auto-increments it's internal address register as you keep reading data from it.

Without wading into the documentation there might be a data streaming command, or block/pages you can read in a burst. The usual mechanisms for such memories is to send a command/address and then to read back one or multiple bytes.

You must remember that SPI is a symmetrical interface, you must stuff data in, to get data out, the data going in might only need to be junk or undefined, and the data coming back might be ignored. It depends on the device and the mode/command being used.
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..