2014-06-13 07:30 AM
Hello;
I want to use DMA to transmit and receive data between a Slave and Master STM32 Boards. My question is how can i configure the DMA to transfer many different Array for example? i mean i want the slave to send something like: - DMA_InitStructure.DMA_MemoryBaseAddr = (uint32_t)TxBuffer; - DMA_InitStructure.DMA_MemoryBaseAddr = (uint32_t)Tx1Buffer; - DMA_InitStructure.DMA_MemoryBaseAddr = (uint32_t)Tx1Buffer; Depending of Command received from the Master. Thanks in advance2014-06-13 08:00 AM
The DMA unit does not support scatter-gather type operations, you would need to initialize each transaction, and point it a specific buffer, of a specific size.
2014-06-14 12:53 AM
as
clive
says
you can not
do it
automatically
I
configure
DMA
and SPI
at the beginning
then
I start the SPI TX with this code
DMA_MemoryTargetConfig (Spi[id].tx_stream, txptr, DMA_Memory_0) ;
DMA_SetCurrDataCounter (Spi[id].tx_stream, txlen) ;
DMA_StreamEventFlagClear (Spi[id].tx_stream, DMA_IT_FLAGS) ;
DMA_Cmd (Spi[id].tx_stream, ENABLE);
SPI_DMACmd (Spi[id].base, SPI_DMAReq_Tx, ENABLE);
2014-06-14 01:42 PM
Thanks guys for your responses, what i want to say is :
I want to send : - DMA_InitStructure.DMA_MemoryBaseAddr = (uint32_t)TxBuffer; when I receive certain command.OR : - DMA_InitStructure.DMA_MemoryBaseAddr = (uint32_t)Tx1Buffer; when an another command is received.OR: - DMA_InitStructure.DMA_MemoryBaseAddr = (uint32_t)Tx1Buffer; when other command is received. @ clive: you would need to initialize each transaction, and point it a specific buffer, of a specific size. Yes I figured about it, but I have to do that in interrupt handler detects rising and falling edges of the slave select line . The problem is this initialized will take much time and so data will be lost2014-06-15 09:26 AM
My application is as described in the schematic below :
I want to make an application that consists of : - The Master sends a command to the Slave , then a data - The Master sends continuously different commands, The Slave process the command then send response depending the received command to the Master. The Updating frequency is about 20Khz. I tried to make this application with SPI interruption but I faced some problems in the Master side to receive data sent by the Slave. I want to make it using DMA, but I don't know how to go. I wonder if someone had already made this kind of application because i really need help to make progress. Thanks in advance, Note: The CS is handled by interruption where the SPI reception is activated in low edge2014-06-15 01:17 PM
If the latency of setting up the DMA in the EXTI is too high, would suggest you deliver the first byte(s) to the SPI manually, and set the DMA up for the subsequent bytes.
2014-06-17 08:49 AM