#392 Start of any ADC disables VREF and VBAT


The whole CCR register is written, clearing these two bits. As a result any previous calls to adcSTM32EnableTSVREFE() or adcSTM32EnableVBATE() are ineffective.


1- start ADC1
2- enable VREF and/or VBAT
3- start ADC2.

Step (3) disables VREF and VBAT. One might argue that the developer should know better and enable VREF and/or VBAT after all ADCs have been started, but that approach hinders code modularity.

See attached trivial patch.

BTW: I\'ve noticed that whenever the reference manual describes a bit as \"reserved, must be kept at reset value\", the ChibiOS/RT code just sets it to zero. Maybe I\'m being a bit overzealous, but isn\'t it asking for trouble in the future? (for example when new silicon revisions are rolled out).


  • Fixed in repository will be fixed in 2.4.4stable and 2.5.2unstable.

    About the reserved bits better open a discussion in the forum, it is hard to follow threads here.

    • assigned_to: nobody --> gdisirio
    • priority: 5 --> 3
    • milestone: 953057 --> 2.4.0
    • status: open --> open-accepted
    • status: open-accepted --> open-fixed
    • status: open-fixed --> closed-fixed