<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>Kinetis Software Development Kit中的主题 Re: SDK Real-time clock adaptation hanging after running cmd_get_datetime</title>
    <link>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/SDK-Real-time-clock-adaptation-hanging-after-running-cmd-get/m-p/430698#M2510</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Piotr Cerba:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;At the beginning you mentioned "...&lt;EM&gt;adopting majority of code from SDK example for RTC"&lt;/EM&gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What do you mean with majority? Could you post your project so I can give it a check?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In case it is useful I attached the standalone version of the demo &lt;STRONG&gt;rtc_func_frdmkl43z&lt;/STRONG&gt;.&lt;/P&gt;&lt;P&gt;About your edits and the steps I took to create the project:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- EDIT1: That is true, for most projects you need to pull the &lt;STRONG&gt;fsl_&amp;lt;module&amp;gt;_irq.c&lt;/STRONG&gt; file, but in this case the functions in &lt;STRONG&gt;fsl_rtc_irq.c&lt;/STRONG&gt; are different from those of the demo, defined in &lt;STRONG&gt;main.c&lt;/STRONG&gt;. So you can remove the file and use the same functions as in &lt;STRONG&gt;main.c&lt;/STRONG&gt;.&lt;/P&gt;&lt;P&gt;- EDIT2: For MQX it is required to have vectors in RAM so you can install interrupt handlers. For a baremetal application it is not strictly required.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- Copy the linker flags and change the language (in Cross ARM C Compiler -&amp;gt; Optimization) to &lt;STRONG&gt;GNU ISO C99(-std=gnu99)&lt;/STRONG&gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Let me know about any doubts.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards!&lt;/P&gt;&lt;P&gt;Jorge Gonzalez&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 05 Oct 2015 23:36:48 GMT</pubDate>
    <dc:creator>Jorge_Gonzalez</dc:creator>
    <dc:date>2015-10-05T23:36:48Z</dc:date>
    <item>
      <title>SDK Real-time clock adaptation hanging after running cmd_get_datetime</title>
      <link>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/SDK-Real-time-clock-adaptation-hanging-after-running-cmd-get/m-p/430696#M2508</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello, in this thread &lt;A _jive_internal="true" data-containerid="11234" data-containertype="14" data-objectid="376716" data-objecttype="1" href="https://community.nxp.com/thread/376716" rel="nofollow noopener noreferrer" target="_blank"&gt;Unable to use an RTC example - source files missing in KDS 3.0&lt;/A&gt; thanks to Jorge Gonzalez I managed to successfully build a project adopting majority of code from SDK example for RTC.&lt;/P&gt;&lt;P&gt;Now I have encountered another problem. &lt;/P&gt;&lt;P&gt;When I debug the SDK example after calling&lt;/P&gt;&lt;PRE class="c++" name="code"&gt;cmd_get_datetime();&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;P&gt;it goes for the following calls: &lt;/P&gt;&lt;P&gt;1. &lt;/P&gt;&lt;PRE class="c++" name="code"&gt;RTC_DRV_GetDatetime(0, &amp;amp;date);&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;P&gt;Then:&lt;/P&gt;&lt;P&gt;2. &lt;/P&gt;&lt;PRE class="c++" name="code"&gt;RTC_HAL_GetDatetimeInSecs(RTC_Type *rtcBase, uint32_t * seconds)&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;P&gt;3. &lt;/P&gt;&lt;PRE class="c++" name="code"&gt;RTC_HAL_GetSecsReg(RTC_Type *rtcBase)&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;P&gt;And from 3. it calls &lt;/P&gt;&lt;P&gt;4. &lt;/P&gt;&lt;PRE class="c++" name="code"&gt;RTC_RD_TSR(rtcBase);&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;P&gt;Stepping into 4. returns the debugger up to point 2.&lt;/P&gt;&lt;P&gt;Everything works OK.&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="text-decoration: underline;"&gt;However, in my application&lt;/SPAN&gt; putting same (with all preceeding initializations copied from SDK example):&lt;/P&gt;&lt;PRE class="c++" name="code"&gt;cmd_get_datetime();&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;P&gt;After identical jumps to 1, 2, 3 and 4 it jumps to &lt;SPAN style="text-decoration: underline;"&gt;one more&lt;/SPAN&gt; file &lt;STRONG&gt;startup_MKL43Z4.S &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;where it loops infinitely around the following fragment of assembly code (ldr and bx):&lt;/P&gt;&lt;PRE class="c++" name="code"&gt;DefaultISR: &amp;nbsp;&amp;nbsp;&amp;nbsp; ldr r0, =DefaultISR &amp;nbsp;&amp;nbsp;&amp;nbsp; bx r0 &amp;nbsp;&amp;nbsp;&amp;nbsp; .size DefaultISR, . - DefaultISR&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;P&gt;So the behaviour differs from original SDK example, where after calling RTC_RD_TSR(rtcBase); it immediately returns to the calling function.&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12pt;"&gt;Do you have any idea what might be causing it?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12pt;"&gt;Why does it enter a section concerning some DefaultISR, if I do not trigger any interrupt?&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 01 Oct 2015 22:18:34 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/SDK-Real-time-clock-adaptation-hanging-after-running-cmd-get/m-p/430696#M2508</guid>
      <dc:creator>piotrcerba</dc:creator>
      <dc:date>2015-10-01T22:18:34Z</dc:date>
    </item>
    <item>
      <title>Re: SDK Real-time clock adaptation hanging after running cmd_get_datetime</title>
      <link>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/SDK-Real-time-clock-adaptation-hanging-after-running-cmd-get/m-p/430697#M2509</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;After searching for USB0_IRQHandler I found a topic with identical observation &lt;A href="https://community.nxp.com/thread/358026" rel="noopener noreferrer" target="_blank"&gt;MK2251212_features.h error? USB IRQ Location?&lt;/A&gt; , despite the fact that mr Donald Bosley was using DMA and some USB functionalities and I am not.&lt;/P&gt;&lt;P&gt;In my case after thorough debugging session I managed to find that not necessarily&lt;/P&gt;&lt;PRE __default_attr="c++" __jive_macro_name="code" class="jive_macro_code jive_text_macro _jivemacro_uid_14438112678847406" data-renderedposition="71_8_1232_16" jivemacro_uid="_14438112678847406"&gt;&lt;P&gt;cmd_get_datetime();&lt;/P&gt;&lt;/PRE&gt;&lt;P&gt;is causing trouble.&lt;/P&gt;&lt;P&gt;The first line causing problems is the call to&lt;/P&gt;&lt;PRE __default_attr="c++" __jive_macro_name="code" class="jive_macro_code _jivemacro_uid_14438112636062941 jive_text_macro" data-renderedposition="129_8_1232_16" jivemacro_uid="_14438112636062941"&gt;&lt;P&gt;hardware_init();&lt;/P&gt;&lt;/PRE&gt;&lt;P&gt;which has the following body:&lt;/P&gt;&lt;PRE __default_attr="c++" __jive_macro_name="code" class="_jivemacro_uid_14438114730446363 jive_macro_code jive_text_macro" data-renderedposition="166_8_1232_144" jivemacro_uid="_14438114730446363"&gt;&lt;P&gt;void hardware_init(void) {&lt;/P&gt;&lt;P&gt;&amp;nbsp; /* enable clock for PORTs */&lt;/P&gt;&lt;P&gt;&amp;nbsp; CLOCK_SYS_EnablePortClock(PORTA_IDX);//This line does NOT cause error&lt;/P&gt;&lt;P&gt;&amp;nbsp; CLOCK_SYS_EnablePortClock(PORTC_IDX);//This line does NOT cause error&lt;/P&gt;&lt;P&gt;&amp;nbsp; CLOCK_SYS_EnablePortClock(PORTD_IDX);//This line does NOT cause error&lt;/P&gt;&lt;P&gt;&amp;nbsp; /* Init board clock */&lt;/P&gt;&lt;P&gt;&amp;nbsp; BOARD_ClockInit();//These DO&lt;/P&gt;&lt;P&gt;&amp;nbsp; dbg_uart_init();//These DO&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;/PRE&gt;&lt;P&gt;and the BOARD_ClockInit(); and dbg_uart_init() are the lines causing the jump to the Default interrupt, leading to an infinite loop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My guess is that the ISR vector table is somehow wrong. Am I right? If yes - how to fix it?&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;NOTE:&lt;/STRONG&gt; I do not use UART (it seems that the error is connected with it)&lt;/P&gt;&lt;P&gt;&lt;SPAN class="lia-inline-image-display-wrapper" image-alt="Capture9.PNG"&gt;&lt;IMG alt="Capture9.PNG" src="https://community.nxp.com/t5/image/serverpage/image-id/58614i3F0BBA9EB6ED6368/image-size/large?v=v2&amp;amp;px=999" title="Capture9.PNG" /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;EDIT:&lt;/STRONG&gt; I found this in &lt;STRONG&gt;SDK FAQ&lt;/STRONG&gt;:&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;P style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif; color: #51626f;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: inherit; color: #00b050;"&gt;I’m trying to use a driver and keep falling into the default ISR in startup_&amp;lt;mcu&amp;gt;.s&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif; color: #51626f;"&gt;Make sure to include an interrupt handler for the peripheral you’re using inside your project. By default, all the peripheral IRQ handlers go into a default handler that does an infinite branch. The easiest way to fix this issue is to add the C:\Freescale\KSDK_1.2.0\platform\drivers\src\&amp;lt;drivername&amp;gt;\fsl_&amp;lt;drivername&amp;gt;_irq.c file inside your project.&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;I placed fsl_rtc_irq.c in my Project folder, however this did not change the behaviour. Application is still jumping to infinite Default IRQ. What am I doing wrong?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;EDIT2:&lt;/STRONG&gt;&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;P&gt;Relocating vectors to RAM&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;from "Interrupt_handling_KSDK.pdf" also did not help. Program still goes to USB0_IRQHandler.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Maybe I should add some of the Cross ARM C Linker -&amp;gt; Miscellaneous -&amp;gt; Other linker flags from the working SDK RTC example?&lt;/P&gt;&lt;P&gt;&lt;SPAN style="text-decoration: line-through;"&gt;They are as follows:&lt;/SPAN&gt;&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;P&gt;&lt;SPAN style="text-decoration: line-through;"&gt;-Xlinker -z&amp;nbsp; -Xlinker muldefs&amp;nbsp;&amp;nbsp; --specs=nano.specs&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; -Wall&amp;nbsp; -fno-common&amp;nbsp; -ffunction-sections&amp;nbsp; -fdata-sections&amp;nbsp; -ffreestanding&amp;nbsp; -fno-builtin&amp;nbsp; -Os&amp;nbsp; -mapcs&amp;nbsp; -Xlinker -static&amp;nbsp; -Xlinker --defsym=__stack_size__=0x2000&amp;nbsp; -Xlinker --defsym=__heap_size__=0x2000 &lt;/SPAN&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;^ I have checked them, and with this linker flags the project does not compile.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;After performing the steps from Edit1 and Edit2 the program again "crashes" with the call to cmd_get_datetime()&lt;/P&gt;&lt;P&gt;hardware_init(); does &lt;SPAN style="text-decoration: underline;"&gt;not&lt;/SPAN&gt; cause the jump to Default ISR now.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 02 Nov 2020 13:20:19 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/SDK-Real-time-clock-adaptation-hanging-after-running-cmd-get/m-p/430697#M2509</guid>
      <dc:creator>piotrcerba</dc:creator>
      <dc:date>2020-11-02T13:20:19Z</dc:date>
    </item>
    <item>
      <title>Re: SDK Real-time clock adaptation hanging after running cmd_get_datetime</title>
      <link>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/SDK-Real-time-clock-adaptation-hanging-after-running-cmd-get/m-p/430698#M2510</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Piotr Cerba:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;At the beginning you mentioned "...&lt;EM&gt;adopting majority of code from SDK example for RTC"&lt;/EM&gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What do you mean with majority? Could you post your project so I can give it a check?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In case it is useful I attached the standalone version of the demo &lt;STRONG&gt;rtc_func_frdmkl43z&lt;/STRONG&gt;.&lt;/P&gt;&lt;P&gt;About your edits and the steps I took to create the project:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- EDIT1: That is true, for most projects you need to pull the &lt;STRONG&gt;fsl_&amp;lt;module&amp;gt;_irq.c&lt;/STRONG&gt; file, but in this case the functions in &lt;STRONG&gt;fsl_rtc_irq.c&lt;/STRONG&gt; are different from those of the demo, defined in &lt;STRONG&gt;main.c&lt;/STRONG&gt;. So you can remove the file and use the same functions as in &lt;STRONG&gt;main.c&lt;/STRONG&gt;.&lt;/P&gt;&lt;P&gt;- EDIT2: For MQX it is required to have vectors in RAM so you can install interrupt handlers. For a baremetal application it is not strictly required.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- Copy the linker flags and change the language (in Cross ARM C Compiler -&amp;gt; Optimization) to &lt;STRONG&gt;GNU ISO C99(-std=gnu99)&lt;/STRONG&gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Let me know about any doubts.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards!&lt;/P&gt;&lt;P&gt;Jorge Gonzalez&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 05 Oct 2015 23:36:48 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/SDK-Real-time-clock-adaptation-hanging-after-running-cmd-get/m-p/430698#M2510</guid>
      <dc:creator>Jorge_Gonzalez</dc:creator>
      <dc:date>2015-10-05T23:36:48Z</dc:date>
    </item>
  </channel>
</rss>

