- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I use PSoC 4200 BLE and RTC module with DTS correction and it only works correctly if the module is initialized in the same year.
When next year comes, the correction no longer works.
If I initialize the module at the end of the year, the correction will not work at all.
This is because the calculation of the Unix time value of the correction time occurs at the moment when it is applied, and it would be necessary to increment the value of the year so that the value of the Unix time corresponds to the next year.
</
void RTC_Update(void)
{
static uint32 RTC_currentTickNumber = 0u;
RTC_currentTickNumber += RTC_updateTimePeriod;
if(RTC_currentTickNumber >= RTC_tickRefOneSec)
{
RTC_unixTime++;
RTC_currentTickNumber =
(uint32) RTC_currentTickNumber - RTC_tickRefOneSec;
#if(0u != RTC_INITIAL_DST_STATUS)
if(RTC_unixTime == RTC_unixTimeDstStart)
{
RTC_dstStatus = 1u;
RTC_dstTimeOffset = RTC_SECONDS_PER_HOUR;
}
if(RTC_unixTime == (RTC_unixTimeDstStop - RTC_dstTimeOffset))
{
RTC_dstStatus = 0u;
RTC_dstTimeOffset = 0u;
Here mast be an increase of year value in RTC_dstStartTime struct and RTC_dstStopTime struct
RTC_unixTimeDstStart = RTC_GetDstUnixTime(&RTC_dstStartTime);
RTC_unixTimeDstStop = RTC_GetDstUnixTime(&RTC_dstStopTime);
}
#endif /* (0u != RTC_INITIAL_DST_STATUS) */
#if(0u != RTC_INITIAL_ALARM_STATUS)
if((RTC_unixTime + RTC_dstTimeOffset) == RTC_unixTimeAlarm)
{
RTC_currentTimeDate.status |= (1uL << RTC_STATUS_ALARM_OFFSET);
RTC_alarmCurStatus = RTC_alarmCfgMask;
RTC_unixTimeAlarm =
RTC_GetNexAlarmTime(RTC_unixTime + RTC_dstTimeOffset,
(uint8)RTC_alarmCfgMask);
/* Call callback function only after new alarm time is obtained.
* Cypress ticket #264756
*/
if (RTC_alarmCallbackPtr != NULL)
{
RTC_alarmCallbackPtr();
}
}
#endif/* (0u != RTC_INITIAL_ALARM_STATUS) */
}
}
/>
I cannot confirm email and add messages due to a bug on your site, the email section is not active
Solved! Go to Solution.
- Labels:
-
PSoC Creator & Designer Software
- Tags:
- dts
- PSoC 4-BLE
- rtc
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
For RTC alarm functionality, please refer to the 'RTC_P4_WDT_Example' code example from the PSoC Creator. This example project demonstrates the basic operation of the RTC: set/get the current Date/Time, use the DST feature, and use the alarm feature. The project sends Date and Time and the alarm status over UART through terminal.
Thanks,
P Yugandhar.