<?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>IoT DFU + Coap -&amp;gt; TFTP Error</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/11055/iot-dfu-coap---tftp-error</link><description>[Dev Env] 
 
 
 nRF52 DK ( Tech Tour) (PCA10040) 
 
 
 IoT SoftDevice (s1xx-iot-prototype3_nrf52_softdevice.hex) 
 
 
 IoT SDK 0.9 
 
 
 coap server example Base + dfu(tftp) example 
 
 
 [Question]
my project coap server + iot dfu + pStorage</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 06 Jan 2016 10:39:59 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/11055/iot-dfu-coap---tftp-error" /><item><title>RE: IoT DFU + Coap -&gt; TFTP Error</title><link>https://devzone.nordicsemi.com/thread/41325?ContentTypeID=1</link><pubDate>Wed, 06 Jan 2016 10:39:59 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2ca117d9-24e0-4e09-8e83-71ac9182764b</guid><dc:creator>cucu</dc:creator><description>&lt;p&gt;thanks a lot.
i have solve this problem.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: IoT DFU + Coap -&gt; TFTP Error</title><link>https://devzone.nordicsemi.com/thread/41324?ContentTypeID=1</link><pubDate>Wed, 06 Jan 2016 10:21:04 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:88008950-e270-4299-92da-0aec30cf06d1</guid><dc:creator>Stian R&amp;#248;ed Hafskjold</dc:creator><description>&lt;p&gt;We found a solution for this while working with the same case in the support portal. I will include a short wrap up here, in case someone else are trying to do the same thing.&lt;/p&gt;
&lt;p&gt;The TFTP application uses pstorage &lt;em&gt;raw&lt;/em&gt; mode while handling the DFU firmware file. If you integrate another application which uses regular pstorage, the settings in the &lt;strong&gt;pstorage_platform.h&lt;/strong&gt; file will conflict with the raw mode.&lt;/p&gt;
&lt;p&gt;The DFU firmware file and the settings file is created in &lt;code&gt;iot_dfu_file_create()&lt;/code&gt; and &lt;code&gt;iot_dfu_init()&lt;/code&gt; respectively (in the &lt;strong&gt;iot_dfu.c&lt;/strong&gt; file). Here you find the macro &lt;code&gt;IOT_FILE_PSTORAGE_RAW_INIT()&lt;/code&gt; which creates the new files.&lt;/p&gt;
&lt;p&gt;The bootloader settings file is stored in &lt;code&gt;BOOTLOADER_SETTINGS_ADDRESS&lt;/code&gt; (0x0007F000) and have the size of &lt;code&gt;CODE_PAGE_SIZE&lt;/code&gt; (0x1000)&lt;/p&gt;
&lt;p&gt;The new firmware file is stored in &lt;code&gt;IOT_DFU_DEFAULT_START_ADDRESS&lt;/code&gt; and have the size of &lt;code&gt;BOOTLOADER_REGION_START - IOT_DFU_DEFAULT_START_ADDRESS&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;When you change the &lt;code&gt;PSTORAGE_DATA_START_ADDR&lt;/code&gt; and &lt;code&gt;PSTORAGE_DATA_END_ADDR&lt;/code&gt; (in &lt;strong&gt;pstorage_platform.h&lt;/strong&gt;), which you will normally do when using the regular pstorage to store application data. These settings will conflict with the pstorage raw module used by the TFTP DFU application.&lt;/p&gt;
&lt;p&gt;When using normal pstorage, &lt;code&gt;PSTORAGE_DATA_END_ADDR&lt;/code&gt; should be set to below the bootloader (0x0007D000) in order for your application data to not overwrite the bootloader. The problem is that this same variable is checked to be above the bootloader settings file which is stored &lt;em&gt;in&lt;/em&gt; the bootloader (at 0x0007F000), this is to check that the settings file doesn&amp;#39;t overflow the bootloader. So the check will fail.&lt;/p&gt;
&lt;p&gt;More specific, it is this check in the &lt;code&gt;internal_fopen()&lt;/code&gt; function in &lt;strong&gt;iot_file_pstorage_raw.c&lt;/strong&gt; that will fail:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;if((p_file-&amp;gt;buffer_size % PSTORAGE_FLASH_PAGE_SIZE != 0) ||
    (start_address + p_file-&amp;gt;buffer_size &amp;gt; PSTORAGE_DATA_END_ADDR))
{
    FILE_ERR(&amp;quot;[FILE][PSRaw]: Invalid buffer size. Buffer size: %lu, Page size: %d, Total size: %lu.\r\n&amp;quot;,
             p_file-&amp;gt;buffer_size, PSTORAGE_FLASH_PAGE_SIZE, PSTORAGE_DATA_END_ADDR);
    FPSRAW_MUTEX_UNLOCK();
    FILE_TRC(&amp;quot;[FILE][PSRaw] &amp;lt;&amp;lt; fopen.\r\n&amp;quot;);
    return (NRF_ERROR_INVALID_PARAM | IOT_FILE_ERR_BASE);
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;A solution to this is to create a new &lt;code&gt;PSTORAGE_DATA_END_ADDR&lt;/code&gt; variable which is used only by the pstorage raw mode, and set this to 0x00080000, which is where it expects the settings file to end.&lt;/p&gt;
&lt;p&gt;Do you have any feedback on this @ludu?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: IoT DFU + Coap -&gt; TFTP Error</title><link>https://devzone.nordicsemi.com/thread/41322?ContentTypeID=1</link><pubDate>Tue, 05 Jan 2016 11:27:19 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a5bbd23e-19fa-4e7f-8cfc-d0b546133908</guid><dc:creator>Lukasz Duda</dc:creator><description>&lt;p&gt;Hello, can you enable logs from TFTP client and paste some last debug messages before error event is received.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: IoT DFU + Coap -&gt; TFTP Error</title><link>https://devzone.nordicsemi.com/thread/41323?ContentTypeID=1</link><pubDate>Mon, 28 Dec 2015 12:31:14 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fa6051d9-3c5a-4a54-98d0-80c831c1b68e</guid><dc:creator>cucu</dc:creator><description>&lt;p&gt;i guess this is pstorage_platform.h issue
my project use pstorage.
can i use pstorage and  iot dfu mode together??&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>