Skip to main content
Graduate II
May 15, 2023
Question

how to setup time stamp on SD card

  • May 15, 2023
  • 3 replies
  • 1689 views

I do have RTC working and SD, I found this code

 FRESULT set_timestamp (char *obj)

   {

   FILINFO fno;

   HAL_RTC_GetTime(&hrtc, &sTime, RTC_FORMAT_BIN);

      HAL_RTC_GetDate(&hrtc, &sDate, RTC_FORMAT_BIN);

   int hour = sTime.Hours;

   int min = sTime.Minutes;

   int sec = sTime.Seconds;

   int month = sDate.Month;

   int mday = sDate.Date;

   int year = sDate.Year;

   year+=2000;

   fno.fdate = (WORD)(((year - 1980) << 9) | month << 5 | mday);

   fno.ftime = (WORD)(hour <<11 | min <<5 | sec/2 );

  f_utime(obj, &fno);

   }

but it keeps saying undefined symbol f_utime

I see that ff.c contain this function, I do not know what the problem is

    This topic has been closed for replies.

    3 replies

    Technical Moderator
    May 15, 2023

    Please precise which product you are using.

    Regards.

    MNapiAuthor
    Graduate II
    May 15, 2023

    it is custom board STM32L4S9ZIT6, as I mentioned everything is working fine calendar, SD card is working fine. Created in CubeMX 6.8.0

    Super User
    May 15, 2023

    in fatfs by chan... ->

    http://elm-chan.org/fsw/ff/doc/utime.html


    _legacyfs_online_stmicro_images_0693W00000bk6niQAA.png+++ set in cube: fatfs -> set defines !!! ->


    _legacyfs_online_stmicro_images_0693W00000bk6kzQAA.png

    MNapiAuthor
    Graduate II
    May 15, 2023

    I already found this link in Google, there is nothing to help me solve the problem.

    Graduate II
    May 15, 2023

    Removed MPU tag, betting your not using those.

    PLEASE always state the MODEL/FAMILY of MCU you're using in the TOP POST, it's not hard and conveys useful contextual information.

    Check how you're building / configuring FatFS

    Make sure you have clock info handled in DISKIO.C unpack a SysTick counter into human / calendar centric data, or use RTC, or whatever..