2022-12-17 02:14 AM
I am trying to simply turn PA0 HI on an STM32F030F4P6 using Cube IDE.
No matter what I do, if I try to write to any GPIO registers (including using the auto generated Inits), I get a Hard Fault. Nothing solves it :( Tried debugging it, no matter what I do, I get a hard fault at any attempt to use any GPIO registers using any methods!!
2022-12-17 09:22 PM
If this is not a Nucleo board, get a Genuine Nucleo to test your code, because that is probably the first thing to share with support.
2022-12-17 10:43 PM
It's pretty simple, only needs VCC, VCCA, GND, Reset, SWCLK and SWDIO.
Tried a second chip, same problem. I don't want to have to spend money on a new PCB with a different CPU. No problems with F750, F051, H7B3. Considering it is the only one I have tried where MX cube doesn't open the project in IDE cube AND every example I can find on the net uses a different IDE, I think ST is hiding something with this chip.
2022-12-17 10:46 PM
And yes, BOOT is held low
2022-12-17 11:31 PM
wrong cpu ?
what cpu you are really using : STM32F030F4P6 = you talking about - or : STM32G030 = Cube programmer shows ?
+
>> in IDE cube, it fails (Note:- IDE cube does not have STM32F030x4.h, it only has STM32F030x6.h).
nonsense. i made some small projects with STM32F030F4 since 2 years in Cube +ide.
see:
so first make a new stm32 project and select the cpu, you really connect.
2022-12-18 12:51 AM
By setting the IOPARST bit you keep the GPIOA in reset. There is no need to reset it at all, and you cannot do anything with a port until you release the reset.
Get serious. Sort the things out. Create a working empty project for your MCU (yess, you may select it in CubeIDE) with the necessary header files (with CubeIDE it must be the "STM32 project" with HAL but you may get rid of HALL calls if you don't like them. Use register names and bit names in your code, like RCC->AHBENR |= RCC_AHBENR_IOPAEN;
2022-12-18 05:23 PM
And the G0 doesn't have a peripherals at 0x48000000 base address like the F0 has...
2022-12-18 05:33 PM
And make sure the memory segment are correctly located, flash, ram, peripherals, etc... exception will trigger on code execution or just a call function otherwise.
2022-12-19 05:50 PM
Yes my fault. I assumed the IOPARST bit was self-clearing. My peripherals were locked in reset!
2ndly, I had 2 different CPUs connected to the SWDIO and SWCLK at the same time!!
Frustrating 20-30hours of pain for nothing. All working now.
One thing I did do now, is use my own initialization code, as the auto generated one is like 4kB and mine is 600B!
Thanks for your help guys!
2022-12-20 02:53 PM
> the auto generated one is like 4kB and mine is 600B
It's the same with all HAL/Cube code. If you are capable of writing register code, save yourself from a PITA and a disaster and do it for everything!