Beste mensen,
heeft toevallig iemand hetzelfde probleem gehad.
Na dat ik de data token naar de MMC heb opgestuurd, moet ik dan 2 keer CRC byte opsturen en dan het kart moet me response geven dat de condition goed verlopen is ... maar wat ik krijg is 0x1F of 0xFF ...
Bij het uitvoeren springt die altijd naar " Ondefined_ERROR"
MMC_Write_Sector
SELECT_MMC
SPI_L 0xFF
SPI_L 0x58
SPI_L 0x00
SPI_L 0x00
SPI_L 0x00
SPI_L 0x00
SPI_L 0xFF
SPI_L 0xFF ;NCR
SPI_L 0xFF ;NCR
CHK_R1 0x00 ;Check response R1, if response is 0x00 return 0 in W
BTFSS STATUS, Z
goto MMC_Write_Sector
SPI_L 0xFF ;NWR
SPI_L 0xFF ;NWR
SPI_L 0xFE ;START_BYTE
; From here write the stream of 512 bytes
MOVLW 0xFF
MOVWF Write_counter
Write_Loop
decf Write_counter, 1
SPI_L "X"
MOVLW 0x00
XORWF Write_counter, w
BTFSS STATUS, Z
GOTO Write_Loop
; END stream
SPI_L 0x00 ; CRC
SPI_L 0x00 ; CRC
CALL Check_data_response
SPI_L 0x00 ;NEC
DESELECT_MMC
SPI_L 0xFF
RETURN
Check_data_response
SPI_L 0xFF
MOVLW 0x1F
ANDWF SPI_Data, 1
MOVLW 0x05
XORWF SPI_Data, w
BTFSC STATUS, Z
return
MOVLW 0x0B
XORWF SPI_Data, w
BTFSC STATUS, Z
GOTO W_CRC_error
MOVLW 0x0D
XORWF SPI_Data, w
BTFSC STATUS, Z
GOTO Write_error
GOTO Ondefined_ERROR
W_CRC_error
LCD_PRINT_L_Cp 'E'
goto finish
Write_error
LCD_PRINT_L_Cp 'D'
goto finish
Ondefined_ERROR
LCD_PRINT_L_Cp 'P'
MOVFW SPI_Data
ADDLW 0x05
CALL lcd_send_data
goto finish