2024-09-06 05:19 AM - edited 2024-09-06 05:25 AM
Hi,
After I program an STM32G030F6P6 I can't connect again with the STMCubeProgrammer. I have checked that my boot pin is in the correct position but still I keep on getting the error:
I have used a simple program that got generated by STM32CubeIde to download to the microcontroller.
Is there a setting that sets the chip protected orso when programming the microcontroller?
Kind regards
edit: the simple program sets PA2 to USART_TX and PA3 to USART_RX, don't know it this could give an issue.
Solved! Go to Solution.
2024-09-06 07:15 AM - edited 2024-09-06 07:16 AM
Looking at AN2606, here's what it takes to get into the bootloader:
From RM0454, all option bits are high by default except BOOT_LOCK because it "doesn't exist". So nBoot0 = nBoot1 = nBOOT0_SEL = 1. And BOOT_LOCK = 0.
It went into the bootloader initially because flash is empty (third line). Now it doesn't because you have a program there.
To recover, you'll need to connect with SWD and change the option bytes.
What you're doing is viable approach for flashing an empty chip, but it won't work for re-flashing, at least not without configuring option bits first.
2024-09-06 05:37 AM
It looks like you're trying to connect to the bootloader. You will need to hold BOOT0 high during reset to launch the bootloader, otherwise user code will execute, and the chip will not be listening for a bootloader connection.
For development and debugging, a connection over SWD is much more preferred and will allow you to be more productive.
2024-09-06 06:25 AM
Hi @TDK ,
Thank you for your response.
That was what I meant with " I have checked that my boot pin is in the correct position".
So what I have tried:
Is there a way I can verify that the bootloader has started?
I understand that SWD is more productive, but I also need this way so that I can reprogram future boards in production.
Kind regards
2024-09-06 06:46 AM
>>Is there a way I can verify that the bootloader has started?
Hot plug with the SWD/JTAG debugger, and STOP the MCU. The code should be executing at 0x1FFFxxxx address space.
Noise on other UARTs, or connections described in AN2606 can occur first and *** the loader, say GNSS or MODEMs that chirp at start-up
2024-09-06 07:15 AM - edited 2024-09-06 07:16 AM
Looking at AN2606, here's what it takes to get into the bootloader:
From RM0454, all option bits are high by default except BOOT_LOCK because it "doesn't exist". So nBoot0 = nBoot1 = nBOOT0_SEL = 1. And BOOT_LOCK = 0.
It went into the bootloader initially because flash is empty (third line). Now it doesn't because you have a program there.
To recover, you'll need to connect with SWD and change the option bytes.
What you're doing is viable approach for flashing an empty chip, but it won't work for re-flashing, at least not without configuring option bits first.
2024-09-10 04:46 AM
Hi TDK,
Thank you for the feedback.
After setting the nBootSel to unchecked I was able to program and reprogram the microcontroller
Now I just have to wait for my st-link to unlock my other 2 microcontrollers.
Kind regards,
Dieter