<?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>Any relation between SPIM, PPI, TIMER and DFU bootloader?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/16086/any-relation-between-spim-ppi-timer-and-dfu-bootloader</link><description>Hi All, 
 Another question for those out there much smarter than myself... 
 We&amp;#39;re developing an application using nrf52, sdk11 and softdevice s132 2.0.0 and have been using DFU single bank to successfully update the application OTA. 
 Recently, we</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 01 Sep 2016 10:48:43 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/16086/any-relation-between-spim-ppi-timer-and-dfu-bootloader" /><item><title>RE: Any relation between SPIM, PPI, TIMER and DFU bootloader?</title><link>https://devzone.nordicsemi.com/thread/61344?ContentTypeID=1</link><pubDate>Thu, 01 Sep 2016 10:48:43 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:55bcb051-8fe1-41ae-9ba8-40cb57e801d8</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;If you don&amp;#39;t plan to keep the SPI task when you are in bootloader mode. I don&amp;#39;t see the point of keeping the ppi channel when you branch to the bootloader.&lt;/p&gt;
&lt;p&gt;I still keep my concern that if you keep the peripheral running when you branch to the bootloader, especially when you forward the vector table to the bootloader&amp;#39;s one you will have trouble when the interrupt comes.&lt;/p&gt;
&lt;p&gt;It&amp;#39;s recommended to stop all the peripherals you use in the application before you branch to the bootloader.&lt;/p&gt;
&lt;p&gt;If you want to dig deeper, I would suggest to run the bootloader project in debug mode and wait for the application to branch to the bootloader and debug from there (you would need to remove optimization in the bootloader to debug)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Any relation between SPIM, PPI, TIMER and DFU bootloader?</title><link>https://devzone.nordicsemi.com/thread/61343?ContentTypeID=1</link><pubDate>Wed, 31 Aug 2016 17:38:24 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ad6f0455-7e7c-4393-a478-ab9350da0166</guid><dc:creator>bvuong87</dc:creator><description>&lt;p&gt;@hungbui: Apologies, my description may have been a little unclear.&lt;/p&gt;
&lt;p&gt;I&amp;#39;m not trying to continue running the SPI task while in bootloader mode. The SPI task is setup to run in the main application, connected to the timer event using:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;    err_code = nrf_drv_ppi_channel_alloc(&amp;amp;m_ppi_channel);
   APP_ERROR_CHECK(err_code);

   err_code = nrf_drv_ppi_channel_assign(m_ppi_channel, timer_compare_event_addr, spi_transfer_event_addr);
   APP_ERROR_CHECK(err_code);

   err_code = nrf_drv_ppi_channel_enable(m_ppi_channel);
   APP_ERROR_CHECK(err_code);
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Inside of the main application, the SPI task works as expected. However, the problem I&amp;#39;m seeing is when entering DFU bootloader mode through the NRF Connect phone app, the log shows the application restarts and entering into bootloader mode, however NRF connect is  unable to reconnect to the device to continue the DFU process and send the new application OTA unless I disable the ppi channel in the function which starts the bootloader from the main application.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;#include &amp;quot;nrf_drv_ppi.h&amp;quot;

void bootloader_util_app_start(uint32_t start_addr)
{
    nrf_drv_ppi_channel_free(m_ppi_channel);  // m_ppi_channel is the &amp;quot;short&amp;quot; between timer event and SPIM task
    bootloader_util_reset(start_addr);
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;I&amp;#39;m assuming it&amp;#39;s some sort of hard fault, or app_error_check() (although haven&amp;#39;t completely verified) after it enters the bootloader since when this occurs, the nrf52 doesn&amp;#39;t advertise (as either DfuTarg, or the application name) and requires a power cycle. Note - that the DFU OTA application update also worked with the identical bootloader, before adding the PPI implementation&lt;/p&gt;
&lt;p&gt;Is this to be expected? I wouldn&amp;#39;t think so since I have some another PPI channel allocated and enabled between the same timer event and a GPIOTE task which controls a CS pin which doesn&amp;#39;t need to be disabled&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Any relation between SPIM, PPI, TIMER and DFU bootloader?</title><link>https://devzone.nordicsemi.com/thread/61342?ContentTypeID=1</link><pubDate>Wed, 31 Aug 2016 12:53:02 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:18ff4993-64a8-4feb-8229-219b57f39d02</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;@bvuong87: please correct me if I&amp;#39;m wrong. You want to continue doing the SPI task when you are in bootloader mode by using PPI and let the timer and SPI running without CPU involvement ? But you have hardfault/assert when you enter bootloader ?&lt;/p&gt;
&lt;p&gt;If you call nrf_drv_ppi_channel_free() you don&amp;#39;t have any issue continue with the bootloader ?&lt;/p&gt;
&lt;p&gt;You would need to make sure all the interrupt handler is implemented or you disable the interrupt flag the peripherals you use but don&amp;#39;t handle them in the bootloader code.&lt;/p&gt;
&lt;p&gt;The nrf_driver actually enable interrupt flag for the timer and the SPI. I would suggest to use the TIMER and SPI directly so you know for sure what you enable.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>