2017-03-31 02:59 PM
I am using ADC1 in scan mode. When I run my code normally through the debugger, it works just fine. However, when I remove the debugger and directly run it, I am seeing extremely low voltages. What could possibly be the reason for this? Has anyone else seen this? I have compiler optimization turned off to ensure there isnt much of a difference due to compiler optimization. It does not happen on all boards and only on 10%. I have also tried slowing the ADC sample times to as low as possible(239.5 cycles). I normally run them on 1.5 on all boards and I am good (with and without debugger). I have also reviewed the board under a microscope and there is no hardware issue. FWIW, I am supposed to read 24V and I am reading 2.36V.
2017-03-31 03:37 PM
24V? Assuming that is a typo
Is the debugger introducing power to the board?
Check the VREF and VDDA voltages?
Assuming an STM32F1 type product, helps to be specific.
Check the the ADC using the VREFINT (Internal reference, 1.25V?)
2017-03-31 10:59 PM
What STM32 part number is it? When using debugger, how? Just run, no breakpoint and no live watch variable window?
Is VDDa / VDDa connected to supply voltage? analog input should remain within 0 V and VDDa voltage for the ADC.
2017-03-31 11:15 PM
I reckon your debbuger is feeding a power supply to your MCU as well, that's why it's dropped when you plug it out
2017-04-01 06:58 PM
Its an XL density - STM32F103Z part. I suspect the debugger is introducing power to the board. But it seems to fix the problem. I am wondering why the behavior ceases.
2017-04-01 08:55 PM
Yes, sorry its a scaled value. The raw value is 0-3V. So analog of 24V should be read as 1.699V. But I am seeing 0.02V.
2017-04-01 09:01 PM
It doesnt matter, if I start the debugger, it works. If I remove it and run binary, it does not work.
2017-04-02 06:14 AM
Run with the debuuger, then unplug it to see what happen.
2017-04-02 08:39 AM
Its an XL density - STM32F103Z part. I suspect the debugger is introducing power to the board. But it seems to fix the problem. I am wondering why the behavior ceases.
2017-04-02 08:47 AM
Not familiar with the board design.
I'd make sure that the BOOT0 pin is pulled low for normal operation.
Make sure all the clocks you need are enabled, the debugger may configure some settings to suit its needs, so might not entirely reflect normal reset conditions.