avr: t03 runs in basic mode now, flashing of AtTiny841 finally works!!
This commit is contained in:
@@ -53,25 +53,50 @@ bootLoader:
|
||||
; rcall watchdogOff ; turn off watchdog timer (sometimes it stays on after reboot)
|
||||
|
||||
sbi LED_DDR, LED_PINNUM ; out
|
||||
cbi LED_PORT, LED_PINNUM ; on
|
||||
ldi r16, 30
|
||||
rcall flashWaitForMulti100ms
|
||||
sbi LED_PORT, LED_PINNUM ; off
|
||||
|
||||
ldi r19, 20 ; loop count
|
||||
ldi r20, 2 ; on time
|
||||
ldi r21, 2 ; off time
|
||||
rcall bootLoaderBlinkLed
|
||||
|
||||
rcall checkFlash ; (r16, r17, r18, r19, r20, r22, x, y, z)
|
||||
brcc bootLoader_startFirmware ; no flash process, try to start installed firmware
|
||||
rcall flashProcess ; received a FLASH START msg, handle flashing
|
||||
brcc bootLoader_waitAndRestartBootLoader
|
||||
; try to start firmware
|
||||
bootLoader_startFirmware:
|
||||
cbi LED_PORT, LED_PINNUM ; on
|
||||
ldi r19, 20 ; loop count
|
||||
ldi r20, 4 ; on time
|
||||
ldi r21, 1 ; off time
|
||||
rcall bootLoaderBlinkLed
|
||||
rjmp firmwareStart
|
||||
bootLoader_waitAndRestartBootLoader:
|
||||
sbi LED_PORT, LED_PINNUM ; off
|
||||
ldi r16, 20
|
||||
rcall flashWaitForMulti100ms
|
||||
ldi r19, 15 ; loop count
|
||||
ldi r20, 1 ; on time
|
||||
ldi r21, 8 ; off time
|
||||
rcall bootLoaderBlinkLed
|
||||
rjmp bootLoader
|
||||
|
||||
|
||||
|
||||
; @param r19 loop count
|
||||
; @param r20 on time
|
||||
; @param r21 off time
|
||||
; @clobbers (R16, R18, R22, R24, R25)
|
||||
|
||||
bootLoaderBlinkLed:
|
||||
cbi LED_PORT, LED_PINNUM ; on
|
||||
mov r16, r20
|
||||
rcall flashWaitForMulti100ms ; (R16, R18, R22, R24, R25)
|
||||
sbi LED_PORT, LED_PINNUM ; on
|
||||
mov r16, r21
|
||||
rcall flashWaitForMulti100ms ; (R16, R18, R22, R24, R25)
|
||||
dec r19
|
||||
brne bootLoaderBlinkLed
|
||||
ret
|
||||
|
||||
|
||||
bootClcRet:
|
||||
clc
|
||||
bootRet:
|
||||
|
||||
Reference in New Issue
Block a user