== ECU Reset == There are several things that can cause OpenECU to reset. These can be monitored with the [[doc_user/openecu_user_guide_simulink_chunk/put_reset.html|Reset block]], which provides an output flag for the reset conditions listed below. The flag will be set to 1 for whichever event caused the last reset. ||'''Flag''' ||'''Cause''' ||'''How to debug it''' || ||power_reset ||Loss of power to the module ||Check for intermittent power connections <
> Check for voltage drop while application is running || ||watchdog_reset ||Internal watchdog was not serviced in time ||Check CPU usage (see below) <
> Check application usage of [[doc_user/openecu_user_guide_simulink_chunk/psc_kick_watchdog.html|Kick Watchdog]] || ||access_reset ||Software tried to access an invalid memory location || || ||fp_reset ||Software tried to to perform an invalid floating point operation || || ||mem_reset ||Memory corruption ||RAM: problem may go away on reset <
> Flash: problem may go away after reprogramming <
> If problem keeps reoccurring, then the ECU may be damaged [[OpenECU Support Contact|Contact OpenECU Support]]|| ||forced_reset ||Application commanded the ECU to reset ||Check input to [[doc_user/openecu_user_guide_simulink_chunk/put_reset.html|Reset block]] || ||unknown_reset ||Any reset that isn't one of the above ||Check for stack overflow (see below) <
> Monitor Resource Usage || If the Application software is unable to run long enough to read the reset flags, try reading the [[Flash Code Output|Flash Code Output]] to determine the ECU state. ---- '''Watchdog Reset''' The ECU has an internal watchdog that must be serviced periodically. If the [[doc_user/openecu_user_guide_simulink_chunk/psc_kick_watchdog.html|Kick Watchdog]] block is not present, then the OpenECU platform will automatically update the watchdog periodically. If the CPU load is too high, then the watchdog may not get updated, which will force the ECU to reset. The CPU load can be monitored with the [[doc_user/openecu_user_guide_simulink_chunk/psc_cpu_loading.html|Processor Loading]] block. Infinite loops in the application software can also cause watchdog resets. This is typically not possible in pure Simulink models, however it could happen with 3rd party libraries or custom code blocks. ---- '''Stack Overflow''' There isn't a way to detect a stack overflow, but you can monitor stack usage with the [[doc_user/openecu_user_guide_simulink_chunk/psc_stack_used.html|Stack Used]] block to see how close to the limit the application code is, or use the built-in monitoring variables as described [[ApplicationResourceUsage#How to determine stack usage|here]]. The default stack size is 8192 bytes, which may be too small for large or complex applications. To change the stack size, see [[StackSize| How do I change the stack size?]] See also [[doc_user/openecu_user_guide_simulink_chunk/rtw_options.html#system_stack_size|Stack Size]] ---- '''Monitoring Resource Usage''' See [[ApplicationResourceUsage|Application Resource Usage]].