• AVR Freaks

Hot!SD Card SYS_FS_ERROR_DISK_ERR

Author
sergioneves
New Member
  • Total Posts : 30
  • Reward points : 0
  • Joined: 2008/03/26 03:52:27
  • Location: 0
  • Status: offline
2018/05/16 02:41:20 (permalink)
0

SD Card SYS_FS_ERROR_DISK_ERR

Hello,
 
I need your help to figure out why sometimes I get the error SYS_FS_ERROR_DISK_ERR, when goig to open a file to write on it.
 
To give more details, in attachment I send my Harmony configurations.
 
The SPI is shared with the SD Card and a Flash Memory, I only have a file system in the SD Card.
I've measured the Chip Select signals, and the Chip Select of the Flash Memoy is always high (so Flash is deselected) when I'm working with the SD Card.

MPLAB X IDE v4.15
Harmony v1.11
XC32 v1.44
 
PIC32MZ2048EFG100
#1

3 Replies Related Threads

    sergioneves
    New Member
    • Total Posts : 30
    • Reward points : 0
    • Joined: 2008/03/26 03:52:27
    • Location: 0
    • Status: offline
    Re: SD Card SYS_FS_ERROR_DISK_ERR 2018/05/16 02:41:43 (permalink)
    0
    Continue...
     
    My SD_Task flow chart is:

    - Mount the File System: SYS_FS_Mount("/dev/mmcblka1", "/mnt/myDrive", FAT, 0, NULL)
    - Set current drive: SYS_FS_CurrentDriveSet("/mnt/myDrive")
    - Try to Open the directory: SDData.dirLogTHandle = SYS_FS_DirOpen("/mnt/myDrive/LogTrack")
        - If it doesn't exist, create it: SYS_FS_DirectoryMake("LogTrack")
        - Else close it: SYS_FS_DirClose(SDData.dirLogTHandle)

    After this point is ready to start save data to the file. When going to save data:

    - Open file, SDString.FileToOpen is the file name: SDData.fileLogTHandle = SYS_FS_FileOpen(SDString.FileToOpen, SYS_FS_FILE_OPEN_APPEND)
    - Write to file, SDString.TrackToFile is the data to write, SDString.TrackToFile_Index is the number of bytes: SDData.nBytesWritten = SYS_FS_FileWrite(SDData.fileLogTHandle, (const void *)SDString.TrackToFile, SDString.TrackToFile_Index)
    - Close file: SYS_FS_FileClose(SDData.fileLogTHandle)

    After this, the SD_Task goes to a idle state to wait for new data to write. New data then: Open file / Write data / Close file.

    But sometimes when open file is when I get the error SYS_FS_ERROR_DISK_ERR.

    My question is what really means the error SYS_FS_ERROR_DISK_ERR?
    What can be the situations that trigger this error?

    Every help is welcome.
    Thanks.

    Attached Image(s)


    MPLAB X IDE v4.15
    Harmony v1.11
    XC32 v1.44
     
    PIC32MZ2048EFG100
    #2
    sergioneves
    New Member
    • Total Posts : 30
    • Reward points : 0
    • Joined: 2008/03/26 03:52:27
    • Location: 0
    • Status: offline
    Re: SD Card SYS_FS_ERROR_DISK_ERR 2018/05/16 09:48:03 (permalink)
    0
    An update:
     
    After dig a little in the code I found that the problem isn't in the Open File function, but in the SD Card ATTACHED / DETACHED.

    I'm mean, that in the moment I was going to Open a file the SD Card was DETACHED.

    I found that after ATTACH the SD Card, after a while I get it DETACHED. I send a few pictures about this.

    So I ask, what can be making the DETACH of the SD Card???
    post edited by sergioneves - 2018/05/16 09:52:57

    Attached Image(s)


    MPLAB X IDE v4.15
    Harmony v1.11
    XC32 v1.44
     
    PIC32MZ2048EFG100
    #3
    tixmcprods
    New Member
    • Total Posts : 12
    • Reward points : 0
    • Joined: 2019/06/12 15:33:51
    • Location: 0
    • Status: offline
    Re: SD Card SYS_FS_ERROR_DISK_ERR 2019/06/14 05:09:07 (permalink)
    0
    Hello,
    Do you have a solution for your problem ? I have the same...
    To be more precise, I put some debug messages around SYS_FS_FileOpen via UDP (don't have USB nor serial in my custom board) and have this error, followed by around 600 to 800 SYS_FS_ERROR_NO_FILESYSTEM (13), and suddenly it works.
    All this make a 1 second dead time, and happen sometimes, even with the same file...
    Made a ticket, hope response soon.
    Thanks for your help !
    #4
    Jump to:
    © 2019 APG vNext Commercial Version 4.5