cancel
Showing results for 
Search instead for 
Did you mean: 

Showing date and time of file creation in sd card

dbgarasiya
Senior II

Hello

I have interfaced sd card with controller STM32F779BI

i have write text file in sd card but i could not see at what time file is written to sd card doesn't show in properties of that text file

is this is possible , if yes then how can i do that ?

Best Regards

Dipak Garasiya

4 REPLIES 4
berendi
Principal

You should implement the get_fattime() function. This function should return the current date and time from your RTC packed as bitfields in a 32-bit integer.

The exact layout is documented on the fatfs website.

dbgarasiya
Senior II

thanks for reply @berendi

dbgarasiya
Senior II

thanks again for giving me suggestion

DBaya.1
Associate II

Thanks a lot also!!!

I implement that:

DWORD get_fattime(void)

{

 /* USER CODE BEGIN get_fattime */

RTC_TimeTypeDef sZeit;

RTC_DateTypeDef sDatum;

DWORD attime;

HAL_RTC_GetTime(&hrtc, &sZeit, RTC_FORMAT_BIN);

HAL_RTC_GetDate(&hrtc, &sDatum, RTC_FORMAT_BIN);

attime = (((DWORD)sDatum.Year - 1980) << 25)

| ((DWORD)sDatum.Month << 21)

| ((DWORD)sDatum.Date << 16)

| (WORD)(sZeit.Hours << 11)

| (WORD)(sZeit.Minutes << 5)

| (WORD)(sZeit.Seconds >> 1);

return attime;

/* USER CODE END get_fattime */

}

Works very well...