void MX_ADC3_Init(void) { ADC_MultiModeTypeDef multimode = {0}; ADC_ChannelConfTypeDef sConfig = {0}; hadc3.Instance = ADC3; hadc3.Init.ClockPrescaler = ADC_CLOCK_SYNC_PCLK_DIV4; hadc3.Init.Resolution = ADC_RESOLUTION_12B; hadc3.Init.DataAlign = ADC_DATAALIGN_RIGHT; hadc3.Init.GainCompensation = 0; hadc3.Init.ScanConvMode = ADC_SCAN_DISABLE; hadc3.Init.EOCSelection = ADC_EOC_SINGLE_CONV; hadc3.Init.LowPowerAutoWait = DISABLE; hadc3.Init.ContinuousConvMode = ENABLE; hadc3.Init.NbrOfConversion = 1; hadc3.Init.DiscontinuousConvMode = DISABLE; hadc3.Init.ExternalTrigConv = ADC_SOFTWARE_START; hadc3.Init.ExternalTrigConvEdge = ADC_EXTERNALTRIGCONVEDGE_NONE; hadc3.Init.DMAContinuousRequests = DISABLE; hadc3.Init.Overrun = ADC_OVR_DATA_PRESERVED; hadc3.Init.OversamplingMode = DISABLE; if (HAL_ADC_Init(&hadc3) != HAL_OK) { Error_Handler(); } /** Configure the ADC multi-mode */ multimode.Mode = ADC_MODE_INDEPENDENT; if (HAL_ADCEx_MultiModeConfigChannel(&hadc3, &multimode) != HAL_OK) { Error_Handler(); } /** Configure Regular Channel */ sConfig.Channel = ADC_CHANNEL_1; sConfig.Rank = ADC_REGULAR_RANK_1; sConfig.SamplingTime = ADC_SAMPLETIME_92CYCLES_5; sConfig.SingleDiff = ADC_SINGLE_ENDED; sConfig.OffsetNumber = ADC_OFFSET_NONE; sConfig.Offset = 0; if (HAL_ADC_ConfigChannel(&hadc3, &sConfig) != HAL_OK) { Error_Handler(); } /* USER CODE BEGIN ADC3_Init 2 */ /* USER CODE END ADC3_Init 2 */ } HAL_ADCEx_Calibration_Start(&hadc3, ADC_SINGLE_ENDED); HAL_ADC_Start(&hadc3); 仿真时,查看DR寄存器,只有在开始运行仿真时转换一次就不再转换,改成外部TIM触发也只是能转换一次,是哪里配置错误吗? |
关于STM32F4的ADC测量不准确
与HAL_ADC_Start_DMA相关的一个十分怪异的问题
双重ADC的DMA请求
stm32g474 板卡偶发flash的某块代码区被擦除
L99H92 的驱动问题?
ADC硬件过采样是怎么实现的
STM32的H5/U5系列处理器内置运放支持负压运算吗?比如输入-1V,放大倍数为2时输出-2V
STM32G474 ADC多通道采集结果为同一通道结果?
STM32G473 CAN发送数据出现丢帧的情况,怎么解决?
stm32g474的开发板很烫
可能调试模块没有做更新,你也没有啥操作。
保持现有 配置的前提下,你这样试试,先软件启动ADC,然后查询接收,再看看结果。
int main(void)
{
。。。。。。
。。。。。。
uint8_t i=0;
HAL_ADC_Start(&hadc1);
while (1)
{
if (HAL_ADC_PollForConversion(&hadc1, 888) != HAL_OK)
{
Error_Handler();
}
AdcResulti++] = HAL_ADC_GetValue(&hadc1);
if(i==9) i=0;
} //while(1)
} //main