wokwi / avr8js

Arduino (8-bit AVR) simulator, written in JavaScript and runs in the browser / Node.js
https://blog.wokwi.com/avr8js-simulate-arduino-in-javascript/
MIT License
461 stars 73 forks source link

Implement MCU reset correctly #107

Open urish opened 2 years ago

urish commented 2 years ago

Datasheet says:

During reset, all I/O registers are set to their initial values, and the program starts execution from the reset vector so there are a couple of changes to get the reset done properly:

This means we need to:

  1. Zero out just the I/O registers, not all the SRAM
  2. Make sure all the peripherals are reset (the peripherals can set the reset value of their I/O registers for those who aren't zero)