AnsweredAssumed Answered

STM32L100RC and STM32L152RC disco boards fail on LL_FLASH_GetLatency() != LL_FLASH_LATENCY_1

Question asked by upratat hlavu on Nov 30, 2017
Latest reply on Dec 6, 2017 by upratat hlavu

Hallo all, I'm not sure, but maybe I found a bug - I wrote this question at first, because I had problems to create account here, but now it works so I'm writing here (link to my stackexchange post: stm32 - STM32L100RC and STM32L152RC disco boards fail on LL_FLASH_GetLatency() != LL_FLASH_LATENCY_1 - Electrical Engine… ).


My problem:

I have stm32l100rc and stm32l152rc disco boards and am using stm32cubemx and sw4stm32 IDE.

After creating default project for them in cubemx - I mean I go through board chooser and then leave everything as is except changing library from HAL to LL in project -> settings -> advanced settings for both RCC and GPIO and generate project for sw4stm32 - I import it to sw4stm32, add some code for LED3 blinking (to while loop in main function):

LL_GPIO_TogglePin(LD3_GPIO_Port, LD3_Pin);LL_mDelay(1000);

build it and run it (it's written to board, I see status LED blinking), but LED3 does not blink.

When I run it in debug mode and step the code it fails at line (in SystemClock_Config() function):


and goes to Error_Handler() which sits in while loop forever...


This happens on both boards and when I flash them with ST's LED blinking example it works, so it should be some firmware problem and I would say some initialization problem. I read STM32CubeL1GettingStarted.pdf and there is written that I should define right macro in stm32l1xx.h - which should be STM32L100xC or STM32L152xC and I did it - or rather uncomented existing one in that file. I even tried to add it to main.c file - it didn't help. And I tried to do it with and without this macro defined.


The only close question I found is this - but in v 1.8.0 of cubemx library this seems to be in right place.


I even tried to generate project with older version of LL libraries (1.7.0 and 1.6.0), but still no progress.

Does anybody at least have some tutorial for blinking leds (or manipulating with GPIO) on L1 processors using LL library based on cubemx generated project? Or could somebody send me working led blinking (gpio manipulating) code for STM32L100RC or STM32L152RC generated in cubemx using LL library?


I also tried to do exactly the same steps using HAL library and it works (previously I used ST's cubemx blinking example), so is this a bug?


I'm quite noob to these boards and have experience only with arduino so all this setup is quite overhelming for me right now and don't know where the cause could lie... so if anybody could direct me I would apreciate it really much.