[STM32L4R9I Discovery Kit]ADC+DMA problems.
I would like to construct an sampling system via using ADC+DMA method on STM32L4R9I official Discovery Board. I use STM32CubeMX to configure the peripherals and then compose the HAL code in Keil-MDK. The problem I met is ADC&DMA works well, but the sampling value from temperature sensor is 4095(always appears this value). How can I solve this problem?
The configurations of peripherals are as follows.
1. ADC1 only connects to Temperature Sensor Channel(detailed configurations are showed in figure1).
2.DMA is configured as follows
3.main code(only edited parts are displayed)
/* USER CODE BEGIN 2 */
HAL_ADCEx_Calibration_Start(&hadc1,ADC_SINGLE_ENDED);
HAL_ADC_Start_DMA(&hadc1,(uint32_t*)&val,1);
/* USER CODE END 2 */
/* Infinite loop */
/* USER CODE BEGIN WHILE */
while (1)
{
/* USER CODE END WHILE */
/* USER CODE BEGIN 3 */
int i=val;
data[0]=48+i/1000;
data[1]=48+(i%1000)/100;
data[2]=48+(i%100)/10;
data[3]=48+i%10;
data[4]=0x0d;
data[5]=0x0a;
HAL_UART_Transmit(&huart3,data,6,1000);
HAL_ADC_Start(&hadc1);
HAL_Delay(20);
}
/* USER CODE END 3 */