2020-03-20 12:23 AM
Updated Question:
I have a custom PCB board with L052K8 and F051K8 with the same peripherals and correct hardware design for each (F051K8 has a VSSA for the ADC and different bypass cap), but only the L051K8 is able to program its firmware and reset correctly.
I was initially designing the board for the L052K8 and could not figure out what was wrong for weeks, so I pretty much chose a different chip with the same footprint and peripherals (F051K8) at the end to minimize re-designing the hardware. The L052K8 does not seem to program its firmware or reset after it's been disconnected from ST-link and the IDE.
Can someone please explain this?
Original Question:
Hi, I've just made a custom board for STM32L052K8, and I can't get the board to work. It
seems that the connection is successful and I am able to program it using ST link (SWD).
I programmed a very simple GPIO application with STM32CubeIDE (which I have verified using a nucleo board), and the firmware seems to run initially.
However, when I disconnect the board from ST link and reset the device by pulling the battery out and back in, the application does not run as intended (the LED is supposed to be on initially with GPIO_init, then turn off after 500ms). This is the while loop:
while (1)
{
HAL_GPIO_WritePin(GPIOB, GPIO_PIN5, GPIO_PIN_SET);
HAL_Delay(500);
HAL_GPIO_WritePin(GPIOB, GPIO_PIN5, GPIO_PIN_RESET);
HAL_Delay(500);
}
I assume that there's a potential issue in the MCU startup after reset... In fact, after the reset, the same pin is set close to high (2.3V on a board powered by 2.6V)
update:
Could someone help me understand why this is happening and a way to fix it? Any suggestion is much appreciated, thank you in advance.
Solved! Go to Solution.
2020-05-14 02:14 AM
Hi,
I figured out my mistake.
I was able to get by on the STM32F0 series without pulling the BOOT0 pin to GND.
But it turns out that for STM32L0 series, BOOT0 pin must be pulled down for the application to run after reset.
I hope this helps if anyone else had a similar experience
2020-03-27 01:54 AM
Hello,
Try to add a delay after HAL_GPIO_WritePin(GPIOB, GPIO_PIN5, GPIO_PIN_RESET), so you can see the LED blinking.
Best Regards,
Mohamed Aymen.
2020-04-01 12:50 AM
Hi Mohamed, thank you for pointing that out, I tried it and still the debugging mode in Keil did not work for this custom board with L052k8.
After a long search I found that Keil and STM32L0 series might not play well (found few links on changing Keil connections settings to connect to L053 boards), so with no other potential solutions that I could do (without re-doing the PCB), I just changed the IDE to STM32CubeIDE. Programming on the new IDE worked out and I could see the voltage rise and drop from the GPIO pin.
Also, there were no errors with leaving the NRST pin as is without a 0.1uF capacitor on it connecting to ground (with or without this, the firmware debugging doesnt work on Keil, but works on CubeIDE).
Lesson:
It might be wise to not use STM32L0 series with free version of Keil, use a different IDE!
2020-04-01 01:45 AM
Update:
So the firmware programs to the board using STM32CubeIDE, but when I reset it by powering off and powering on, the firmware does not proceed... soo.... I guess Im a step closer but still got things to fix
2020-04-01 03:56 AM
Hello,
For the the NRST pin you can refer to the getting started with STM32L0 hardware development application note AN4467.
Best Reagrds,
Mohamed Aymen.
2020-04-01 05:02 AM
> I assume that there's a potential issue in the MCU startup after reset... because I have not connected the NRST or BOOT0 to anything
No, that is not a "potential issue", but a broken design. Read the AN4467 and fix the board!
2020-04-02 12:57 AM
Dear Piranha,
following your suggestion, I have placed a 0.1uF cap to ground on NRST pin. However, the same issue persists, if you have any other suggestions:
Thank you for your help!
2020-04-13 08:04 PM
Update: so I gave up on trying anything else, and made a new PCB board for a STM32F051K8, which has the same footprint and pretty much the same pinout with the same functionalities except that it's not L series so it consumes more power. The new board with the same peripheral design on the PCB artwork and using Keil seems to work perfectly well.
So I don't know why the STM32L052K8 didn't work, but I'm going with my inexplicable solution for now. If anyone can answer why this happened that would be great.
2020-05-14 02:14 AM
Hi,
I figured out my mistake.
I was able to get by on the STM32F0 series without pulling the BOOT0 pin to GND.
But it turns out that for STM32L0 series, BOOT0 pin must be pulled down for the application to run after reset.
I hope this helps if anyone else had a similar experience