2023-09-16 03:25 AM
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
Solved! Go to Solution.
2023-09-16 03:48 AM - edited 2023-09-16 03:49 AM
Check VDDA vs NRST on a scope.
Make sure ALL supply pins are suitable connected
2023-09-16 03:48 AM - edited 2023-09-16 03:49 AM
Check VDDA vs NRST on a scope.
Make sure ALL supply pins are suitable connected
2023-09-16 04:01 AM
I'm unsure about Low Level Initial but it has require define USE_FULL_LL_DRIVER to use function in Low Level Driver. and Is that you had define it already?
2023-09-16 07:06 AM
Pin 19 needs connected to power, as @Tesla DeLorean says. Could be other schematic errors, show the full schematic if you can.
2023-09-18 02:43 AM
Thank you! I did not connect one of the supply pins. That was the problem
2023-09-18 02:44 AM
I did forget to connect that pin, so yes it was the problem