cancel
Showing results for 
Search instead for 
Did you mean: 

crash of stm32

ludovic-micou2
Associate III
Posted on January 04, 2016 at 11:20

I use a STM32f103VB in a system who charge and discharge a battery. The microcontroler stops working in a random way. I can have the system which works during several days before having a crash of the microcontroler as I can have this crash after a few hours. I dont have a condition that it crash. I use 2 I2C bus, 1 I2C in master for communicate with a gauge and a component and the second I2C in slave for communicate with the output.

4 REPLIES 4
Posted on January 04, 2016 at 12:09

Most of the time the inexplicable crashes point to software error of various kind, stack overflow is one of the common mechanisms.

Try increasing the crash occurence e.g. by increasing workload, communication flow, input toggle using external pulse generators, deliberately introducing errors in I2C communication by grounding manually SDA/SCK or shorting them together, etc.

JW

 
Posted on January 04, 2016 at 20:35

In order to debug this kind of thing, where you don't or can't have a debugger attached, is to provide enough telemetry and diagnostic output via a serial port, and log it. You also want to have a proper Hard Fault Handler, that can output the internal registers and faulting instructions. It could perhaps be expanded to dump the stack, or memory around the fault, etc. Consider also adding routines to measure the stack depth, and alert when limits are exceeded.

Tips, buy me a coffee, or three.. PayPal Venmo Up vote any posts that you find helpful, it shows what's working..
re.wolff9
Senior
Posted on January 05, 2016 at 12:36

Besides ''software error'', the other possiblity is ''hardware error''. For example it might be possible that your powersupply dips below the minimum every now and then. I had a bug in  a design that caused the powersupply to dip from 3.3V down VERY low. It surprised me how long the CPU would continue to run on ''too low'' a supply.... 

Too few decoupling capacitors can result in ''hard to debug'' occasional crashes. 

pkumar1883
Associate II
Posted on January 11, 2016 at 07:14

hi ludovic.micou,

Could you find out the solution of problem? if yes then please share what you did, so that can be useful and beneficial for others too.