cancel
Showing results for 
Search instead for 
Did you mean: 

Very Strange issue with STM32G0 series MCU. (Read if really expert of STM32 MCU)

Amandeep_Dhaliwal
Associate III

I have almost 2 year experience with stm32 MCU. if I had any problem I solve it with in one or two days.

But right now I'm facing a very strange problem and stuck on it from last 25 days.. I'm working on Grid connected inverter control board. In design process i have to measure ac voltage from grid. 2 month ago I made a circuit and measure grid voltage with STM32F103 MCU and everything was fine i assume my circuit is correct and i can put it on schematic . Which final board i made it has STM32G0 series MCU. When i tried to measure voltage with board MCU stop working after 1-2 sec , i think about all issues which can cause this problem for example new MCU chip, voltage checking on supply, isolation of op amps from grid high voltage ,etc. and still same problem then i come on my code and start to find cause and then I found a very strange problem.

I use a external interrupt for measure mains voltage frequency . when I enable that code processor stop working after 2 or 3 seconds but debugger reading of DMA variable memory address still continue it means half MCU stop but half is working . and when I comment that specific code lines and run debugging everything works fine.

That code lines which cause problem screenshot is attached.

8 REPLIES 8
MM..1
Chief II

Seems as hard fault, place into IT some led control...

And from your screen , you do jobs in IRQ, then check priorities...

Output some status/telemetry via GPIO, UART etc

Instrument Hard Fault

Make sure variables are volatile if changed outside normal code flow, ie interrupt/callback

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

Yes i also change priorities but still same problem …

Im debugging with Serial wire debug not any message shown up in uvision when cpu stops.

yes variables are volatile.

issue is that why cpu stops after 2-3 seconds of working

Ended up in a while(1) loop somewhere

Hard Faulted

Stuck in interrupt context because source not cleared

Latched-Up

Perhaps have heart-beat LED in main loop, another in SysTick (highest priority), see if it's alive.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

You debug with SWD, but no message? Debuger dont show messages for you , you need pause code or place breakpoint for locate trouble point.

TDK
Guru

If it stops after 2-3 seconds, it should be very straightforward to debug it, let it go a few seconds, and hit pause and see where it is and why it’s not acting as expected.

Don’t think you’ve provided enough info to spot the error. Certainly assigning values to variables won’t cause an issue in itself. The problem likely lies elsewhere in the code logic.

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

"Stops working" is not a useful description. C'mon, at least pause the debugger and determine what the CPU is doing at the time.