cancel
Showing results for 
Search instead for 
Did you mean: 

How to specify the length/size of a SPI message being transmitted? (DMA access)

agaspar
Associate
Posted on July 03, 2015 at 18:40

Hi

I have succedded in transmitting a SPI message via DMA.

It sends the complete array whose length is specified by BufferSize (typically 100 in the examples).  This value is assigned, e.g. to DMA BufferSize as DMA_InitStructure.DMA_BufferSize = BUFFER_SPI_SIZE ;

Someone know how to specify a different size during run-time by modifying the transmitter configuration (or another solution)? 

I have tried 

SPIx_TX_DMA_STREAM->NDTR = new_message_size;

SPIx_RX_DMA_STREAM->NDTR = new_message_size;

which is equivalent to 

DMA_InitStructure.DMA_BufferSize = BUFFER_SPI_SIZE ;

DMA_Init(SPIx_RX_DMA_STREAM, &DMA_InitStructure);

DMA_Init(SPIx_TX_DMA_STREAM, &DMA_InitStructure);

in the transmitter (the receiver doesn�t know the length), but it doesn't seem to work.

I have read another post in which it is solved via NSS, but I would prefer not to using it.

Thanks in advance

#spi-dma-stm32-length
0 REPLIES 0