2015-01-01 02:28 AM
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
2015-01-01 02:55 AM
Sheeesh...Stupid Mistake ..My while(1) loop in the main function was commented out... SPI with DMA seems to be working fine now