问答

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

21ic问答首页 - TAG - ADC2
  • GD32F103ZET6内部ADC2有没有

    使用官方的库函数,ADC2根本无法初始化dma_parameter_struct dma_data_parameter; rcu_periph_clock_enable(RCU_GPIOF); rcu_periph_clock_enable(RCU_ADC2); rcu_periph_clock_enable(RCU_DMA1); /*配置PF*/ gpio_init(GPIOF, GPIO_MODE_AIN, GPIO_OSPEED_50MHZ, GPIO_PIN_7|GPIO_PIN_8|GPIO_PIN_9|GPIO_PIN_10); /* ADC DMA_channel configuration */ dma_deinit(DMA1, DMA_CH4); /* initialize DMA single data mode */ dma_data_parameter.periph_addr = (uint32_t)(&ADC_RDATA(ADC2)); dma_data_parameter.periph_inc = DMA_PERIPH_INCREASE_DISABLE; dma_data_parameter.memory_addr = (uint32_t)(&ADC2_ConvertedValue); dma_data_parameter.memory_inc = DMA_MEMORY_INCREASE_ENABLE; dma_data_parameter.periph_width = DMA_PERIPHERAL_WIDTH_16BIT; dma_data_parameter.memory_width = DMA_MEMORY_WIDTH_16BIT; dma_data_parameter.direction = DMA_PERIPHERAL_TO_MEMORY; dma_data_parameter.number = M1*N1; dma_data_parameter.priority = DMA_PRIORITY_HIGH; dma_init(DMA1, DMA_CH4, &dma_data_parameter); dma_circulation_enable(DMA1, DMA_CH4); /* enable DMA channel */ dma_channel_enable(DMA1, DMA_CH4); /*ADC配置*/ adc_deinit(ADC2); /* ADC mode config */ adc_mode_config(ADC_MODE_FREE); /* ADC contineous function enable */ adc_special_function_config(ADC2, ADC_CONTINUOUS_MODE, ENABLE); /* ADC scan mode disable */ adc_special_function_config(ADC2, ADC_SCAN_MODE, ENABLE); /* ADC data alignment config */ adc_data_alignment_config(ADC2, ADC_DATAALIGN_RIGHT); /* ADC channel length config */ adc_channel_length_config(ADC2, ADC_REGULAR_CHANNEL, M1); /*ADC0规则通道配置*/ adc_regular_channel_config(ADC2, 0, ADC_CHANNEL_7, ADC_SAMPLETIME_239POINT5); adc_regular_channel_config(ADC2, 1, ADC_CHANNEL_8, ADC_SAMPLETIME_239POINT5); adc_regular_channel_config(ADC2, 2, ADC_CHANNEL_6, ADC_SAMPLETIME_239POINT5); adc_regular_channel_config(ADC2, 3, ADC_CHANNEL_5, ADC_SAMPLETIME_239POINT5); /* ADC trigger config */ adc_external_trigger_source_config(ADC2, ADC_REGULAR_CHANNEL, ADC0_1_2_EXTTRIG_REGULAR_NONE); adc_external_trigger_config(ADC2, ADC_REGULAR_CHANNEL, ENABLE); /* enable ADC interface */ adc_enable(ADC2); delay_ms(1); /* ADC calibration and reset calibration */ adc_calibration_enable(ADC2); /* ADC DMA function enable */ adc_dma_mode_enable(ADC2); /* ADC software trigger enable */ adc_software_trigger_enable(ADC2, ADC_REGULAR_CHANNEL);

    ig DM ma DMA gd32f103zet6 ADC2

    988浏览量 5回复量 关注量
  • GD32F450IIH6的ADC2调试不通

    请教下,目前该芯片ADC0、ADC1使用时没问题的,但是ADC2打开之后采集不到数据。大佬们有没有遇到这种情况呢?ADC2和ADC0、ADC1的配置有什么区别吗?

    调试 GD32F450 ADC2 ADC1 芯片

    3009浏览量 1回复量 关注量