cancel
Showing results for 
Search instead for 
Did you mean: 

L431 Stops working after enabling ADC

ZJing
Associate III

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:

ZJing_0-1694859495061.png

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

1 ACCEPTED SOLUTION

Accepted Solutions

Check VDDA vs NRST on a scope.

Make sure ALL supply pins are suitable connected

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

View solution in original post

5 REPLIES 5

Check VDDA vs NRST on a scope.

Make sure ALL supply pins are suitable connected

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Tinnagit
Senior II

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?

TDK
Guru

Pin 19 needs connected to power, as @Tesla DeLorean says. Could be other schematic errors, show the full schematic if you can.

TDK_0-1694873144480.png

 

If you feel a post has answered your question, please click "Accept as Solution".

Thank you! I did not connect one of the supply pins. That was the problem

ZJing
Associate III

I did forget to connect that pin, so yes it was the problem