2016-07-21 01:36 AM
int
main( void ) { HAL_Init(); MX_GPIO_Init(); MX_ADC_Init(); MX_TIM2_Init(); if (HAL_ADCEx_Calibration_Start(&hadc, ADC_SINGLE_ENDED) != HAL_OK) Error_Handler(); } /* Start ADC conversion with transfer by DMA */ if (HAL_ADC_Start_DMA(&hadc, (uint32_t *)ADC_DMA_val, nbrADCchannel) != HAL_OK) Error_Handler(); } while (1) { // Is it needed to start DMA again ??????????? // HAL_ADC_Start_DMA(&hadc, (uint32_t *)ADC_DMA_val, nbrADCchannel) HAL_ADC_Start(&hadc); HAL_PWR_EnterSTOPMode(PWR_LOWPOWERREGULATOR_ON, PWR_STOPENTRY_WFI); } } void HAL_ADC_ConvCpltCallback(ADC_HandleTypeDef *hadc) { /* Read captured ADC values */ } Thanks, Bien2016-07-21 05:16 AM
Hi le.bien,
In stop mode, all peripheral clocks are gated. To make your application operate correctly, on entering stop mode , disable ADC then DMA. On return enable DMA then ADC. Note, that if your system clock is different from HSI setting , you out to reconfigure it after exiting the stop mode. -Hannibal-2016-07-21 07:03 AM
Hi Hannibal
Thanks, your info helps me alot. Just to make sure I understand correctly: - On entering Stop mode: HAL_ADC_Stop --> HAL_ADC_Stop_DMA
- On returning from Stop mode:
HAL_ADC_Start_DMA --> HAL_ADC_Start
And I also have to do the same thing for e.g Timers and other modules right ?
Thanks again
Bien