<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://devzone.nordicsemi.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>HardFault_Handler() gets called after trying to start the LFCLK or HFCLK</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/109860/hardfault_handler-gets-called-after-trying-to-start-the-lfclk-or-hfclk</link><description>Hello, this is the code of my main.c file. In the function &amp;quot;nrf_802154_init()&amp;quot; the Hardfault handler gets called as follows: nrf_802154_init() -&amp;gt; nrf_802154_lp_timer_init() -&amp;gt; nrf_802154_clock_lfclk_start() -&amp;gt; nrf_clock_task_trigger(NRF_CLOCK_TASK_LFCLKSTART</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 04 Apr 2024 15:03:39 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/109860/hardfault_handler-gets-called-after-trying-to-start-the-lfclk-or-hfclk" /><item><title>RE: HardFault_Handler() gets called after trying to start the LFCLK or HFCLK</title><link>https://devzone.nordicsemi.com/thread/477178?ContentTypeID=1</link><pubDate>Thu, 04 Apr 2024 15:03:39 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:21b554f1-839f-44b7-87f8-6f3a329620bb</guid><dc:creator>Daniel_H</dc:creator><description>&lt;p&gt;Thank you for your help!&lt;br /&gt;&lt;br /&gt;I had to include:&lt;br /&gt;- &amp;quot;ses_startup_nrf_common.s&amp;quot;&lt;/p&gt;
&lt;p&gt;- &amp;quot;ses_startup_nrf52840.s&amp;quot;&lt;/p&gt;
&lt;p&gt;- &amp;quot;system_nrf52840.c&amp;quot;&lt;br /&gt;&lt;br /&gt;also I was getting error messages so I had to add a &amp;quot;&amp;nbsp; .tumb_func&amp;quot; in front of the &amp;quot;afterInitialize:&amp;quot; inside the &amp;quot;ses_startup_nrf_common.s&amp;quot;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: HardFault_Handler() gets called after trying to start the LFCLK or HFCLK</title><link>https://devzone.nordicsemi.com/thread/477164?ContentTypeID=1</link><pubDate>Thu, 04 Apr 2024 14:16:37 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b33f6301-b2b9-40e9-9312-baa7583d0ab3</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Looking back at the screenshot you posted earlier, it appears that you are using generic startup files for the Cortex-M. I assume those don&amp;#39;t include the device specific IRQs or initialization. I recommend you open a nRF5 SDK project to see which startup files we are using there and use the same ones in your project. You must also include&amp;nbsp;&lt;a id="" href="https://github.com/NordicSemiconductor/nrfx/blob/master/mdk/system_nrf52840.c"&gt;https://github.com/NordicSemiconductor/nrfx/blob/master/mdk/system_nrf52840.c&lt;/a&gt;&amp;nbsp;This is invoked by the startup file before&amp;nbsp;branching to main().&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: HardFault_Handler() gets called after trying to start the LFCLK or HFCLK</title><link>https://devzone.nordicsemi.com/thread/477157?ContentTypeID=1</link><pubDate>Thu, 04 Apr 2024 13:56:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b1e610df-7f6a-4571-b9fd-4fac12f85941</guid><dc:creator>Daniel_H</dc:creator><description>&lt;p&gt;Thank you. I tried including it, but I get following errors that I can&amp;#39;t resolve.&lt;br /&gt;&lt;br /&gt;&lt;img style="max-height:240px;max-width:320px;" alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/ErrorMessages.png" /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: HardFault_Handler() gets called after trying to start the LFCLK or HFCLK</title><link>https://devzone.nordicsemi.com/thread/477139?ContentTypeID=1</link><pubDate>Thu, 04 Apr 2024 13:30:26 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0b053065-7932-4075-af0c-ce3b2379c7b4</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Strange, I haven&amp;#39;t experienced this crash with 5.42a.&amp;nbsp;Another alternative is to read the memory location with nrfjprog:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;$ nrfjprog --memrd 0x40&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;The vector at 0x40 is supposed to contain the address of the CLOCK IRQ&amp;#39;s interrupt service routine. Instead it contains 0xd8fd3803, which is an invalid memory address. This explains why you get the fault expcetion whenever the&amp;nbsp;&lt;span&gt;CLOCK IRQ is triggered.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Please try to include this file in your build:&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="https://github.com/NordicSemiconductor/nrfx/blob/master/mdk/ses_startup_nrf52840.s"&gt;https://github.com/NordicSemiconductor/nrfx/blob/master/mdk/ses_startup_nrf52840.s&lt;/a&gt;&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: HardFault_Handler() gets called after trying to start the LFCLK or HFCLK</title><link>https://devzone.nordicsemi.com/thread/477109?ContentTypeID=1</link><pubDate>Thu, 04 Apr 2024 12:51:13 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6be54223-fcfc-4574-add9-4ec8cec02036</guid><dc:creator>Daniel_H</dc:creator><description>&lt;p&gt;SES 5.42a crashes when I try to read the Memory for more than 2 Byte :/&lt;br /&gt;and on the SES 8.10c the memory looks like this:&lt;br /&gt;&lt;img style="max-height:240px;max-width:320px;" alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/InterruptVector.png" /&gt;&lt;br /&gt;&lt;br /&gt;How do I know if this is the right address?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: HardFault_Handler() gets called after trying to start the LFCLK or HFCLK</title><link>https://devzone.nordicsemi.com/thread/477102?ContentTypeID=1</link><pubDate>Thu, 04 Apr 2024 12:32:00 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:041efa7c-53c8-4be5-b2a4-662da77fc812</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;The startup files are also responsible for defining the interrupt vectors. I suspect the problem may lie here, because the CPU registers show that the program is trying to service the POWER_CLOCK_IRQn when the fault occurs.&lt;/p&gt;
&lt;p&gt;Please check if the vector address for the CLOCK IRQ is correct by reading out interrupt vector at 0x40:&lt;/p&gt;
&lt;p&gt;&lt;img style="max-height:240px;max-width:320px;" src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/pastedimage1712233867172v1.png" alt=" " /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: HardFault_Handler() gets called after trying to start the LFCLK or HFCLK</title><link>https://devzone.nordicsemi.com/thread/477097?ContentTypeID=1</link><pubDate>Thu, 04 Apr 2024 12:15:33 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9e1c0e15-aff7-4f20-89be-c94fb5755db2</guid><dc:creator>Daniel_H</dc:creator><description>&lt;p&gt;I hope it is not the startup files, but the application starts ^^&lt;br /&gt;I created a project and selected the nRF52840 as Target Device.&lt;br /&gt;&lt;br /&gt;&lt;img style="max-height:240px;max-width:320px;" alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/1157.CPU_5F00_Registers.png" /&gt;&lt;br /&gt;These are the CPU registers. I hope this helps&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: HardFault_Handler() gets called after trying to start the LFCLK or HFCLK</title><link>https://devzone.nordicsemi.com/thread/477075?ContentTypeID=1</link><pubDate>Thu, 04 Apr 2024 11:13:20 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0ac2e9c4-df62-4ecc-9589-ce9ba58fcbb9</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Hi Daniel,&lt;/p&gt;
&lt;p&gt;I see you are not using the SDK provided startup files, but not sure if that is relevant for the issue. Either way, are you able to select the stack frame highlighted below and then take a screenshot of the CPU registers?&lt;/p&gt;
&lt;p&gt;&lt;img style="max-height:240px;max-width:320px;" src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/pastedimage1712229197939v1.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;Thanks,&lt;/p&gt;
&lt;p&gt;Vidar&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: HardFault_Handler() gets called after trying to start the LFCLK or HFCLK</title><link>https://devzone.nordicsemi.com/thread/476941?ContentTypeID=1</link><pubDate>Wed, 03 Apr 2024 14:52:58 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:99a8c29c-27ea-45b6-aaa3-146aec295400</guid><dc:creator>Daniel_H</dc:creator><description>&lt;p&gt;Hello Vidar,&lt;br /&gt;&lt;br /&gt;Thank you for your reply.&lt;br /&gt;&lt;br /&gt;I tried building the project with SES v5.42a and the same outcome but in the Call Stack a little bit more is shown:&lt;br /&gt;&lt;img style="max-height:240px;max-width:320px;" alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/CallStackOldSES.png" /&gt;&lt;br /&gt;in comparison to the SES 8.10c:&lt;br /&gt;&lt;img style="max-height:240px;max-width:320px;" alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/CallStackNewSES.png" /&gt;&lt;br /&gt;&lt;br /&gt;Also here are the source files I use:&lt;br /&gt;&lt;img style="max-height:240px;max-width:320px;" alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/includedFiles.png" /&gt;&lt;br /&gt;&lt;br /&gt;How would I go about if I wanted to know if the IRQ triggers the HardFault?&lt;/p&gt;
&lt;p&gt;Greetings,&lt;br /&gt;Daniel&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: HardFault_Handler() gets called after trying to start the LFCLK or HFCLK</title><link>https://devzone.nordicsemi.com/thread/476833?ContentTypeID=1</link><pubDate>Wed, 03 Apr 2024 11:08:13 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c76acda3-3bb8-4f78-8cd2-45a12d3fae91</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Hello Daniel,&lt;/p&gt;
&lt;p&gt;The nrf_clock_task_trigger() call should not cause a fault exception since it only writes to the CLOCK start task in the CLOCK peripheral. However, the CLOCK IRQ triggered after the clock starts could potentially cause this if there is a problem with interrupt handling. Does the call stack reveal where the fault exception was raised?&lt;/p&gt;
&lt;p&gt;If possible, I would recommend you try build your&amp;nbsp;project with SES v5.42a and see if you get the same result. This is the version we used for release testing of nRF5 SDK 17.1.0. You can include /components/libraries/uart/retarget.c to redirect printf to UART.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Vidar&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>