avr/modules/flash: make protocol more robust
- wait for ATTN high after error receiving a packet - use different wait times when waiting for FLASH_START and FLASH_DATA
This commit is contained in:
@@ -48,6 +48,7 @@ checkFlash:
|
||||
rcall ioRawSendMsg ; (r16, r17, X)
|
||||
|
||||
ldi r16, NETMSG_CMD_FLASH_START
|
||||
ldi r20, FLASH_WAITFORSTART_TRIES
|
||||
rcall ioWaitForGivenMsg ; (r16, r17, r18, r19, r20, r22, X)
|
||||
brcc checkFlash_end
|
||||
|
||||
@@ -59,8 +60,8 @@ checkFlash:
|
||||
ldi xl, LOW(flashRecvBuffer)
|
||||
ldi xh, HIGH(flashRecvBuffer)
|
||||
rcall flashProcessHandleFlashStart
|
||||
brcc checkFlash_end
|
||||
sec
|
||||
; brcc checkFlash_end
|
||||
; sec
|
||||
checkFlash_end:
|
||||
ret
|
||||
; @end
|
||||
@@ -80,6 +81,7 @@ flashProcess:
|
||||
flashProcess_loop1:
|
||||
; wait up to 10s for incoming FLASH_DATA message
|
||||
ldi r16, NETMSG_CMD_FLASH_DATA
|
||||
ldi r20, FLASH_WAITFORDATA_TRIES
|
||||
rcall ioWaitForGivenMsg ; (r16, r17, r18, r19, r20, r22, X)
|
||||
brcc flashProcess_end ; no FLASH_DATA or FLASH_END msg
|
||||
; either FLASH_DATA or FLASH_END received
|
||||
@@ -186,7 +188,7 @@ flashProcessHandleFlashData_sendResponse:
|
||||
pop r16
|
||||
#endif
|
||||
|
||||
ldi r24, 50
|
||||
ldi r24, 25
|
||||
rcall flashWaitForMillisecs ; (R22, R24)
|
||||
rcall flashProcessSendFlashResponse ; (R16, R17, R18, R19, R20, X)
|
||||
sbi LED_PIN, LED_PINNUM ; toggle
|
||||
|
||||
Reference in New Issue
Block a user