summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Buesch <m@bues.ch>2020-03-20 18:07:53 +0100
committerMichael Buesch <m@bues.ch>2020-03-20 18:08:15 +0100
commit9d613de122986ccf03396f6f66a9f925673ee391 (patch)
treeb7c0309d8b9274d8628be1df1b4dc08921de4a19
parent83fe5b34b26b35ae0abf20e59bbc1a3f3bb57357 (diff)
downloadcnc-master.tar.xz
cnc-master.zip
m8driver: Clear MCUSRHEADmaster
Signed-off-by: Michael Buesch <m@bues.ch>
-rw-r--r--stepper_driver/m8driver/firmware/m8driver.S7
1 files changed, 5 insertions, 2 deletions
diff --git a/stepper_driver/m8driver/firmware/m8driver.S b/stepper_driver/m8driver/firmware/m8driver.S
index a63d793..ddf64c0 100644
--- a/stepper_driver/m8driver/firmware/m8driver.S
+++ b/stepper_driver/m8driver/firmware/m8driver.S
@@ -16,6 +16,7 @@
.include "m8def.inc"
+.def zero = r0 ; Always zero
.def t0 = r16 ; Temp reg 0
.def t1 = r17 ; Temp reg 1
.def steptab_start = r22 ; Step table start marker (constant value)
@@ -99,14 +100,16 @@ MEM_DIRTABLE: .byte 4
.cseg ; code section
reset:
cli
+ clr zero
; Configure watchdog timeout = 16 ms
wdr
+ out MCUSR, zero
in t0, WDTCR
ori t0, (1 << WDCE) | (1 << WDE)
+ ldi t1, (1 << WDE) | (0 << WDP2) | (0 << WDP1) | (0 << WDP0)
out WDTCR, t0
- ldi t0, (1 << WDE) | (0 << WDP2) | (0 << WDP1) | (0 << WDP0)
- out WDTCR, t0
+ out WDTCR, t1
wdr
; Init the stackpointer
bues.ch cgit interface