cancel
Showing results for 
Search instead for 
Did you mean: 

STM32L051 Port PH1 Initialization Error

Jim Rodrian
Associate III
Posted on September 29, 2017 at 00:23

I used STM32CubeMX to generate code for a STM32L051R8xx microcomputer.  All I/O ports initialize correctly except PH1.  If I delete the PH1 initialization code, the program executes correctly.  With the PH1 code the microcomputer resets when it attempts to initialize PH1 as  a push-pull output.  This error occurs for code that uses either HAL or LL code.  Is there a bug in the silicon or very low level firmware?

Jim R. 

1 ACCEPTED SOLUTION

Accepted Solutions
Posted on September 29, 2017 at 17:35

It was a hardware problem!  Removed solder short between PH1 pin and NRST pin and now the code executes as expected.

Jim R.

View solution in original post

7 REPLIES 7
Posted on September 29, 2017 at 01:06

What are you doing about clocks? HSE, HSE BYPASS? Where is your code actually stuck or hanging up?

Tips, buy me a coffee, or three.. PayPal Venmo Up vote any posts that you find helpful, it shows what's working..
Posted on September 29, 2017 at 01:47

I've tried two clock configurations.  (1) HSI RC selected to drive HSI 16, 16 MHz SYSCLK.  (2) HSI RC with PLLCLK, 24 MHz SYSCLK.  In either case, the result is the same.  Attempt to initialize PH1 causes a uC reset.  The code continues to execute but in a 'continuous loop', always resetting when attempting to initialize PH1.  Port PH0 initializes correctly as a push-pull output just prior to PH1 initialization which causes the uC reset.  Clock LSI RC is also enabled.

Jim R.

Posted on September 29, 2017 at 02:14

Is this a custom board?

Tips, buy me a coffee, or three.. PayPal Venmo Up vote any posts that you find helpful, it shows what's working..
Posted on September 29, 2017 at 03:16

Yes, it is a custom board with no external crystals.  I'm using the IAR ARM KickStart compiler and ST-Link tool.

Jim R.

Posted on September 29, 2017 at 03:43

Could it be something external, like causing the supply to brown out, or a cross connection with another pin? Can you replicate the behaviour on an equivalent NUCLEO or DISCO board?

I've configured PH1 (HSE_OUT) on a L072CZ without the system imploding.

Tips, buy me a coffee, or three.. PayPal Venmo Up vote any posts that you find helpful, it shows what's working..
Posted on September 29, 2017 at 04:04

Thanks Clive One!  I just realized that PH1 (pin 6) is physically next to the NRST (pin 7) signal.  It looks like there is a very small solder bridge between the two pins.  I will remove the solder bridge and report my findings, tomorrow.

Jim R.

Posted on September 29, 2017 at 17:35

It was a hardware problem!  Removed solder short between PH1 pin and NRST pin and now the code executes as expected.

Jim R.