请问,DMA里面的buf要改变的时候,是否需要停掉DMA先

2019-10-16 01:10发布

    DMA_DeInit(DMA1_Channel2);
    DMA_InitStructure.DMA_PeripheralBaseAddr =(uint32_t)&TIM1->CCER; //(uint32_t)0x40012C20;   TIM1_CCER
    DMA_InitStructure.DMA_MemoryBaseAddr = (uint32_t)forward_CCER_Buf;  // CCER
    DMA_InitStructure.DMA_DIR = DMA_DIR_PeripheralDST;
    DMA_InitStructure.DMA_BufferSize = 6;
    DMA_InitStructure.DMA_PeripheralInc = DMA_PeripheralInc_Disable;
    DMA_InitStructure.DMA_MemoryInc = DMA_MemoryInc_Enable;
    DMA_InitStructure.DMA_PeripheralDataSize = DMA_PeripheralDataSize_HalfWord;
    DMA_InitStructure.DMA_MemoryDataSize = DMA_MemoryDataSize_HalfWord;
    DMA_InitStructure.DMA_Mode = DMA_Mode_Circular;
    DMA_InitStructure.DMA_Priority = DMA_Priority_High;
    DMA_InitStructure.DMA_M2M = DMA_M2M_Disable;
    DMA_Init(DMA1_Channel2, &DMA_InitStructure);

    DMA_Cmd(DMA1_Channel2, ENABLE);
    TIM_DMACmd(TIM1, TIM_DMA_CC1, ENABLE);   

    请问,如果我的forward_CCER_Buf 这个buf 需要改变再赋进去DMA里面,那么我是否要先 DMA_DeInit(DMA1_Channel2); DMA_Cmd(DMA1_Channel2, DISABLE);TIM_DMACmd(TIM1, TIM_DMA_CC1, DISABLE);   然后再改变BUF的值,然后再做一遍上面的初始化赋值代码。      ????         还是说我直接更改buf里面的数值就可以了,什么也不用改来改去???  

友情提示: 此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。