AnsweredAssumed Answered


Question asked by jdcowpland on Jan 31, 2014
Latest reply on Feb 26, 2014 by jdcowpland
Anyone got any experience using the f_utime function from chan's fatfs? I've got a function that uses it to put a timestamp on a file I create on an SD card, but it returns INVALID_NAME every time. Not quite sure why. Anybody have any ideas? (Btw, I'm using a STM32F415VG if that helps). My code looks like this:

FRESULT set_timestamp (char *obj)
    FILINFO fno;
    RTC_TimeTypeDef    RTC_TimeStructure;
    RTC_DateTypeDef    RTC_DateStructure;
    int hour  = RTC_TimeStructure.RTC_Hours;
    int min  = RTC_TimeStructure.RTC_Minutes;
    int sec  = RTC_TimeStructure.RTC_Seconds;
    int month  = RTC_DateStructure.RTC_Month;
    int mday  = RTC_DateStructure.RTC_Date;
    int year = RTC_DateStructure.RTC_Year;
    fno.fdate = (WORD)(((year - 1980) << 9) | month << 5 | mday);
    fno.ftime = (WORD)(hour <<11 | min <<5 | sec/2 );
    return f_utime(obj, &fno);