cancel
Showing results for 
Search instead for 
Did you mean: 

Hard Fault Detected STM32L031k6t6

CMart.3
Associate II

Hey STM team,

Recently I started to work with the STM microcontrollers.

In my current project I have a STM32L031k6T6 with the ADC0 (PA0) reading the voltage and the channel 1(PA1) reading the Current.

My Sample rate will be 1920Hz ( 32 points / cycle ) 60Hz ( Power Grid Frequency)

I'm using the ADC + DMA + Timer strategy.

After compile and run my code until fill my buffer with 384 sample, I can see the Current and Voltage Buffer filled, however if I stop the code with breakpoint and resume the execution or allow the processor run continues, the debugger jump to HardFault_Handler.

 0693W000001shf9QAA.png

My buffers work in circular mode.

Second question is about the STMstudio,

I tried to watch my variable voltage, however when I import my elf files the variable Voltage_Buffer shown length [0] and in my code the length is 384. when I try to execute the STMStudio, the Varviewer didn't show any graphic.

Can someone with more experience help me solve this problems?

Thank you so much and have an amazing sunday

My Attolic and CubeMX files are attached.

0 REPLIES 0