Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the difference between "soft reset" and "hard reset" in embedded field?

In my opinion: soft reset: boots from the reset vector. hard reset: pull the electrical level of the cpu.

like image 710
henry Avatar asked Jan 16 '23 18:01

henry


1 Answers

A hard reset certainly means that the whole CPU chip and all its peripherals are reset. The causes for this could be many: reset pin pulled externally, clock failures, on-chip low-voltage detection, watchdog, illegal instruction traps etc etc.

A soft reset probably means a "dirty" branch to back to the reset vector, where the reset vector restores all CPU core registers including the stack. I would say that this is very questionable practice and I'm not sure what good it would do. The main problem is that all MCU peripheral hardware registers will -not- get reset to default when you do this. It is almost impossible not to make any assumptions about the reset state of all such registers, especially since the average MCU comes with 1000+ of them nowadays. So with this soft & dirty reset, you will most likely end up a behaviour like this:

subtle intermittent bugs <= my program <= complete haywire

More far-fetched, a soft reset could mean a reset caused by software. In that case it could be writing the wrong value to the watchdog register to enforce a reset, or failing to refresh the watchdog. Or it could be the execution of an illegal instruction. These will most likely cause a complete reset of the whole chip.

like image 166
Lundin Avatar answered Feb 16 '23 00:02

Lundin