Question
STOne-32 ADC Lib Examples Problem
Posted on February 24, 2012 at 18:11
The F4 library ADC examples typically contain the following structure initialization:
/* ADC1 Init ****************************************************************/ ADC_InitStructure.ADC_Resolution = ADC_Resolution_12b; ADC_InitStructure.ADC_ScanConvMode = DISABLE; ADC_InitStructure.ADC_ContinuousConvMode = ENABLE; ADC_InitStructure.ADC_ExternalTrigConvEdge = ADC_ExternalTrigConvEdge_None; ADC_InitStructure.ADC_DataAlign = ADC_DataAlign_Right; ADC_InitStructure.ADC_NbrOfConversion = 1; ADC_Init(ADC1, &ADC_InitStructure); The structure contains a 7th value not initialized in the examples: ADC_InitStructure.ADC_ExternalTrigConv = x; The example code assumes that memory in initialized to zero, which can be a bad assumption. My EWARM environment does not, and it caused strange results and an assertion error. Forum posts by others have been triggered by the same problem. Fix all the ADC library examples with this problem. In the interim, users should initialize the value to zero if there is no external trigger. Cheers, Hal