-With 12 bit ADC, minimal value is 0x0000, max is 0x0fff.
-ADC_InitTypeDef Structure:
-To free the CPU here, use DMA to store converted value
-DMA Configurations:
1. ADC input/output pin configuration, means set the pin mode.
2. enable the AHB peripheral clk for DMA1/2
3. reset the DMA channel->set the parameters for DMA structure->initial the DMA channel with the DMA structure.
4.enable the DMA channel using DMA_Cmd
-ADC configurations:
1. enable the APB2 peripheral clk on both ADC1 and GPIOx
2. set the parameters for ADC structure
3. use the ADC_RegularChannelConfig function to set the ADC's channel number, rank and sampling times
4. enable DMA and ADC connection using ADC_DMACmd()
5. enable ADC using ADC_Cmd
6. To reduce the ADC error, new capacitance need to be calculated.
reset the ADC calibration register using-> ADC_ResetCalibration(), and then probe the ADC_GetResetCalibrationStatus() until it's SET.
recalibrate the ADC with ADC_StartCalibration(), probe ADC_GetCalibrationStatus() until it's SET.
7 Finally, enable conversion with ADC_SoftwareStartConvCmd();







No comments:
Post a Comment