cancel
Showing results for 
Search instead for 
Did you mean: 

STM32L152 stuck at startup and dont enter Main

moran
Associate II
Posted on December 01, 2014 at 16:34

Hi everyone,

I'm trying to connect STMl152 at Debug mode (JTAG) but with no success.

If i tracing the startup it stuck in SetSysClock (''system_stml1xx.c'') function on :

/* Wait till PLL is used as system clock source */

    while ((RCC->CFGR & (uint32_t)RCC_CFGR_SWS) != (uint32_t)RCC_CFGR_SWS_PLL)

    {

    }

In the command window : ''Cannot access Memory''.

Please advise,

 

8 REPLIES 8
Posted on December 01, 2014 at 16:37

What are the chances your PLL or Flash Wait State settings are wrong?

Look at the code prior to this, you're looking at the symptom, not the cause.
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
moran
Associate II
Posted on December 01, 2014 at 17:04

Thanks for the replay Clive.

Where exactly can I look ?? ...All the prior code to that are the original library startup files.

Amel NASRI
ST Employee
Posted on December 01, 2014 at 17:12

Hi,

Try to connect using the ST-Link Utility, erase chip and the re-connect after loading your code again.

-Mayla-

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.

moran
Associate II
Posted on December 01, 2014 at 17:17

Hi Mayla,

Why should I move to ST-Link Utility, I'm using Keil connect through ULINK2 , it should work , No??

Posted on December 01, 2014 at 17:43

Where exactly can I look ?? ...All the prior code to that are the original library startup files.

Well you're going to have to consider all the code from the reset vector to the point it jams up. Starting with the code nearest to the observed failure, and moving backward. And consider how your design (external crystals, etc) impact the settings used for the clocks, PLL, etc. If these are different you need to evaluate how these need to differ from the default setting.
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
moran
Associate II
Posted on December 04, 2014 at 11:00

Unfortunately

I couldn't find any issue regarding FLASH time or PLL.

So I took from STM32L1xx_StdPeriph_Template the MDK-ARM example , built on it the project and it works fine.

Thanks.

moran
Associate II
Posted on December 09, 2014 at 11:04

I have to open this issue again,

As i told before when i use STM32L1xx_StdPeriph_Template the MDK-ARM example 

it work.

Now .... using same hardware and same project folders (MDK-ARM), but arrange differntly the folders it doesn't work --> again stuck before entering the Main (with memory access issue).

Offcourse all files are compiled again.

Now it doesn't seemed like clk/Flash wrong configuration (because I'm using same files that works).

Please advise.

 

Posted on December 09, 2014 at 13:34

If the failure is occurring at the project level, then you'll need to ponder the defines passed to the compiler, and the include file search paths.

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