cancel
Showing results for 
Search instead for 
Did you mean: 

STM32G4 Reset Issue

Rob Ashworth
Senior

I am having some strange power up (I think) issue with my STM32G431 controller.  Sometimes it runs for a second or two, sometimes nothing.  It will usually not connect via the SWDIO pins so it is difficult to step through in debug to see where the problem is.  I'm suspecting a problem with the clock configuration, SWDIO pins not defaulting to their proper state, or Reset pin problem.  None of which I can put my finger on.  I am used to STM32F4, H7, this is the first time I have used the G4, so willing to accept the problem is on my side!  Any help or pointer appreciated.  I use CubeIDE to configure the clock and generate all of the initialisation code, via the .ioc file. 

 

void SystemClock_Config(void)
{
  RCC_OscInitTypeDef RCC_OscInitStruct = {0};
  RCC_ClkInitTypeDef RCC_ClkInitStruct = {0};

  /** Configure the main internal regulator output voltage
  */
  HAL_PWREx_ControlVoltageScaling(PWR_REGULATOR_VOLTAGE_SCALE1_BOOST);

  /** Initializes the RCC Oscillators according to the specified parameters
  * in the RCC_OscInitTypeDef structure.
  */
  RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE;
  RCC_OscInitStruct.HSEState = RCC_HSE_ON;
  RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
  RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE;
  RCC_OscInitStruct.PLL.PLLM = RCC_PLLM_DIV1;
  RCC_OscInitStruct.PLL.PLLN = 40;
  RCC_OscInitStruct.PLL.PLLP = RCC_PLLP_DIV2;
  RCC_OscInitStruct.PLL.PLLQ = RCC_PLLQ_DIV8;
  RCC_OscInitStruct.PLL.PLLR = RCC_PLLR_DIV2;
  if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK)
  {
    Error_Handler();
  }

  /** Initializes the CPU, AHB and APB buses clocks
  */
  RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK
                              |RCC_CLOCKTYPE_PCLK1|RCC_CLOCKTYPE_PCLK2;
  RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK;
  RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1;
  RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV1;
  RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV1;

  if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_4) != HAL_OK)
  {
    Error_Handler();
  }
  HAL_RCC_MCOConfig(RCC_MCO1, RCC_MCO1SOURCE_HSE, RCC_MCODIV_1);
}

STM32G4 Schematic.jpg

24 REPLIES 24
Slh
Senior

Check if you have a hardware issue. For that you can put a delay for example for 5 second in start of your program. If this delay passed and the problem occurs after delay, then there is no problem in your code and problem can be something else like resetting/hanging microcontroller by switching a loud.

 

LCE
Principal

No capacitors at X1 ?
Is the G4 special concerning passive crystals, or are the caps somewhere else?
If not, that might be your start-up problem.

To confirm that, switch to HSI for testing.

Bubbles
ST Employee

Besides of what was already written, I expect the EPAD to be the exposed pad under the package. It's recommended to solder that to PCB ground.

BR,

J

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

TDK
Guru

In addition to missing caps on X1, are there decoupling caps anywhere else? None are shown on your schematic. Each VDD pin needs a 0.1 uF cap, plus a bulk capacitor somewhere on the board.

Guessing the missing EPAD connection is the core issue here.

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

Thanks for all you suggestions.  For info, the crystal shown is actually a resonator, which includes the caps internally.  I did try the internal HSI, with similar problems, so I don't suspect the crystal.  I do however suspect it could be the EPAD!!  Give me a little while to confirm....

Thanks, I tried the internal HSI with similar issues, and the crystal is a ceramics resonator with built in caps.

 

Rob Ashworth
Senior

Update, the situation is no better.  I soldered the EPAD, and it made no difference.  I don't get what possible mechanism completely fries the controller.  The PSU is stable 3.3V, monitoring with oscilloscope.  I am on my 4th STM32G now. Is there any machismo that completely frazzles the thing when the PSU looks to be ok?  All 4 controllers now cannot be programmed, and 1 is a complete short circuit.

LCE
Principal

How did you actually connect the EPAD?
I mean, it's a QFN package, and getting the pad soldered that is completely underneath the chip, AND connecting that EPAD to GND is no simple thing, if it wasn't connected to GND from the beginning. 
That screams "solder bridges" somewhere...

For prototyping I prefer LQFP...

Solder to the EPAD retrospectively wasn't easy.  I used a very thin wire to link underneath.  Happy as I could be it was ok, although admittedly I could not X-RAY.  I have used 3 different versions of the PCB attempting to fix the fault, so happy it is also not a Soldering issue, as the fault is always the same.