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触发也只是能转换一次,是哪里配置错误吗? |
STM32G0B1adc+dma采样数据错位
STM32G474 HRTIM无法正常触发ADC
ADC每次开始采样直流电压时,会出现尖峰波形?
STM32G431RB,变量接受不到串口发下去的数据
foc电流环无法正确维持Iq在自己设定的数值。
ADC各个通道转换
STM32G431 用MCSDK5.4.8 进行PMSM永磁同步电机FOC控制,转速上升到某一值(3500rpm)无法继续上升,上不去
STM32G431KBU3 只要开中断HAL_xxxx_Start_IT()就死机一动不动
STM32G474HRTIM中断跳到硬件错误中断问题
F302R8电机驱动三角函数为什么用定点查表方式
可能调试模块没有做更新,你也没有啥操作。
保持现有 配置的前提下,你这样试试,先软件启动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