<?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>Application crashing during UART communication after flashing SoftDevice+Bootloader+Application</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/57696/application-crashing-during-uart-communication-after-flashing-softdevice-bootloader-application</link><description>Hello, 
 I am trying to implement ble DFU on our custom nRF52832 board. Up until now we have had no issues with our application running as SoftDevice+Application but some issues have arisen with the implementation of the DFU. 
 
 Controllers: 
 
 
 Rigado</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 14 Feb 2020 00:12:03 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/57696/application-crashing-during-uart-communication-after-flashing-softdevice-bootloader-application" /><item><title>RE: Application crashing during UART communication after flashing SoftDevice+Bootloader+Application</title><link>https://devzone.nordicsemi.com/thread/234285?ContentTypeID=1</link><pubDate>Fri, 14 Feb 2020 00:12:03 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a2350dfa-a209-4686-a684-29f4c24cf33e</guid><dc:creator>MichaelKesemHealth</dc:creator><description>&lt;p&gt;Hi Einar,&lt;/p&gt;
&lt;p&gt;Thank you for your response.&amp;nbsp;By some fluke the&amp;nbsp;controller worked after one flash but attempting to read system variables set on the device gave very strange data. This along with your mentioning of memory layouts prompted me to go looking how our apps layout&amp;nbsp; layout and what&amp;nbsp;correct way to do its&lt;/p&gt;
&lt;p&gt;After a bit of digging and lots of testing I found that there was a whole chunk&amp;nbsp;boot loader memory locations being overwritten by the application during run-time which is what was happening during the UART read. The app would try to read/write override bootloader memory locations causing weird unpredictable behaviour and mostly crashing. So I&amp;nbsp;shifted all these variables down to stay clear of the bootloader and suddenly everything WORKS.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/pastedimage1581638066938v1.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Thank you so much for your response, its been a very challenging project as I have been carrying on from another engineer without much documentation on what had been done before.&lt;/p&gt;
&lt;p&gt;:)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Application crashing during UART communication after flashing SoftDevice+Bootloader+Application</title><link>https://devzone.nordicsemi.com/thread/234024?ContentTypeID=1</link><pubDate>Wed, 12 Feb 2020 14:50:37 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9555e5d1-a2d4-49fa-a8ba-3830a5bf88c4</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi&amp;nbsp;Michael,&lt;/p&gt;
[quote user=""]Reading from the device seems to work but any attempt to write to the device will cause it to freeze until reset. I do not think its related to flash writing as we have managed to successfully write to flash without the communication and it does not crash.[/quote]
&lt;p&gt;I must admit that this sounds a bit strange. As you write, the bootloader is completely independent of the application, so the only thing you need to remember is to respect the &lt;a href="https://infocenter.nordicsemi.com/topic/sdk_nrf5_v16.0.0/lib_bootloader.html?cp=7_1_3_5_0_7#lib_bootloader_memory"&gt;memory layout&lt;/a&gt;. What happens when the device freezes? Have you checked with a debugger what state it is in? Is an error detected by an error handler, or is it stuck in some eternal loop waiting for something that never happens or similar?&lt;/p&gt;
[quote user=""]Device is cashing ONLY during write events that happen through UART communication.[/quote]
&lt;ul&gt;
&lt;li&gt;What happens if you write to the same flash address directly (not over UART)?&lt;/li&gt;
&lt;li&gt;Or if you do the exact same thing over UART, just don&amp;#39;t write to flash?&lt;/li&gt;
&lt;li&gt;What is the flash address range you write to?&lt;/li&gt;
&lt;li&gt;and what does your memory layout look like?&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Einar&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>