Skip to main content
Visitor II
April 23, 2021
Question

STM32F373 SDADC1 - VREFSD+ pin - STLink error when set to forced to internal 1.22V

  • April 23, 2021
  • 5 replies
  • 1953 views

Hi, I have an STM32F373. If I have the VREFSD+ tied to 3.3V and have it set to Forced Externally using VREF pin in the SDADC1 of the .ioc file, then the MCU will flash properly.

However, if I disconnect VREFSD+ from the 3.3V, and set it to "Forced Internally to 1.22V VREFINT" in the SDADC1 section of the .ioc file, then the MCU will not flash.

I only get STLink errors in STM32CubeIDE (failed to start GDB server, target no device found, Error in initializing ST-Link device). Reason: no device found on target.

Any help is much appreciated as I cannot debug if STLink won't even connect when VREFSD+ is disconnected from 3.3V.

    This topic has been closed for replies.

    5 replies

    LCove.1Author
    Visitor II
    April 28, 2021

    Turns out I had to download STMCubeProgrammer, erase the chip, then it will let me re-flash the chip and debug. It is getting hung up on the SystemClock_Config();. Still troubleshooting why.

    LCove.1Author
    Visitor II
    April 28, 2021

    Now it is getting past Systemclock_Config() but it is now getting hung up inside MX_SDADC1_Init();

    LCove.1Author
    Visitor II
    April 28, 2021

    It is getting stuck inside

    stm32f3xx_hal_sdadc.c

    at this 2nd line here:

      SDADC1->CR1 &= ~(SDADC_CR1_REFV);

      SDADC1->CR1 |= hsdadc->Init.ReferenceVoltage;

    LCove.1Author
    Visitor II
    April 29, 2021

    So I found while debugging that it is setting hsdadc->Init.ReferenceVoltage to 256 when Vref is set to Forced Internally to 1.22V instead of 1.

    If it to Forced Internally to 1.8V, then it sets that Init.Referencevoltage to 512 instead of 2 (binary 10) like the datasheet says. If I hard-code it to 1, then the STM32 will run the code. Strange because all this is all generated by the .ioc setup.

    LCove.1Author
    Visitor II
    April 29, 2021

    This is what I mean:

    //hsdadc1.Init.ReferenceVoltage = SDADC_VREF_VREFINT1; //this is generated by .ioc (does not work) but it gets set to 256 in the debugger.

     hsdadc1.Init.ReferenceVoltage = 1; // this works