L431 Stops working after enabling ADC
Hello all,
I recently ran into this problem where the MCU would instantly stop working after enabling the DAC. The behavior is that from the debug view of STM32IDE the program is still running, but all variable values are reset to 0, and once the program is paused manually, instead of showing where exactly the program was paused at, it shows a blank window with some HEX address.
Below is the DAC connection schematic:

The DAC output pin is connected to an op-amp and a bjt to drive the 5 turns coil
Below is the GPIO and DAC init codes:
/*TOUT GPIO Configuration
PA4 ------> TOUT
*/
GPIO_InitStruct.Pin = TOUT_PIN;
GPIO_InitStruct.Mode = LL_GPIO_MODE_ANALOG;
GPIO_InitStruct.Pull = LL_GPIO_PULL_NO;
LL_GPIO_Init(TOUT_PORT, &GPIO_InitStruct);static void DAC_Init(void)
{
LL_DAC_InitTypeDef DAC_InitStruct = {0};
/* Peripheral clock enable */
LL_APB1_GRP1_EnableClock(LL_APB1_GRP1_PERIPH_DAC1);
/** DAC channel OUT1 config
*/
DAC_InitStruct.TriggerSource = LL_DAC_TRIG_SOFTWARE;
DAC_InitStruct.WaveAutoGeneration = LL_DAC_WAVE_AUTO_GENERATION_NONE;
DAC_InitStruct.OutputBuffer = LL_DAC_OUTPUT_BUFFER_ENABLE;
DAC_InitStruct.OutputConnection = LL_DAC_OUTPUT_CONNECT_GPIO;
DAC_InitStruct.OutputMode = LL_DAC_OUTPUT_MODE_NORMAL;
LL_DAC_Init(DAC1, LL_DAC_CHANNEL_1, &DAC_InitStruct);
LL_DAC_DisableTrigger(DAC1, LL_DAC_CHANNEL_1);
}
What could cause this behavior? Any idea/suggestion would be greatly appreciated!
Zhi
