This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

back to back uSD card file reads

Hi All,

I'm having a problem in eboot (CE6) reading nk.bin after reading another configuration file.

Is there something that needs to be reset or done to the mmc/sd interface to do additional reads?

Should I not use the BLSDDownload function? If not what should I use? What is the sequence?

This is my serial output:

1st file (cfg file):

BLSDDwnld: FN: fpga.xsv
SDCardDet: 1
MMCIssueIdentify: SD card detected
reported block size = 512
Card size is = 1939456 512 byte sectors
max clock freq = 25000000
done.
  Directory Entry #2: <MLO         >
  Directory Entry #4: <FTPD     TMP>
  Directory Entry #7: <DATAIN~1 XML>
  Directory Entry #16: <EBOOTS~1 NAN>
Next directory sector 481, file data area start 512
  Directory Entry #17: <EBOOTSD  NB0>
  Directory Entry #18: <NK       BIN>
  Directory Entry #26: <FPGA     XSV> Found file, starting cluster = 427, file size = 72418
File Read/Cpy: 0x00007643

2nd file (os image):

BootDevice(4)
BootDevLoc(4809c000)
BLSDDwnld: FN: nk.bin
SDCardDet: 1
MMC Stat: 00018000
SDHC: command response timeout CTO!
MMC::MMCCommandResponse: MMCSendCommand error, command = 55
MMC::MMCCommandResponse: Command Response Error
MMC Stat: 00018000
SDHC: command response timeout CTO!
MMC::MMCCommandResponse: MMCSendCommand error, command = 1
MMC::MMCCommandResponse: Command Response Error
MMCIssueIdentify: busy bit never deactivated -- probably no card, ocr = 0x0
SDCardInit: No media found!
failed

If anyone can shed some light on this, that would be great - I'm stumped.

