我用了ADC1,ADC2,ADC3,DMA1_Stream0,DMA1_Stream1,BDMA_Channel0,ADC1.ADC2.回调函数都是正常工作,就是ADC3.回调函数不能正常工作。有没有遇到这种情况的 芯片是STM32H750.ADC分频得80MHZ HAL_RCC_DMA1_CLK_ENABLE(); HAL_RCC_ADC12_CLK_ENABLE(); hadc1.Instance = ADC1; hadc1.Init.ClockPrescaler = ADC_CLOCK_ASYNC_DIV10; hadc1.Init.Resolution = ADC_RESOLUTION_16B; hadc1.Init.ScanConvMode = ADC_SCAN_ENABLE; hadc1.Init.EOCSelection = ADC_EOC_SINGLE_CONV; hadc1.Init.LowPowerAutoWait = DISABLE; hadc1.Init.ContinuousConvMode = ENABLE; hadc1.Init.NbrOfConversion = 0x04U; hadc1.Init.DiscontinuousConvMode = ENABLE; hadc1.Init.ExternalTrigConv = ADC_SOFTWARE_START; hadc1.Init.ExternalTrigConvEdge = ADC_EXTERNALTRIGCONVEDGE_NONE; hadc1.Init.ConversionDataManagement = ADC_CONVERSIONDATA_DMA_CIRCULAR; hadc1.Init.Overrun = ADC_OVR_DATA_PRESERVED; hadc1.Init.LeftBitShift = ADC_LEFTBITSHIFT_NONE; hadc1.Init.OversamplingMode = DISABLE; HAL_ADC_Init(&hadc1) ; HAL_ADCEx_Calibration_Start(&hadc1, ADC_CALIB_OFFSET, ADC_SINGLE_ENDED); /* Configure the ADC multi-mode / multimode.Mode = ADC_MODE_INDEPENDENT; if (HAL_ADCEx_MultiModeConfigChannel(&hadc1, &multimode) != HAL_OK) { Error_Handler(); } hadc1.Instance = ADC2; hadc1.Init.ClockPrescaler = ADC_CLOCK_ASYNC_DIV10; hadc1.Init.Resolution = ADC_RESOLUTION_16B; hadc1.Init.ScanConvMode = ADC_SCAN_ENABLE; hadc1.Init.EOCSelection = ADC_EOC_SINGLE_CONV; hadc1.Init.LowPowerAutoWait = DISABLE; hadc1.Init.ContinuousConvMode = ENABLE; hadc1.Init.NbrOfConversion = 0x04U; hadc1.Init.DiscontinuousConvMode = ENABLE; hadc1.Init.ExternalTrigConv = ADC_SOFTWARE_START; hadc1.Init.ExternalTrigConvEdge = ADC_EXTERNALTRIGCONVEDGE_NONE; hadc1.Init.ConversionDataManagement = ADC_CONVERSIONDATA_DMA_CIRCULAR; hadc1.Init.Overrun = ADC_OVR_DATA_PRESERVED; hadc1.Init.LeftBitShift = ADC_LEFTBITSHIFT_NONE; hadc1.Init.OversamplingMode = DISABLE; HAL_ADC_Init(&hadc2) ; HAL_ADCEx_Calibration_Start(&hadc2, ADC_CALIB_OFFSET, ADC_SINGLE_ENDED); HAL_RCC_BDMA_CLK_ENABLE(); HAL_RCC_ADC3_CLK_ENABLE(); hadc3.Instance = ADC3; hadc3.Init.ClockPrescaler = ADC_CLOCK_ASYNC_DIV10; hadc3.Init.Resolution = ADC_RESOLUTION_16B; hadc3.Init.ScanConvMode = ADC_SCAN_ENABLE; hadc3.Init.EOCSelection = ADC_EOC_SINGLE_CONV; hadc3.Init.LowPowerAutoWait = DISABLE; hadc3.Init.ContinuousConvMode = ENABLE; hadc3.Init.NbrOfConversion = 0x04U; hadc3.Init.DiscontinuousConvMode = ENABLE; hadc3.Init.ExternalTrigConv = ADC_SOFTWARE_START; hadc3.Init.ExternalTrigConvEdge = ADC_EXTERNALTRIGCONVEDGE_NONE; hadc3.Init.ConversionDataManagement = ADC_CONVERSIONDATA_DMA_CIRCULAR; hadc3.Init.Overrun = ADC_OVR_DATA_PRESERVED; hadc3.Init.LeftBitShift = ADC_LEFTBITSHIFT_NONE; hadc3.Init.OversamplingMode = DISABLE; HAL_ADC_Init(&hadc3) ; HAL_ADCEx_Calibration_Start(&hadc3, ADC_CALIB_OFFSET, ADC_SINGLE_ENDED); hdma_adc1.Instance = DMA1_Stream0; hdma_adc1.Init.Request = DMA_REQUEST_ADC1; hdma_adc1.Init.Direction = DMA_PERIPH_TO_MEMORY; hdma_adc1.Init.PeriphInc = DMA_PINC_DISABLE; hdma_adc1.Init.MemInc = DMA_MINC_ENABLE; hdma_adc1.Init.PeriphDataAlignment = DMA_PDATAALIGN_HALFWORD; hdma_adc1.Init.MemDataAlignment = DMA_MDATAALIGN_HALFWORD; hdma_adc1.Init.Mode = DMA_CIRCULAR; hdma_adc1.Init.Priority = DMA_PRIORITY_MEDIUM; hdma_adc1.Init.FIFOMode = DMA_FIFOMODE_DISABLE; HAL_DMA_Init(&hdma_adc1); __HAL_LINKDMA(adcHandle,DMA_Handle,hdma_adc1); / DMA1_Stream0_IRQn interrupt configuration / HAL_NVIC_SetPriority(DMA1_Stream0_IRQn, 4, 0); HAL_NVIC_EnableIRQ(DMA1_Stream0_IRQn); hdma_adc1.Instance = DMA1_Stream1; hdma_adc1.Init.Request = DMA_REQUEST_ADC2; hdma_adc1.Init.Direction = DMA_PERIPH_TO_MEMORY; hdma_adc1.Init.PeriphInc = DMA_PINC_DISABLE; hdma_adc1.Init.MemInc = DMA_MINC_ENABLE; hdma_adc1.Init.PeriphDataAlignment = DMA_PDATAALIGN_HALFWORD; hdma_adc1.Init.MemDataAlignment = DMA_MDATAALIGN_HALFWORD; hdma_adc1.Init.Mode = DMA_CIRCULAR; hdma_adc1.Init.Priority = DMA_PRIORITY_MEDIUM; hdma_adc1.Init.FIFOMode = DMA_FIFOMODE_DISABLE; HAL_DMA_Init(&hdma_adc2); __HAL_LINKDMA(adcHandle,DMA_Handle,hdma_adc2); / DMA1_Stream1_IRQn interrupt configuration / HAL_NVIC_SetPriority(DMA1_Stream1_IRQn, 4, 1); HAL_NVIC_EnableIRQ(DMA1_Stream1_IRQn); hdma_adc3.Instance = BDMA_Channel0; hdma_adc3.Init.Request = BDMA_REQUEST_ADC3; hdma_adc3.Init.Direction = DMA_PERIPH_TO_MEMORY; hdma_adc3.Init.PeriphInc = DMA_PINC_DISABLE; hdma_adc3.Init.MemInc = DMA_MINC_ENABLE; hdma_adc3.Init.PeriphDataAlignment = DMA_PDATAALIGN_HALFWORD; hdma_adc3.Init.MemDataAlignment = DMA_MDATAALIGN_HALFWORD; hdma_adc3.Init.Mode = DMA_CIRCULAR; hdma_adc3.Init.Priority = DMA_PRIORITY_MEDIUM; hdma_adc3.Init.FIFOMode = DMA_FIFOMODE_DISABLE;
__HAL_LINKDMA(adcHandle,DMA_Handle,hdma_adc3); / DMA interrupt init / / BDMA_Channel0_IRQn interrupt configuration / HAL_NVIC_SetPriority(BDMA_Channel0_IRQn, 4, 2); HAL_NVIC_EnableIRQ(BDMA_Channel0_IRQn); /**
void HAL_ADC_ConvCpltCallback(ADC_HandleTypeDef* hadc) {
} void DMA1_Stream0_IRQHandler(void) { HAL_DMA_IRQHandler(&hdma_adc1); } void DMA1_Stream1_IRQHandler(void) { HAL_DMA_IRQHandler(&hdma_adc2); } /**
HAL_DMA_IRQHandler(&hdma_adc3); } |
DMA发送函数只能被调用一次
STM32L431进入STOP1模式后ADC产生多余功耗
STM32H750内部flash读写
STM32H743采用flash swap 进行IAP升级,reset后启动不了
STM32双核H7核间通信的方法
关于STM32F4的ADC测量不准确
STM32H743IIC,HAL库驱动硬件I2C,hi2c2.state一直是busy. 为什么?
H747 DSI 模块的官方例程跑不通
L9663驱动开发
MAC回环或以太网PHY芯片回环怎么实现?
芯片是STM32H750VBT6.ADC分频得30 就是ADC3.回调函数不能正常工作,ADC1,ADC3回调函数能正常工作;