AnsweredAssumed Answered

F401-Nucleo board SPI with DMA problem

Question asked by ahmed.salman.003 on Jan 1, 2015
Latest reply on Jan 1, 2015 by ahmed.salman.003
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.

Outcomes