bjxyrh 发表于 2022-4-20 15:44:01

TK499 DMA搬运数据求助

我写了一个搬运函数不不工作,有哪位大神成功了,指导一下


void mem_to_mem_dma_transfer(u16 *dstAddr,u16 *srcAddr,unsigned int dataLength )
{

        DMA_InitTypeDef DMA_InitStruct;
/* Initialize the DMA_PeripheralBaseAddr member */
DMA_InitStruct.DMA_PeripheralBaseAddr = (u16)&dstAddr;
/* Initialize the DMA_MemoryBaseAddr member */
DMA_InitStruct.DMA_MemoryBaseAddr = (u16)&srcAddr;
/* Initialize the DMA_DIR member */
DMA_InitStruct.DMA_DIR = DMA_DIR_PeripheralSRC;
/* Initialize the DMA_BufferSize member */
DMA_InitStruct.DMA_BufferSize = dataLength;
/* Initialize the DMA_PeripheralInc member */
DMA_InitStruct.DMA_PeripheralInc = DMA_PeripheralInc_Enable;
/* Initialize the DMA_MemoryInc member */
DMA_InitStruct.DMA_MemoryInc = DMA_MemoryInc_Enable;
/* Initialize the DMA_PeripheralDataSize member */
DMA_InitStruct.DMA_PeripheralDataSize = DMA_PeripheralDataSize_HalfWord;
/* Initialize the DMA_MemoryDataSize member */
DMA_InitStruct.DMA_MemoryDataSize = DMA_MemoryDataSize_HalfWord;
/* Initialize the DMA_Mode member */
DMA_InitStruct.DMA_Mode = DMA_Mode_Normal;
/* Initialize the DMA_Priority member */
DMA_InitStruct.DMA_Priority = DMA_Priority_High;
/* Initialize the DMA_M2M member */
DMA_InitStruct.DMA_M2M = DMA_M2M_Enable;
        DMA_Init(DMA1_Channel1,&DMA_InitStruct);
       
        DMA_ITConfig(DMA1_Channel1,DMA_IT_TC,ENABLE);
       
        DMA_Cmd(DMA1_Channel1,ENABLE);
        while( DMA1_Channel1 -> CNDTR != 0);                //等待传输完成
}

tiky 发表于 2022-4-21 20:57:03

本帖最后由 tiky 于 2022-6-11 19:12 编辑

已经收到你的求助了,今天我忽悠了一下,那个不肯干活的工程师又肯答应写个M2M的例程,我偷偷拷过来上传给你参考。
从8位到32位,三种位宽互倒穷举,共9种模式。
源程序:
(2022-06-11更新了源程序,同时采用了最新的hal库)
另外,也顺便再发一个DMA相当骚的操作给你参考一下。就是拿一个MCU屏,有显存弃之不用,当然TK499有LTDC,也弃之不用。反正TK499内存也够大,那就直接开一个1:1的内存区域,用DMA来回刷MCU屏,以实现任意点显示。听说里面还藏着一个凄美的故事。别问我为什么,我是来拷程序的。
源程序:

face9 发表于 2022-4-21 21:44:11

楼上:期待你的“凄美爱情故事”
页: [1]
查看完整版本: TK499 DMA搬运数据求助