STM32L0 How do i disconnect the SW-DB once connected
Hi, I am using an STM32L053xx in StandBy mode for 500ms and Run mode for 2ms. I have noticed in StandBy my PCB draws about 120u amps more after the SW-DB has been connected.
To correct this I need to disconnect the SW-DB cable and power down the PCB. When the PCB powers up it is drawing 120u amps less power.
Now the STM32L0 dosnt have a Batt pin so I have a fat cap keeping the power up for RTC etc. This means a 'Power On' reset dosen't work or takes a long time.
I am assuming the MCU thinks its got a debugger attached and working harder to keep the debugger happy.
I have tried HAL_GPIO_DeInit(GPIOA, GPIO_PIN_13); HAL_GPIO_DeInit(GPIOA, GPIO_PIN_14); but still the current wont reduce without a power down reset.
Can anyone help??
I can test if the debugger is connected by using: (this detects the debugger connected reliably)
if (HAL_GPIO_ReadPin(GPIOA, GPIO_PIN_13) && !HAL_GPIO_ReadPin(GPIOA, GPIO_PIN_14)) {
// Ye change the SW ports to DIO HAL_GPIO_DeInit(GPIOA, GPIO_PIN_13); HAL_GPIO_DeInit(GPIOA, GPIO_PIN_14);Is there a flag or function I can call to disconnect the debugger??
Is there a nicer way to test if the debugger is connected??
Thanks
Kevin
