I am have been having limited success with an STM32G030K6T6TR, I purchased the part from lcsc and am confident that its not a clone.
I started out with a STM32CubeIDE 1.16.1 thinking that getting a LED blinky would be trivial using the tools provided by ST.
I created a new project selecting the appropriate chip from the pinout & configuration panel I double clicked PA0 and set it to GPIO_Output.
I then generated the code and made the following changes to the while loop inside main.
The while loop inside main
/* Infinite loop */
/* USER CODE BEGIN WHILE */
while (1)
{
HAL_GPIO_TogglePin(GPIOA, GPIO_PIN_0);
HAL_Delay(500);
/* USER CODE END WHILE */
/* USER CODE BEGIN 3 */
}
/* USER CODE END 3 */
I built the target it compiled with All good so far, I got the following output.
arm-none-eabi-size simpletest1.elf
arm-none-eabi-objdump -h -S simpletest1.elf > "simpletest1.list"
text data bss dec hex filename
5252 12 1572 6836 1ab4 simpletest1.elf
Finished building: default.size.stdout
Finished building: simpletest1.list
10:40:35 Build Finished. 0 errors, 0 warnings. (took 924ms)
I was hoping I could program my chip from the IDE but after a fruitless search for a program or download button in the IDE I instead downloaded and install the STM32CubeProgrammer.
I had the chip installed in a breadboard, using a breadboarded ch340k and running at 3.3v powered externally I connected to the ch340k to the USART2_RX pin 10 PA3 and USART2_TX pin 9 PA2 ( I added a 1.8k resistor pullup on the RX pin ).
The STM32G030K6T6TR was connected to 3.3v/VDD pin 4 and GND/VSS pin 5.
I added an LED to PA0 pin 7.
Connecting this up to a USB cable on my PC the COM port appeared as I expected.
Using the STM32CubeProgrammer I selected the UART and clicked connect ( NOT change any of the default settings ).
unfortunately I did not collect the output, but it all looked good to me.
I then browsed for the file simpletest1.elf that was generated from the IDE and clicked on the download button.
At this point I cannot remember if I had added a jumper to the boot0 pin but since I was able to connect through the programmer I knew I was inside the bootloader.
I then pressed removed and reapplied power to the chip and the LED started blinking, success.
From this point on I have not been able to reprogram the chip.
I am beginning to believe that somehow the chip has been configured as read protected?
Things I have tried
combinations of pulling the boot0 pin low and high along with resetting the chip, then attempting to reconnect via the uart.
changing all the wires on the breadboard after find out some where steel.
using a cloned j-link to attempt to program with that while in reset, not in reset.
using j-link commander to connect
connected the nrst/pin 6 on the chip to the reset output on the j-link
using the j-link stm32 unlocker
whatever I do when I re-apply power the led starts blinking again.
I have a genuine j-link edu that I have never used but haven't tried that yet as I don't have a header for the teeny-tiny pins.
The more I read online the more I am convinced I have activated the chips read protection mechanism, I assume that the default setting within the IDE/Programmer would not have been set to do this.
Ideas?