问答

汇集网友智慧,解决技术难题

ryan39343551

TA的家园币:49  

  • at32f413 DMA新手求助

    使用DMA更新PWM脉宽数据,TIMR5输出两路PWM,频率相同,脉宽不同,以下代码PWM正常工作,DMA无法更新数据。感谢大佬们帮忙看看一下。voidtmr5_configuration(void){tmr_output_config_typetmr_output_struct;/*InitTMR5*/tmr_base_init(TMR5,250-1,0);//200MHz/250=800KHz//tmr_base_init(TMR5,300-1,0);//240MHz/300=800KHztmr_cnt_dir_set(TMR5,TMR_COUNT_UP);//定时器计数器向上计数/*TMRconfigurationasoutputmode*/tmr_output_default_para_init(&tmr_output_struct);tmr_output_struct.oc_mode=TMR_OUTPUT_CONTROL_PWM_MODE_B;tmr_output_struct.oc_output_state=TRUE;tmr_output_struct.oc_polarity=TMR_OUTPUT_ACTIVE_LOW;tmr_output_struct.oc_idle_state=TRUE;tmr_output_struct.occ_output_state=TRUE;tmr_output_struct.occ_polarity=TMR_OUTPUT_ACTIVE_LOW;tmr_output_struct.occ_idle_state=FALSE;/*TMR5channel1configuration*/tmr_output_channel_config(TMR5,TMR_SELECT_CHANNEL_1,&tmr_output_struct);tmr_output_channel_buffer_enable(TMR5,TMR_SELECT_CHANNEL_1,TRUE);/*TMR5channel2configuration*/tmr_output_channel_config(TMR5,TMR_SELECT_CHANNEL_2,&tmr_output_struct);tmr_output_channel_buffer_enable(TMR5,TMR_SELECT_CHANNEL_2,TRUE);}voiddma2_5_configuration(void){dma_init_typedma_init_struct={0};dma_reset(DMA2_CHANNEL5);dma_reset(DMA2_CHANNEL4);/*dma1channel7configuration*/dma_default_para_init(&dma_init_struct);dma_init_struct.buffer_size=ArgbPixelBuffNub+ArgbPixelResetNub;//设置DMA通道传输数据量dma_init_struct.direction=DMA_DIR_MEMORY_TO_PERIPHERAL;//方向为存储器到外设dma_init_struct.memory_base_addr=(uint32_t)temp_buffer_argb2;//设置DMA通道存储器地址dma_init_struct.memory_data_width=DMA_MEMORY_DATA_WIDTH_BYTE;//存储器数据宽度为字节dm

    2023-03-06 0