Skip to main content
salman
Associate II
January 1, 2015
Question

F401-Nucleo board SPI with DMA problem

  • January 1, 2015
  • 1 reply
  • 591 views
Posted on January 01, 2015 at 11:28

Hello,

I am successfully communicating between the nucleo board(master) and a TI(slave) launchpad using normal SPI. e.g I can send a long character string from nucleo and receive it correctly at the launchpad. Now I'm trying to use the DMA controller to data from memory to ST's SPI peripheral but I am facing some problem. Sending a simple string such as ''hello'' results in the slave only getting ''c''.

SPI1->CR2|=SPI_CR2_TXDMAEN; //DMA request when TX empty flag set
char dma_str[]=''hello'';
//DMA2 STream3
RCC->AHB1ENR |= RCC_AHB1ENR_DMA2EN;
DMA2_Stream3->CR &= 0;
while ( (DMA2_Stream3->CR !=0));
DMA2->LISR &= 0;
DMA2->HISR &= 0;
DMA2_Stream3->PAR |= (uint32_t)&SPI1->DR;
DMA2_Stream3->M0AR |= (uint32_t)&dma_str[0];
DMA2_Stream3->NDTR |=0x9;
DMA2_Stream3->CR |=(3<<
16
); //high prority
DMA2_Stream3->CR |=(3<<
25
); //select channel 3
DMA2_Stream3->CR |=DMA_SxCR_MINC;
DMA2_Stream3->CR |=(1<<
6
); //direction
DMA2_Stream3->CR |=DMA_SxCR_EN;

Any help would be appreciated. #nucleo #spi
This topic has been closed for replies.

1 reply

salman
salmanAuthor
Associate II
January 1, 2015
Posted on January 01, 2015 at 11:55

Sheeesh...Stupid Mistake ..My while(1) loop in the main function was commented out... SPI with DMA seems to be working fine now