<?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>nRF52840 UARTE1 Interrupt Crashes in MBR Region</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/59500/nrf52840-uarte1-interrupt-crashes-in-mbr-region</link><description>I&amp;#39;m working on a project where UART0 is used as a nrf logger uart back-end. Recently I&amp;#39;ve tried adding UARTE1 to the project to implement additional serial communications, but I&amp;#39;m running into some issues. After much trial and error I&amp;#39;ve attempted to</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 02 Apr 2020 13:46:17 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/59500/nrf52840-uarte1-interrupt-crashes-in-mbr-region" /><item><title>RE: nRF52840 UARTE1 Interrupt Crashes in MBR Region</title><link>https://devzone.nordicsemi.com/thread/243208?ContentTypeID=1</link><pubDate>Thu, 02 Apr 2020 13:46:17 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:dd0a4541-e17b-454a-b8d9-2aeae3e2bfec</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;then I cannot understand why&amp;nbsp;&lt;span&gt;nrf_drv_uart_tx is causing this. Can you please upload a project where i can reproduce this. I can try to debug and find the root cause and a workaround.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52840 UARTE1 Interrupt Crashes in MBR Region</title><link>https://devzone.nordicsemi.com/thread/243202?ContentTypeID=1</link><pubDate>Thu, 02 Apr 2020 13:01:55 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a0288393-50e3-439c-8ae1-e9f90e79d5c3</guid><dc:creator>Kenneth</dc:creator><description>&lt;p&gt;That&amp;#39;s good to know.&amp;nbsp; However, I&amp;#39;m using the default priority for nrf_drv_uart of UART_DEFAULT_CONFIG_IRQ_PRIORITY = 7.&amp;nbsp; All my callback is doing is setting a volatile global boolean to true, then returning.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52840 UARTE1 Interrupt Crashes in MBR Region</title><link>https://devzone.nordicsemi.com/thread/243182?ContentTypeID=1</link><pubDate>Thu, 02 Apr 2020 12:21:57 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d6a137ea-5c7f-4291-ac9d-906060c20090</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;Which context are you calling the&amp;nbsp;&lt;span&gt;nrf_drv_uart_tx?&amp;nbsp;Seems like something is happening in the uart callback handler.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;span&gt;&lt;span&gt;What is the priority which which you initialize the nrf_drv_uart?&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;UART_DEFAULT_CONFIG_IRQ_PRIORITY?&lt;/li&gt;
&lt;li&gt;what are you doing inside the uart_callback handler?&amp;nbsp;&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;If you have changed the priority of uart driver to high, and calling some sd_xxx from inside the uart callback handler, that would cause an hardfault, This is because all calls to sd_xxx are converted to SVC calls which are at &lt;a href="https://infocenter.nordicsemi.com/index.jsp?topic=%2Fsds_s140%2FSDS%2Fs1xx%2Fprocessor_avail_interrupt_latency%2Fexception_mgmt_sd.html&amp;amp;cp=4_6_3_0_15_1"&gt;priority 4&lt;/a&gt;. Calling sd_xxx calls from higher priority context would immediately trigger an hardfault on ARM Cortex architectures.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52840 UARTE1 Interrupt Crashes in MBR Region</title><link>https://devzone.nordicsemi.com/thread/242555?ContentTypeID=1</link><pubDate>Mon, 30 Mar 2020 21:08:35 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:599a25a0-953a-44a4-8ca6-efa753b72596</guid><dc:creator>Kenneth</dc:creator><description>&lt;p&gt;The call stack window just contains the HardFault_Handler with no previous state.&amp;nbsp; It also breaks when it attempts to execute at 0xA60, but also with no call stack.&amp;nbsp; If I comment out the call to nrf_drv_uart_tx there is no crash and HardFault_Handler is not called.&amp;nbsp; I do see the full UART message display on my FTDI cable I have connected to it which is why I thought it could be related to the TX DONE event being triggered.&amp;nbsp; The program does have BLE running during this time but removing BLE processing does not seem to affect it.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52840 UARTE1 Interrupt Crashes in MBR Region</title><link>https://devzone.nordicsemi.com/thread/242422?ContentTypeID=1</link><pubDate>Mon, 30 Mar 2020 12:59:13 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:62c2daf8-f257-40c7-bbee-92ca87a80d45</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;Hmm, looks like a crash in the MBR, which should not happen. What is the context before this happens? can you see anything meaningful in the call stack window?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52840 UARTE1 Interrupt Crashes in MBR Region</title><link>https://devzone.nordicsemi.com/thread/242101?ContentTypeID=1</link><pubDate>Fri, 27 Mar 2020 13:13:34 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6b529d16-7617-41f6-8ebf-8f99822422ba</guid><dc:creator>Kenneth</dc:creator><description>&lt;p&gt;I updated my code as requested and got the following when using __get_PSP:&lt;/p&gt;
&lt;p&gt;p_addr = 0x18&lt;/p&gt;
&lt;p&gt;addr = 0x733.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I also ran it again with __get_MSP and got the following:&lt;/p&gt;
&lt;p&gt;p_addr = 0x2003eef8&lt;/p&gt;
&lt;p&gt;addr = 0xE0&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Based on p_addr, I believe MSP is the correct stack pointer to use.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52840 UARTE1 Interrupt Crashes in MBR Region</title><link>https://devzone.nordicsemi.com/thread/242010?ContentTypeID=1</link><pubDate>Fri, 27 Mar 2020 08:28:33 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4973469c-c18c-489f-8dc4-0810f1e407e1</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;most likely it is the PSP and not the MSP for your application.&lt;/p&gt;
&lt;p&gt;Also the address of the instruction that is causing the&amp;nbsp; hard fault is given by&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&amp;nbsp;uint32_t *p_addr = (void *)( __get_PSP()) + 0x18;&lt;br /&gt;&amp;nbsp;uint32_t addr = *(p_addr);&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Then the addr would contain the address of&amp;nbsp; instruction that caused hardfault&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52840 UARTE1 Interrupt Crashes in MBR Region</title><link>https://devzone.nordicsemi.com/thread/241969?ContentTypeID=1</link><pubDate>Thu, 26 Mar 2020 19:43:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:66f3f008-1319-402d-bc1e-73272d8d8603</guid><dc:creator>Kenneth</dc:creator><description>&lt;p&gt;Hi Susheel,&lt;/p&gt;
&lt;p&gt;I created the hardfault handler similar to the tutorial but updated the offset to point to PC on the stack and got 0x000000E0.&amp;nbsp; This would be the interrupt handler, correct?&lt;/p&gt;
&lt;p&gt;Below is the code I used to display the PC in case I made a mistake.&lt;/p&gt;
&lt;p&gt;void HardFault_Handler(void)&lt;br /&gt;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; uint32_t *addr = (void *)( __get_MSP()) + 0x18; &lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; NRF_LOG_ERROR(&amp;quot;Hard Fault at address:&amp;quot;);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; NRF_LOG_ERROR(&amp;quot; 0x%08x\r\n&amp;quot;, (unsigned int)*addr);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; NRF_LOG_FLUSH();&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; while(1)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ;&lt;br /&gt;}&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52840 UARTE1 Interrupt Crashes in MBR Region</title><link>https://devzone.nordicsemi.com/thread/241734?ContentTypeID=1</link><pubDate>Thu, 26 Mar 2020 08:23:09 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7359876c-84f5-4094-9fc3-d046443c767f</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;You should be able to get the address of the instruction that is causing the hardfault by backtracking the stack.similar to how it is done in this threads&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/question/45680/how-can-i-distinguish-the-reason-for-hardfault/"&gt;post 1&lt;/a&gt;&lt;br /&gt;&lt;a href="https://devzone.nordicsemi.com/question/41106/how-to-trace-back-hard-fault-handler/"&gt;post 2&lt;/a&gt;&lt;br /&gt;&lt;a href="https://devzone.nordicsemi.com/blogs/821/an-introduction-to-error-handling-in-nrf5-projects/"&gt;tutorial 1&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Once you know which instruction is causing this by looking at the instruction address in the .map file, we can try to get a workaround based on the context.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>