5 Replies Latest reply on Feb 24, 2020 9:46 AM by SAJO_1338106

    RTC Day of Year error

    SAJO_1338106

      Hi All,

       

      I find this error while using time data structure.

       

      Day of the Week - 5 correct

      Day of the Month - 0x15 = 21 correct

      Month - 2 correct

      Day of Year 0x33 = 51 should be 52 i.e. 31 + 21

       

      Just wanted to know whether the way in which day of year calculated in the module is correct or not.

        • 1. Re: RTC Day of Year error
          LePo_1062026

          SAJO,

           

          Attached is a RTC project.  It appears that the Day of the Year is correct for Feb 21, 2020 = 52.

           

          Try it out.

           

          Len

          • 2. Re: RTC Day of Year error
            SAJO_1338106

            Hi Len,

             

            Appreciate your response. I saw the attachment and copied your code and found to be working(ProjeUnable to find component "cy_boot_v5_90").

            Does the following warning has something to do with it?Though I doubt that it has anything to do with the RTC module but want to make sure that these violations are also resolved.

            "Warning-1366: Setup time violation found in a path from clock ( CyBUS_CLK ) to clock ( CyBUS_CLK )."

            CyBUS_CLKCyMASTER_CLK64.000 MHz64.000 MHz62.731 MHzFrequency
            \Timer_1:TimerUDB:sT24:timerdp:u0\/z0\Timer_1:TimerUDB:sT24:timerdp:u2\/ci62.731 MHz15.941-0.316SETUP

             

            • 3. Re: RTC Day of Year error
              LePo_1062026

              SAJO,

               

              The computational error with the DayOfYear only relies on the 32KHz XTAL.

               

              To resolve the cy_boot_v5_90 problem you need to update your components.

               

              About the "Warning-1366: Setup time violation found in a path from clock ( CyBUS_CLK ) to clock ( CyBUS_CLK )." issue:  You're clocking the 24-bit Timer UDBs at 64MHz.  The max clock frequency to these UDBs for 24-bit is 28MHz.  That is the reason for the setup violation.  You need to lower the input clock or use Fixed Function versions at 16-bits (which can go up to 80MHz).

              Here's a snip of the AC Characteristics for the Timer as UDB.

              Len

              1 of 1 people found this helpful
              • 4. Re: RTC Day of Year error
                SAJO_1338106

                Hi Len,

                 

                After debugging my program, I came to know that the program halts and goes nowhere when I halt and run the program. I understand the issue is something else.

                 

                673:                                      

                674:                                        if((atoi(hour)> 7) && (atoi(hour)<19) && (RTC_1_ReadMinute() != (u_short)atoi(min)))

                0x0000172E add r0, sp, #54 ; 0x54

                0x00001730 bl d6a0 <atoi>

                0x00001734 cmp r0, #7

                0x00001736 ble.n 1790 <CYDEV_DMA_SRAM16K_MSIZE+0x790>

                0x00001738 add r0, sp, #54 ; 0x54

                0x0000173A bl d6a0 <atoi>

                0x0000173E cmp r0, #12

                0x00001740 bgt.n 1790 <CYDEV_DMA_SRAM16K_MSIZE+0x790>

                0x00001742 bl 464c <RTC_1_ReadMinute>

                0x00001746 mov r5, r0

                0x00001748 add r0, sp, #58 ; 0x58

                0x0000174A bl d6a0 <atoi>

                0x0000174E uxth r0, r0

                0x00001750 cmp r5, r0

                0x00001752 beq.n 1790 <CYDEV_DMA_SRAM16K_MSIZE+0x790>

                675:                                        {

                676:                                            RTC_1_WriteMinute((u_short)atoi(min));

                0x00001754 add r0, sp, #58 ; 0x58

                0x00001756 bl d6a0 <atoi>

                0x0000175A uxtb r0, r0

                0x0000175C bl 4604 <RTC_1_WriteMinute>

                677:                                            UART_1_PutString("Minutes updated\n");

                0x00001760 ldr r0, [pc, #1cc] ; (1930 <CYDEV_DMA_SRAM16K_MSIZE+0x930>)

                0x00001762 bl 4d54 <UART_1_PutString>

                678:                                            EEPROM_1_UpdateTemperature();

                0x00001766 bl 5090 <EEPROM_1_UpdateTemperature>

                679:                                            EEPROM_1_Write2Byte((u_short)atoi(date)*100+(u_short)atoi(hour),SYNC_ADDRESS);

                0x0000176A add r0, sp, #5c ; 0x5c

                0x0000176C bl d6a0 <atoi>

                0x00001770 mov r5, r0

                 

                I am unable to understand where the program halts and where it goes after I run the debug. Issue is something else and not RTC. I am attaching my project here as well as I will open a new thread.

                • 5. Re: RTC Day of Year error
                  SAJO_1338106

                  Link to the new post.