AnsweredAssumed Answered

MQX 3.8 - twrk60n512 - ADC Bug

Question asked by Bob Grice on May 16, 2012
Latest reply on Jun 21, 2012 by Teckna Teckna

I believe that there is a bug in adt_period_prescaler in $MQX$/source/io/adc/kadc


The statement at line 370 :

 pdb_external.prescaler = (int_8) pdb_prescaler;


uses pdb_prescaler which is not initialised unless the code has previously gone through the 'if' block starting at line 291 (i.e. on the second and subsequent calls to the function the variable is not initialised). This in turn can cause ADC_ERROR_BAD_PARAM to be returned as it corrupts pdb_external.prescaler in later calls to the function (in the else case).


I believe the line should be moved to the end of the 'if' block