Matt

  • The problem is probably due to the SDHC/SD memory/FATFS subsystem in the bootloader only being designed for one shot use (in the XLDR it loads EBOOTSD.NB0 and then EBOOTSD loads NK.BIN).  Changing EBOOT code to load other files from the SD card is not a normal feature of the bootloader and needs extra work. 

    The new work would be to create a function that would reinitialize the bootloader SDHC/SD memory/FATFS to make it ready for accessing another file. 

  • Actually you should be able to read many files from the SDCard in the bootloader, even though the FAT implementation in EBOOT is not complete. The trick is to call the function "FileIoInit()" only once, then call the function "FileIoOpen()" for each file you want to open. Calling "FileIoInit()"  twice yields to the SDCard bootloader driver getting stuck.

     

    Remember to keep the handle returned by "FileIoOpen()" if you want to access the same file later on because there is no way of closing an opened file.

  • I'll have a try at that and see what happens.

    Sounds like a good chance of working for what I need - as I only need two files, at the moment.

    Thanks all for the suggestions

    Matt

  • Sorry it's taken me a while to get back to this - other fires.

    So I've done my best to try the 1x only FileIoInit:

    This is what I get:

    ****************** FileIoInit 1x **************************

     

    BootDevice(4)

    BootDevLoc(4809c000)

    BLSDDwnld: FN: nk.bin

    FN2DIR

    F-OPEN

    MMC Stat: 00018000

    SDHC: command response timeout CTO!

    MMC::MMCCommandResponse: MMCSendCommand error, command = 13

    MMC::MMCCommandResponse: Command Response Error

    read error

    MMC Stat: 00018000

    SDHC: command response timeout CTO!

    MMC::MMCCommandResponse: MMCSendCommand error, command = 7

    MMC::MMCCommandResponse: Command Response Error

    SDCardReadSector: Error reading file, retry (sector 543)

    MMC Stat: 00018000

    SDHC: command response timeout CTO!

    MMC::MMCCommandResponse: MMCSendCommand error, command = 13

    MMC::MMCCommandResponse: Command Response Error

    read error

    MMC Stat: 00018000

    SDHC: command response timeout CTO!

    MMC::MMCCommandResponse: MMCSendCommand error, command = 7

    MMC::MMCCommandResponse: Command Response Error

    SDCardReadSector: Error reading file, retry (sector 543)

    MMC Stat: 00018000

    SDHC: command response timeout CTO!

    MMC::MMCCommandResponse: MMCSendCommand error, command = 13

    MMC::MMCCommandResponse: Command Response Error

    read error

    MMC Stat: 00018000

    SDHC: command response timeout CTO!

    MMC::MMCCommandResponse: MMCSendCommand error, command = 7

    MMC::MMCCommandResponse: Command Response Error

    SDCardReadSector: Error reading file! (sector 543)

    BOOTLOADER: read_sector 543 (DIR) failed

    BLSDCardDownload:  cannot open file

     

     

    When I leave the FileIoInit in so it does it twice - I get different results:

    ****************** FileIoInit 2x **************************

     

    BootDevice(4)

    BootDevLoc(4809c000)

    BLSDDwnld: FN: nk.bin

    FileIOInit: ***

    SDCardDet: 1

    MMC Stat: 00018000

    SDHC: command response timeout CTO!

    MMC::MMCCommandResponse: MMCSendCommand error, command = 55

    MMC::MMCCommandResponse: Command Response Error

    MMC Stat: 00018000

    SDHC: command response timeout CTO!

    MMC::MMCCommandResponse: MMCSendCommand error, command = 1

    MMC::MMCCommandResponse: Command Response Error

    MMCIssueIdentify: busy bit never deactivated -- probably no card, ocr = 0x0

    SDCardInit: No media found!

    *** FIO-failed

     

    Here's the previous read's output:

     

    BLSDDwnld: FN: fpga.xsv

    FileIOInit: ***

    SDCardDet: 1

    MMCIssueIdentify:

    GO_IDLE_STATE1

    GO_IDLE_STATE2

    SD_SEND_IF_COND

    APP_CMD

    SD_SEND_OP_CODE

    APP_CMD

    SD_SEND_OP_CODE

    MMCIssueIdentify-: SD card detected

    found card

    reported block size = 1024

    Card size is = 3842048 512 byte sectors

    max clock freq = 25000000

    *** FIO-done.

    FN2DIR

    F-OPEN

      Directory Entry #2: <MLO         >

      Directory Entry #3: <EBOOTSD  NB0>

      Directory Entry #4: <FPGA     XSV> Found file, starting cluster = 50, file size = 72418

    F-Open: done

     

    So in either case it appears to leave the card in a state where it is unresponsive.

    The 1x attempt - gets send_status & select/deselect cmd errors

    The 2x attempt - gets app cmd errors

     

    Not sure which is worse - but neither of them seem to work - so I'm suspecting some other cleanup needs to be done.

    I just don't have any idea what that is. I'm at a loss here.

    Hopefully someone out there has made this work and can help me out/point me in the right direction.

     

    Thanks,

    Matt

     

  • OK - you guys may color me daft.

    I was going back through my code and I found that I left in some test code that did a reset of the SD controller.

    Once I took this out - the 1x - FileIoInit method worked.

    I give much praise and thanks to that suggestion as it worked as advertised.

    Thank you all very much - your suggestions and feedback has been greatly appreciated.

    Matt

     

  • Here's the result:

    [1st file load]

    BLSDDwnld: FN: fpga.xsv

    FileIOInit: ***

    SDCardDet: 1

    MMCIssueIdentify:

    GO_IDLE_STATE1

    GO_IDLE_STATE2

    SD_SEND_IF_COND

    APP_CMD

    SD_SEND_OP_CODE

    APP_CMD

    SD_SEND_OP_CODE

    MMCIssueIdentify-: SD card detected

    found card

    reported block size = 1024

    Card size is = 3842048 512 byte sectors

    max clock freq = 25000000

    *** FIO-done.

    FN2DIR

    F-OPEN

      Directory Entry #2: <MLO         >

      Directory Entry #3: <EBOOTSD  NB0>

      Directory Entry #4: <FPGA     XSV> Found file, starting cluster = 50, file size = 72418

    F-Open: done

    ...

    [2nd file load -nk.bin]

    BLSDDwnld: FN: nk.bin

    SKIP FileIOInit

    FN2DIR

    F-OPEN

      Directory Entry #2: <MLO         >

      Directory Entry #3: <EBOOTSD  NB0>

      Directory Entry #4: <FPGA     XSV>

      Directory Entry #5: <NK       BIN> Found file, starting cluster = c3, file size = FF58A3

    F-Open: done