Skip to main content
Scott Dev
Senior
Jun 4, 2019 4:23 PM UTC
Solved

STM32L4 VREFBUF. Cant select internal 2.5v voltage reference for ADC.

Hi

I am using the STM32L433 100 pin which has the internal 2.5v vref buffer for the ADC. I am getting readings, not accurate, from the adc . Looking at the data sheet the internal vrefbuf is tied directly to the VREF+ pin, and when I measure that pin it is 3v. I am doing the following to select the 2.5v, can any think of what I am doing wrong?

ADC1->CR |= 1 << 28; //enable voltage reference

VREFBUF->CSR = 0b101; //2.5v ref selected and Internal voltage reference enabled

Many Thanks

Scott

    This topic has been closed for replies.
    Scott Dev
    Scott DevBest answer
    Senior
    Jun 5, 2019 1:54 PM UTC

    Its working fine now, I am getting 2.5v on the pin. I dont know what happened when I previously tested it.

    Thanks again :)

    Scott

    4 replies

    waclawek.jan
    Super User
    Jun 4, 2019 7:10 PM UTC

    And how do you have pin 21 connected?

    JW

    Scott Dev
    Scott DevAuthor
    Senior
    Jun 4, 2019 8:36 PM UTC

    I have a jumper where I can select an external 2.5v supply. Its a test board, but would like to use the internal 2.5v reference to reduce chip count.

    I also have VDDA to 3.3v, Vref- and VSSA to 0v,

    Regards

    Scott

    waclawek.jan
    Super User
    Jun 4, 2019 10:43 PM UTC

    OK so if you have an unprogrammed mcu or you hold in it reset, what do you measure on that pin?

    Or, in other words, under what circumstances did you measure 3V on it?

    JW

    Scott Dev
    Scott DevAuthorBest answer
    Senior
    Jun 5, 2019 1:54 PM UTC

    Its working fine now, I am getting 2.5v on the pin. I dont know what happened when I previously tested it.

    Thanks again :)

    Scott