本帖最后由 alexz2008 于 2022-5-16 15:00 编辑
代码如下:
uint16_t dma_buffer[2] = {0x1234,0x5678};
uint16_t dma_dst_buffer[1] = {0};
dma_single_data_parameter_struct dma_init_struct;
rcu_periph_clock_enable(RCU_DMA1);
dma_deinit(DMA1, DMA_CH5);
dma_init_struct.direction = DMA_MEMORY_TO_MEMORY;
dma_init_struct.periph_addr = (uint32_t)dma_buffer;
dma_init_struct.periph_inc = DMA_PERIPH_INCREASE_ENABLE;
dma_init_struct.circular_mode = DMA_CIRCULAR_MODE_ENABLE;
dma_init_struct.memory0_addr = (uint32_t)dma_dst_buffer;
dma_init_struct.memory_inc = DMA_MEMORY_INCREASE_DISABLE;
dma_init_struct.periph_memory_width = DMA_MEMORY_WIDTH_16BIT;
dma_init_struct.number = 2;
dma_init_struct.priority = DMA_PRIORITY_ULTRA_HIGH;
dma_single_data_mode_init(DMA1, DMA_CH5, &dma_init_struct);
dma_channel_enable(DMA1, DMA_CH5);
请教下,我想用DMA把dma_buffer中2个数据(0x1234,0x5678)依次复制到dma_dst_buffer中去,
希望dst_buffer里值依次变为0x1234, 然后0x5678,但查看内存,dma_dst_buffer里2个字节都是0x34,这是为啥呀?用的GD32F405RET6
|