cancel
Showing results for 
Search instead for 
Did you mean: 

Stm32G4 Massive Flash Problems

TFasc.1
Associate II

I´m currently working on an Application using the "new" G431 µC. At first i had massive Problems getting it to not crash (Several Hardfaults occuring here) randomly after ~100 instructions (not timing related...). After a while my good friend the readout protection showed up again and tried to see how my problem solving skills developed since our last meeting. This time i had to surrender, ive tried almost any setting i can imagine off (using st link utility) but everything it says that there are some settings invalid but doesnt let me change them either. Maybe some off you can give me some hints whats going on here, if this struggle continues this way im forced to switch to an other mcu i can count at ;(

18 REPLIES 18
TFasc.1
Associate II

are there any additional information i have to provide to resolve this issue, im kinda stuck in this situation and dont know what to do anymore?

Not much I can do from here.

Perhaps you have a local ST rep or FAE you can work with.

For the G4 I'd probably be using the STM32 Cube Programmer, not the deprecated utilities.​

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
TDK
Guru
  1. Close the program.
  2. Open the program and edit option bytes.
  3. Set Read Out Protection in top-left to level 1 and ensure PCROP_RDP is checked.
  4. Apply.
  5. Set Read Out Protection in the top-left to level 0.
  6. Apply.

If one of those doesn't work, show the error message.

If you feel a post has answered your question, please click "Accept as Solution".

What @Community member​ said - don't use the STLink utility. The G4 is new enough and STLink has been "unsupported" long enough they it probably doesn't fully/correctly implement the G4 option/protection bits.

as i stated above, i cant click apply with any of these settings, it says something similar as shown on the screenshots.

ive tried it with the cube programmer, and i can change the option bytes again, but i cant erase the flash because it says the protection bits are set... any idea?

I feel like you’re missing something, but not being present limits my opportunity to help. Good luck.
If you feel a post has answered your question, please click "Accept as Solution".

i appreciate that you all are trying to help and i know its difficult to debug such an issue from a remote location.

Lvan .3
Associate II

i think i have run in to the same problem; tinkering with the PLL and flash wait state settings i created a program that runs quickly into a hard fault (probably). in st-link the flash shows up as non-existent, in st-util with gdb the memory regions are empty (i need to power on with reset pulled low to get the st-link utilities to talk at all. The stm cube 'offical' toolkit just crashes with a segfault when i try to connect to the devices. This happened on a 36 pin and a 64 pin nucleo board, bricking both. i never touched any of the option fuses.

(I asked a question on this forum elsewhere on what mechanism could underly this problem but the thread got stuck on how i got to the hard fault to begin with, which is not really that relevant)

if anyone is interested i'm happy to post the full source and the hex to reproduce it but be warned that it may just lead to a pile of dead microcontrollers, which would be a shame in these times of shortage.