This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TM4C129ENCPDT: Analog comparator internal reference wrong in driver library

Part Number: TM4C129ENCPDT
Other Parts Discussed in Thread: LM3S8962

The TivaWare driver library (2.1.4.178) has incorrect and some missing #defines for the analog comparator internal reference setting.

The TivaWare driver library (driverlib/comp.h) internal reference values quoted in the COMP_REF_XXXX #defines do not match the TM4C129E datasheet values in section 25.3.1 and 30.21.

Looking at the StellarisWare driver library,  TivaWare is a copy paste from that for this peripheral

This copy/paste didn't take into account the apparent change in comparator reference hardware as the formulas in the datasheets yield different values (TM4C129E vs LM3S8962).

  • Alexander Rudzki said:
    This copy/paste didn't take into account the apparent change in comparator reference hardware as the formulas in the datasheets yield different values (TM4C129E vs LM3S8962).

    Yea it's kind of WOE head scratch but they still work as an average trip value for both datasheet tables.

  • Hi Alexander,

      The TM4C129 has the formula of:

      VIREF (VREF) = VREF * (VDDA/ 22.12 for RNG=1.

      If I pick VREF=15 I should get VIREF=15*(3.3/22.12)=2.238V. This is matching the table shown in the datasheet. 

     In the TM4C comp.h for RNG=1 it has the below #define for VREF=15

    #define COMP_REF_2_0625V        0x0000030F  // Internal reference of 2.0625V

     Indeed the #define name is not an accurate reflection of the true reference voltage selection. It should have said #define COMP_REF_2_238V 0x00000030F to be accurate.

      Looking at the LM3S8962 it has the below forumula for RNG=1:

      If I pick VREG=15 I will get 2.145V. This is neither matching the #define. I'm not too sure how the #define names are chosen.

      I will file an internal ticket to track this. In the meantime, please don't mind the #define names but rather the voltage shown in the datasheet for a given VREF and RNG selection.

      Finally, thank you for bringing to our attention of the finding.

      

  • Thanks for the prompt responses and !

    I was using the datasheet formulas during the board design which is why I noticed the #defines to be wrong.