Hot!PIC32 SD Card Write Faliure

Author
mitun.chidamparam
New Member
  • Total Posts : 11
  • Reward points : 0
  • Joined: 2018/09/10 05:36:13
  • Location: 0
  • Status: offline
2019/01/24 09:19:32 (permalink)
0

PIC32 SD Card Write Faliure

Hello people,


I am currently using a PIC32MZ2064DAG176 for our project.
Mplab X IDE v5.05
Harmony v2_05_01

I am using the Harmony SDHC drivers to read data from the SD card. The read operations work like a charm. Able to access the data and manipulate them, store them on to the Ram.

After reading the file, I try to save a string to a new file in the SD card. Although when I check my SD card, no such file has been created or written into.

The below given functions are the ones which I used to manipulate the SD card :
SYS_FS_Mount
SYS_FS_CurrentDriveSet
SYS_FS_FILE_OPEN_WRITE
SYS_FS_FileWrite
SYS_FS_FileClose
SYS_FS_Unmount

Although none of these functions returned an error for creating or manipulating the file. If there was no error, how come the file is not present in the SD card. Can anyone give me some hints on how I can proceed further?

Thank you for the time.
post edited by mitun.chidamparam - 2019/01/24 09:26:47
#1

6 Replies Related Threads

    bastl
    New Member
    • Total Posts : 23
    • Reward points : 0
    • Joined: 2018/12/27 07:25:34
    • Location: 0
    • Status: offline
    Re: PIC32 SD Card Write Faliure 2019/01/26 10:51:12 (permalink)
    0
    Without a file you can not set the flags open_write to it.
    Look if you can create a file with SYS_FS_CREATE.
    #2
    mitun.chidamparam
    New Member
    • Total Posts : 11
    • Reward points : 0
    • Joined: 2018/09/10 05:36:13
    • Location: 0
    • Status: offline
    Re: PIC32 SD Card Write Faliure 2019/01/28 01:47:29 (permalink)
    0
    Hello, 
    In my sys_fs.h, I cannot find SYS_FS_CREATE fucntion. What version of Harmony and MPLAB are you using?
    #3
    Mysil
    Super Member
    • Total Posts : 3082
    • Reward points : 0
    • Joined: 2012/07/01 04:19:50
    • Location: Norway
    • Status: offline
    Re: PIC32 SD Card Write Faliure 2019/01/28 03:35:41 (permalink)
    0
    Hi,
    In ELM-Chan implementation of FatFs, which I think is used inside Harmony, creation and opening of files are both performed by the same function:  f_open(),  details beeing controlled by option flags.
    FA_OPEN_EXISTING  Opens the file. The function fails if the file is not existing. (Default)
    FA_OPEN_ALWAYS    Opens the file if it is existing. If not, a new file will be created.
    either of these should be combined with:
    FA_READ      Specifies read access to the object. Data can be read from the file.
    FA_WRITE    Specifies write access to the object. Data can be written to the file. Combine with FA_READ for read-write access.
     
    In Harmony, this is wrapped into interface functions, details of how this is done, I do not know.
    See also this thread: https://www.microchip.com/forums/FindPost/1060312
     
        Mysil
    #4
    mitun.chidamparam
    New Member
    • Total Posts : 11
    • Reward points : 0
    • Joined: 2018/09/10 05:36:13
    • Location: 0
    • Status: offline
    Re: PIC32 SD Card Write Faliure 2019/01/29 23:39:07 (permalink)
    0
    PIC32MZ DA has integrated DRAM. Could the issue be with caching?
    I also tried setting my buffer as :
     unsigned int __attribute__((coherent)) buffer[1024];
     
    But it did not solve the issue.
    #5
    moser
    Super Member
    • Total Posts : 417
    • Reward points : 0
    • Joined: 2015/06/16 02:53:47
    • Location: Germany
    • Status: offline
    Re: PIC32 SD Card Write Faliure 2019/01/30 03:07:39 (permalink)
    4 (1)
    Writing files was one of my very positive Harmony experiences, because it worked instantly more or less on first try. 
     
    I guess you should show us your code, which you use for writing. Or at least all file system function calls fully and all declarations for the variables, which are used in those calls.
     
     
    #6
    mitun.chidamparam
    New Member
    • Total Posts : 11
    • Reward points : 0
    • Joined: 2018/09/10 05:36:13
    • Location: 0
    • Status: offline
    Re: PIC32 SD Card Write Faliure 2019/02/14 01:31:29 (permalink)
    4 (1)
    Thanks for the support. I solved the issue. The problem was the SDHC driver configuration was not set properly.
    #7
    Jump to:
    © 2019 APG vNext Commercial Version 4.5