enjoy-digital / litesdcard

Small footprint and configurable SDCard core
Other
111 stars 35 forks source link

Fix for arty #3

Closed keesj closed 5 years ago

keesj commented 5 years ago

Hello,

While trying the test code on litesdcard on the Arty I found some bitrot(I think).After my changes the wishbone test code works and so does building of the firmware. Please review TEST code output:

CMD0: GO_IDLE_STATE
CMD8: SEND_EXT_CSD
cmdevt: 0x00000001
0x000001aa
CMD55: APP_CMD
cmdevt: 0x00000001
0x00000120
CMD41: APP_SEND_OP_COND
cmdevt: 0x00000009 (CRC Error)
0x00ff8000
CMD55: APP_CMD
cmdevt: 0x00000001
0x00000120
CMD41: APP_SEND_OP_COND
cmdevt: 0x00000009 (CRC Error)
0xc0ff8000
SDCard ready | 1.8V switch not supported/needed
CMD2: ALL_SEND_CID
cmdevt: 0x00000001
0x00275048 0x53443332 0x4730dae9 0xc3320102
CMD3: SET_RELATIVE_ADDRESS
cmdevt: 0x00000001
0x00070500
RCA: 0007
CMD10: SEND_CID
cmdevt: 0x00000001
0x00275048 0x53443332 0x4730dae9 0xc3320102

    CID Register: 0x275048534433324730dae9c3320102
    Manufacturer ID: 0x27
    Application ID: 0x5048
    Product name: b'SD32G'
    Product revision: 0x30
    Product serial number: 0xdae9c332

CMD9: SEND_CSD
cmdevt: 0x00000001
0x00400e00 0x325b5900 0x00e7bf7f 0x800a4000

    CSD Register: 0x400e00325b590000e7bf7f800a4000
    CSD Structure: CSD version 2.0
    Max data transfer rate: 50 MB/s
    Max read block length: 512 bytes
    Device size: 28.96875 GB

CMD7: SELECT_CARD
cmdevt: 0x00000001
0x00000700
CMD55: APP_CMD
cmdevt: 0x00000001
0x00000920
CMD6: APP_SET_BUS_WIDTH
cmdevt: 0x00000001
0x00000920
CMD55: APP_CMD
cmdevt: 0x00000001
0x00000920
CMD51: APP_SEND_SCR
cmdevt: 0x00000001
0x00000920
dataevt: 0x00000001
CMD16: SET_BLOCKLEN
cmdevt: 0x00000001
0x00000900
CMD24: WRITE_SINGLE_BLOCK
cmdevt: 0x00000001
CMD17: READ_SINGLE_BLOCK
cmdevt: 0x00000001
bist errors: 0
CMD24: WRITE_SINGLE_BLOCK
cmdevt: 0x00000001
CMD17: READ_SINGLE_BLOCK
cmdevt: 0x00000001
bist errors: 0
CMD23: SET_BLOCK_COUNT
cmdevt: 0x00000001
0x00800900
CMD25: WRITE_MULTIPLE_BLOCK
cmdevt: 0x00000001
CMD12: STOP_TRANSMISSION
cmdevt: 0x00000001
0x00000c00
CMD23: SET_BLOCK_COUNT
cmdevt: 0x0000000d (CRC Error) (Timeout)
0x00000000
CMD18: READ_MULTIPLE_BLOCK
cmdevt: 0x0000000d (CRC Error) (Timeout)
cmdevt: 0x00000001
bist errors: 3145856

FIRMWARE:

[LXTERM] Starting....

        __   _ __      _  __
       / /  (_) /____ | |/_/
      / /__/ / __/ -_)>  <
     /____/_/\__/\__/_/|_|

 (c) Copyright 2012-2019 Enjoy-Digital
 (c) Copyright 2012-2015 M-Labs Ltd

 BIOS built on Jun 14 2019 15:02:02
 BIOS CRC passed (1cb8242d)

--============ SoC info ================--
CPU:       LM32 @ 100MHz
ROM:       32KB
SRAM:      4KB
MAIN-RAM:  32KB

--========= Peripherals init ===========--

--========== Boot sequence =============--
Booting from serial...
Press Q or ESC to abort boot completely.
sL5DdSMmkekro
[LXTERM] Received firmware download request from the device.
[LXTERM] Uploading firmware.bin (11192 bytes)...
[LXTERM] Upload complete (7.7KB/s).
[LXTERM] Booting the device.
[LXTERM] Done.
Executing booted program at 0x40000000

LiteSDCard CPU testing software built Jun 12 2019 10:20:06
Available commands:
help           - this command
reboot         - reboot CPU
sdclk <freq>   - SDCard set clk frequency (Mhz)
sdinit         - SDCard initialization
sdtest <loops> - SDCard test
RUNTIME>sdclk 10
RUNTIME>sdinit
RUNTIME>sdtest 1
LOOP WRITE_SPEED  READ_SPEED ERRORS
   0      3 MB/s      4 MB/s 830179
enjoy-digital commented 5 years ago

Thanks, merged.