<?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>trouble flashing nRF52840 Dongle with non-example code</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/40871/trouble-flashing-nrf52840-dongle-with-non-example-code</link><description>This question comes from my high-level goal of testing I2C using the SWDIO/SWDCLK pins on the nRF52840 Dongle, so if there are faster ways to experiment with that functionality, I&amp;#39;m all ears. 
 
 Before the nRF52840 Dongle (PCA10059), I&amp;#39;ve been experimenting</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 26 Nov 2018 10:03:21 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/40871/trouble-flashing-nrf52840-dongle-with-non-example-code" /><item><title>RE: trouble flashing nRF52840 Dongle with non-example code</title><link>https://devzone.nordicsemi.com/thread/158983?ContentTypeID=1</link><pubDate>Mon, 26 Nov 2018 10:03:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:837f95ec-97d6-4fe9-a812-77abe6d2f055</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;The lack of debugger means that the nRF52840 Dongle is not as well suited for development as DK&amp;#39;s which have an onboard debugger.&lt;/p&gt;
&lt;p&gt;1. Yes.&amp;nbsp;The nRF52840 Dongle use a USB bootloader, and you need to make room for it. You need the USB bootloader unless you connect and external debugger, there is no other way around it.&lt;/p&gt;
&lt;p&gt;2. You can adapt most SDK example for the nRF52840 DK to run on the dongle with a few modifications. The most important reasons for these modifications is that the Dongle has different number of and pinout for buttons and LEDs, and that the MBR needed for the USB bootloader occupies the first flash page. Normally you just have to do these modifications:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Update the Preprocessor Definitions by removing BOARD_PCA10056 and inserting BOARD_PCA10059.&lt;/li&gt;
&lt;li&gt;&lt;span&gt;&lt;em&gt;Only if you use an example project without SoftDevice:&lt;/em&gt; Adjust the linker configuration. Set&amp;nbsp;&lt;/span&gt;&lt;code&gt;FLASH_START=0x1000&lt;/code&gt;&lt;span&gt;&amp;nbsp;to place the application right above the MBR. You should also set and&amp;nbsp;&lt;/span&gt;&lt;code&gt;FLASH_SIZE=0xDF000&lt;/code&gt;&lt;span&gt;&amp;nbsp;to make sure that there is room for the bootloader at the end of the flash. Set&amp;nbsp;&lt;/span&gt;&lt;code&gt;RAM_START=0x20000008&lt;/code&gt;&lt;span&gt;, as the first 8 bytes are used by the MBR for interrupt forwarding and adjust the size accordingly by setting&amp;nbsp;&lt;/span&gt;&lt;code&gt;RAM_SIZE=0x3FFF8&lt;/code&gt;&lt;span&gt;.&lt;/span&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;3. Yes, you can hook up the Dongle to the nRF52 DK&amp;#39;s debug out port. See &lt;a href="http://infocenter.nordicsemi.com/topic/com.nordic.infocenter.nrf52/dita/nrf52/development/nrf52840_dongle/hw_swd_if.html?cp=2_0_4_5_6"&gt;SWD interface&lt;/a&gt;. Note that you need to set the UICR REGOUT0 register properly in your firmware so that the REG0 voltage (VDD) is 3 V. If you do not, the chip will be in a state where it cannot be programmed from a DK after a full erase / UICR erase, as the default REG0 voltage is 1.8 V and the DK expects 3 V SWD signals (in that case the workaround is to use a debugger with level shifter or adjust the Dongle HW as explained under &lt;a href="http://infocenter.nordicsemi.com/topic/com.nordic.infocenter.nrf52/dita/nrf52/development/nrf52840_dongle/hw_power_ext_reg_source.html?cp=2_0_4_5_2_1"&gt;External regulated source&lt;/a&gt;).&lt;/p&gt;
&lt;p&gt;(I am in the process of writing a tutorial for programming the nRF52840 Dongle as there are quite a few pitfalls, but it will probably take a few more days before it gets published).&lt;/p&gt;
&lt;p&gt;Update: &lt;a href="https://devzone.nordicsemi.com/tutorials/b/getting-started/posts/nrf52840-dongle-programming-tutorial"&gt;nRF52840 Dongle Programming Tutorial is here&lt;/a&gt;.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>