Hi to everyone,
I am a newbie in STM32 programation and I m not actually sure that is the right way to ask my question...
I hope I can find some help because I have some issues just for basic stuff.
Here is a little description : I have a STM32F405 board with a battery integrated and the voltage measure is plug on the PA2 entry of the board. After some search on internet, I am using ADC to read that measure and the return value is 4095. In the first place, I thought that was done but when I let the battery discharge itself, the return value still is 4095...
Can you explain me what's wrong in my code or eventually show me some documentation ?
int ConvertedValue = 0;
ConvertedValue = adc_convert_bat();
printf("Value battery : %d\n", ConvertedValue);
ADC_RegularChannelConfig(ADC1, ADC_Channel_2, 1, ADC_SampleTime_144Cycles);
GPIO_initStructre.GPIO_Pin = GPIO_Pin_2;
GPIO_initStructre.GPIO_Mode = GPIO_Mode_AN;
GPIO_initStructre.GPIO_PuPd = GPIO_PuPd_NOPULL;
ADC_init_structure.ADC_DataAlign = ADC_DataAlign_Right;
ADC_init_structure.ADC_Resolution = ADC_Resolution_12b;
ADC_init_structure.ADC_ContinuousConvMode = ENABLE;
ADC_init_structure.ADC_ExternalTrigConv = ADC_ExternalTrigConv_T1_CC1;
ADC_init_structure.ADC_ExternalTrigConvEdge = ADC_ExternalTrigConvEdge_None;
ADC_init_structure.ADC_NbrOfConversion = 1;
ADC_init_structure.ADC_ScanConvMode = DISABLE;
Thanks to you all and sorry if the message is send at a wrong place...