Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

PSoC™ 6

Level 2
10 sign-ins 5 replies posted 5 questions asked
Level 2


I'm using Modustoolbox to run the example AnyCloud_MQTT_Client with AWS on the board CY8CPROTO-062-4343W.

I modified the example just to update the RTC to be able to add a timestamp to the MQTT json messages that are sent to the cloud. 

If I update the RTC before the MQTT connection is done,  then, once the app connects to the MQTT broker the RTC goes to EPOCH 1970-01-01 00:00:00. Dunno if this means that the RTC is reseted. 

If I wait until the app connects to MQTT  and then I  update the RTC then it works fine and the RTC keeps providing updated time.  

Any idea why this is happening? or what am I missing here?

I'm using the code snippes in [1] to update the RTC 

/*Sample code-Update the current time and date to the RTC peripheral */
result = cyhal_rtc_write(&my_rtc, &new_date_time);

[1] https://infineon.github.io/psoc6hal/html/group__group__hal__rtc.html


1 Solution
Moderator First comment on KBA First comment on blog 5 questions asked

Hello @mvpablo ,

Some developments on this. Since the RTC is being used internally, you need to set the instance right after initialization i.e. cy_set_rtc_instance must be called right aftercyhal_rtc_init and this should fix the issue. 

This has been documented as part of the Time Support Details section in the clib-support library, you can find its readme here


View solution in original post

2 Replies