2016-01-04 02:20 AM
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.
2016-01-04 03:09 AM
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. JW2016-01-04 11:35 AM
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.
2016-01-05 03:36 AM
2016-01-10 10:14 PM
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.