AnsweredAssumed Answered

Request for enhancement. Error_Handler in main.c generated by Cube 4.17.0

Question asked by Andrei Chichak on Oct 12, 2016
Latest reply on Jan 22, 2018 by Clive Two.Zero
Branched to a new discussion
In the latest version of Cube (4.17.0), when main.c is generated, you get a function called Error_Handler() that is called by the HAL functions anytime the return code is not HAL_OK. Error_Handler just goes into a tight loop, leaving you scratching your head as to why your program isn't working.

This is somewhat better than the previous construct, but in my small program, this function is called in 51 places. It would be useful if Error_Handler had some parameters so you could print out __FILE__ and __LINE__ so you could at least print out some sort of message that could lead you to a solution. That would mean using some sort of a macro along the lines of assert_param.

As it is now, the only thing that Error_Handler can be used for is some sort of printf("blammo I blew up\n"); or as a space to put a breakpoint for when you are debugging.

Andrei from The Great White North