cancel
Showing results for 
Search instead for 
Did you mean: 

how to setup time stamp on SD card

MNapi
Senior III

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

5 REPLIES 5
PatrickF
ST Employee

Please precise which product you are using.

Regards.

In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.
AScha.3
Chief III

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

If you feel a post has answered your question, please click "Accept as Solution".

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..

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

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

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