@@ -467,8 +467,12 @@ ErrorHandler
467467 bcf INTCON , GIE ;Make sure interrupts are off
468468 movlw B '00110010' ;Tristate RD (this is probably not necessary,
469469 tris 7 ; but.. belt and suspenders)
470- banksel RC4PPS ;Return RD to be driven by its latch so it's
471- clrf RC4PPS ; always high (doesn't matter really)
470+ movlb 29 ;Return RD and SCK to be driven by latches and
471+ clrf RC4PPS ; drive them high; RD doesn't really matter but
472+ clrf RC0PPS ; driving SCK high means that, when using the
473+ movlb 0 ; Adafruit SD level shifter, the activity LED
474+ bsf PORTC , RC4 ; blinks out the error code
475+ bsf PORTC , RC0 ; "
472476 banksel CLCIN0PPS ;Reconfigure CLC1 to pass through !ENBL to the
473477 movlw B '00000101' ; next device in the chain so we don't have
474478 movwf CLCIN0PPS ; to do this in software
@@ -1166,20 +1170,11 @@ CmdSta1 movlw 0 ; manufacturer word (0x0001)
11661170 bra CmdSta1 ; "
11671171CmdSta2 movlw 0xE6 ;Write the device characteristics: mount, read,
11681172 call WriteByte ; write, icon included, disk in place
1169- moviw 5 [ FSR0 ] ;Write the device size which I BELIEVE is
1170- movwf X2 ; really the max sector number (so we have to
1171- moviw 6 [ FSR0 ] ; decrement from the partition table)
1172- movwf X1 ; TODO look into this and make sure
1173- moviw 7 [ FSR0 ] ; "
1174- movwf X0 ; "
1175- movlw 0xFF ; "
1176- addwf X0 , F ; "
1177- addwfc X1 , F ; "
1178- addwfc X2 , W ; "
1173+ moviw 5 [ FSR0 ] ;Write the device size
11791174 call WriteByte ; "
1180- movf X1 , W ; "
1175+ moviw 6 [ FSR0 ] ; "
11811176 call WriteByte ; "
1182- movf X0 , W ; "
1177+ moviw 7 [ FSR0 ] ; "
11831178 call WriteByte ; "
11841179 movlw 56 ;Write the spare count word, the bad block
11851180 movwf X0 ; count word, and the manufacturer reserved
0 commit comments