2018-01-19 01:25 AM
2018-01-19 03:54 AM
I have an 091, scan mode is on, but continuous conversion is off.
void HAL_ADC_ConvCpltCallback(ADC_HandleTypeDef* hadc) {
if(!ADC_ChannelsCounter--) {
ADC_ChannelsCounter = ADC_ChannelCount;
HAL_ADC_CompleteCycle = true; // signal foreground to process
for(int i = 0 ; i < ADC_ChannelCount ; i++)
HAL_ADC_Channel_Buffer[ADC_RowCounter][i] = ADC_DMABuffer[i];
}
}�?�?�?�?�?�?�?�?�?�?�?�?�?
2018-01-19 04:52 AM
Here is some extra info in case it is useful.
DMA configuration and ADC GPIO configuration as it is in the source code:
GPIO_InitStruct.Pin = GPIO_PIN_0|GPIO_PIN_1|GPIO_PIN_2|GPIO_PIN_3;
GPIO_InitStruct.Mode = GPIO_MODE_ANALOG_ADC_CONTROL; GPIO_InitStruct.Pull = GPIO_NOPULL; HAL_GPIO_Init(GPIOC, &GPIO_InitStruct); /* ADC1 DMA Init */ /* ADC1 Init */ hdma_adc1.Instance = DMA1_Channel1; hdma_adc1.Init.Request = DMA_REQUEST_0; 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_WORD; hdma_adc1.Init.Mode = DMA_CIRCULAR; hdma_adc1.Init.Priority = DMA_PRIORITY_MEDIUM; if (HAL_DMA_Init(&hdma_adc1) != HAL_OK) { _Error_Handler(__FILE__, __LINE__); } __HAL_LINKDMA(adcHandle,DMA_Handle,hdma_adc1);Also I am using the V1.10 pack for the STM32L4 family on cubeMX.
2018-01-19 05:35 AM
Thanks for the reply T J. Unfortunately if I disable continuous mode, I'll just get one set of results. Only one conversion of the 4 channels takes place (or whatever it is doing since the values should be 4095 0 X X ... and I get X X X X and sometimes 4095 X X X).