Question
Spi with dma
Posted on January 07, 2016 at 16:05the goal is to tranfer the data from memory to spi. The buffer values are 32 bit. and the spi data register is 16 bit. i made a configuration to take the 32 bit value and put it in fifo, then take 16 bit value from fifo and put it in spi data register.the dma did not work. is there any problem with the configuration.. please help me The configuration is below. #define buffer_count 1200uint32_t buffer[buffer_count]; void spi_dma2d_halfword(SPI_TypeDef* SPIx){ DMA_InitStructure.DMA_PeripheralInc = DMA_PeripheralInc_Disable; DMA_InitStructure.DMA_MemoryInc = DMA_MemoryInc_Enable; DMA_InitStructure.DMA_Mode = DMA_Mode_Normal; DMA_InitStructure.DMA_Priority = DMA_Priority_Low; DMA_InitStructure.DMA_FIFOMode = DMA_FIFOMode_Enable ; DMA_InitStructure.DMA_FIFOThreshold = DMA_FIFOThreshold_1QuarterFull; DMA_InitStructure.DMA_MemoryBurst = DMA_MemoryBurst_INC4 ; //1 burst fo 4 beats DMA_InitStructure.DMA_PeripheralBurst = DMA_PeripheralBurst_Single;** memory data size */ DMA_InitStructure.DMA_MemoryDataSize = DMA_MemoryDataSize_Word; DMA_InitStructure.DMA_PeripheralDataSize = DMA_PeripheralDataSize_HalfWord; DMA_InitStructure.DMA_MemoryInc = DMA_MemoryInc_Enable; /* Configure TX DMA */ DMA_InitStructure.DMA_BufferSize = buffer_count ; //buffer size DMA_InitStructure.DMA_PeripheralBaseAddr =(uint32_t)(&SPI6->DR); DMA_InitStructure.DMA_Memory0BaseAddr = (uint32_t)(&outpuf_pfc) ; /**** channel and direction ***/ DMA_InitStructure.DMA_Channel = DMA_Channel_1 ; DMA_InitStructure.DMA_DIR = DMA_DIR_MemoryToPeripheral ; /*** initialize ***/ DMA_Init(DMA2_Stream5, &DMA_InitStructure);}