Skip to main content
MNapi
Senior 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

PatrickF
Technical Moderator
May 15, 2023

Please precise which product you are using.

Regards.

In order to give better visibility on the answered topics, please click on 'Best Answer' on the reply which solved your issue or answered your question.Tip of the day: Try Sidekick STM32 AI agent
MNapi
MNapiAuthor
Senior 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

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

"If you feel a post has answered your question, please click ""Accept as Solution""."
MNapi
MNapiAuthor
Senior II
May 15, 2023

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

Tesla DeLorean
Guru
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..

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