<?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>GPIO in secure bootloader example in sdk v15.2</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/46760/gpio-in-secure-bootloader-example-in-sdk-v15-2</link><description>Hi, 
 
 I am trying to toggle an LED in bootloader, adding nrf_gpio_cfg_output/write has no effect to the code. The code compiles without errors but doesnt seem to be executed. What config option am I missing? 
 Any pointers to this can be very helpful</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 02 May 2019 09:20:20 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/46760/gpio-in-secure-bootloader-example-in-sdk-v15-2" /><item><title>RE: GPIO in secure bootloader example in sdk v15.2</title><link>https://devzone.nordicsemi.com/thread/184813?ContentTypeID=1</link><pubDate>Thu, 02 May 2019 09:20:20 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0e3a2f04-6efa-471f-bde9-8cd99e3dc0ec</guid><dc:creator>chaitz</dc:creator><description>&lt;p&gt;Hi,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Thanks for the response. Its all working now, I just figured out that there was another GPIO to be configured before setting pin 11. I obviously missed this in the schematic!! Apologies for this ticket, please this question. And many thanks for your time.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: GPIO in secure bootloader example in sdk v15.2</title><link>https://devzone.nordicsemi.com/thread/184791?ContentTypeID=1</link><pubDate>Thu, 02 May 2019 08:36:13 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:476c6994-6622-4b2b-9f2d-ce5a11da3412</guid><dc:creator>haakonsh</dc:creator><description>&lt;p&gt;I need you to set a breakpoint&amp;nbsp;on line 144 and read the GPIO registers called&amp;nbsp;&lt;a href="https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.nrf52832.ps.v1.1/gpio.html?cp=3_1_0_19_2_20#register.PIN_CNF-11"&gt;PIN_CNF[11]&lt;/a&gt;&amp;nbsp;and&amp;nbsp;&lt;a title="  OUTSET  " href="https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.nrf52832.ps.v1.1/gpio.html?cp=3_1_0_19_2_1#register.OUTSET"&gt;OUTSET&lt;/a&gt;. If they are set correctly then the GPIO is working.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: GPIO in secure bootloader example in sdk v15.2</title><link>https://devzone.nordicsemi.com/thread/184569?ContentTypeID=1</link><pubDate>Tue, 30 Apr 2019 12:22:33 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:bd7eb7a4-e4b6-4edf-b898-8b2c28f712a9</guid><dc:creator>chaitz</dc:creator><description>&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;/**
 * Copyright (c) 2016 - 2018, Nordic Semiconductor ASA
 *
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without modification,
 * are permitted provided that the following conditions are met:
 *
 * 1. Redistributions of source code must retain the above copyright notice, this
 *    list of conditions and the following disclaimer.
 *
 * 2. Redistributions in binary form, except as embedded into a Nordic
 *    Semiconductor ASA integrated circuit in a product or a software update for
 *    such product, must reproduce the above copyright notice, this list of
 *    conditions and the following disclaimer in the documentation and/or other
 *    materials provided with the distribution.
 *
 * 3. Neither the name of Nordic Semiconductor ASA nor the names of its
 *    contributors may be used to endorse or promote products derived from this
 *    software without specific prior written permission.
 *
 * 4. This software, with or without modification, must only be used with a
 *    Nordic Semiconductor ASA integrated circuit.
 *
 * 5. Any software provided in binary form under this license must not be reverse
 *    engineered, decompiled, modified and/or disassembled.
 *
 * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA &amp;quot;AS IS&amp;quot; AND ANY EXPRESS
 * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
 * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
 * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
 * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 *
 */
/** @file
 *
 * @defgroup bootloader_secure_ble main.c
 * @{
 * @ingroup dfu_bootloader_api
 * @brief Bootloader project main file for secure DFU.
 *
 */

#include &amp;lt;stdint.h&amp;gt;
#include &amp;quot;boards.h&amp;quot;
#include &amp;quot;nrf_mbr.h&amp;quot;
#include &amp;quot;nrf_bootloader.h&amp;quot;
#include &amp;quot;nrf_bootloader_app_start.h&amp;quot;
#include &amp;quot;nrf_bootloader_dfu_timers.h&amp;quot;
#include &amp;quot;nrf_dfu.h&amp;quot;
#include &amp;quot;nrf_log.h&amp;quot;
#include &amp;quot;nrf_log_ctrl.h&amp;quot;
#include &amp;quot;nrf_log_default_backends.h&amp;quot;
#include &amp;quot;app_error.h&amp;quot;
#include &amp;quot;app_error_weak.h&amp;quot;
#include &amp;quot;nrf_bootloader_info.h&amp;quot;
#include &amp;quot;nrf_delay.h&amp;quot;

static void on_error(void)
{
    NRF_LOG_FINAL_FLUSH();

#if NRF_MODULE_ENABLED(NRF_LOG_BACKEND_RTT)
    // To allow the buffer to be flushed by the host.
    nrf_delay_ms(100);
#endif
#ifdef NRF_DFU_DEBUG_VERSION
    NRF_BREAKPOINT_COND;
#endif
    NVIC_SystemReset();
}


void app_error_handler(uint32_t error_code, uint32_t line_num, const uint8_t * p_file_name)
{
    NRF_LOG_ERROR(&amp;quot;%s:%d&amp;quot;, p_file_name, line_num);
    on_error();
}


void app_error_fault_handler(uint32_t id, uint32_t pc, uint32_t info)
{
    NRF_LOG_ERROR(&amp;quot;Received a fault! id: 0x%08x, pc: 0x%08x, info: 0x%08x&amp;quot;, id, pc, info);
    on_error();
}


void app_error_handler_bare(uint32_t error_code)
{
    NRF_LOG_ERROR(&amp;quot;Received an error: 0x%08x!&amp;quot;, error_code);
    on_error();
}

/**
 * @brief Function notifies certain events in DFU process.
 */
static void dfu_observer(nrf_dfu_evt_type_t evt_type)
{
    switch (evt_type)
    {
        case NRF_DFU_EVT_DFU_FAILED:
        case NRF_DFU_EVT_DFU_ABORTED:
        case NRF_DFU_EVT_DFU_INITIALIZED:
            bsp_board_init(BSP_INIT_LEDS);
            bsp_board_led_on(BSP_BOARD_LED_0);
            bsp_board_led_on(BSP_BOARD_LED_1);
            bsp_board_led_off(BSP_BOARD_LED_2);
            break;
        case NRF_DFU_EVT_TRANSPORT_ACTIVATED:
            bsp_board_led_off(BSP_BOARD_LED_1);
            bsp_board_led_on(BSP_BOARD_LED_2);
            break;
        case NRF_DFU_EVT_DFU_STARTED:
            break;
        default:
            break;
    }
}


/**@brief Function for application main entry. */
int main(void)
{
    uint32_t ret_val;

    // Protect MBR and bootloader code from being overwritten.
    ret_val = nrf_bootloader_flash_protect(0, MBR_SIZE, false);
    APP_ERROR_CHECK(ret_val);
    ret_val = nrf_bootloader_flash_protect(BOOTLOADER_START_ADDR, BOOTLOADER_SIZE, false);
    APP_ERROR_CHECK(ret_val);

    (void) NRF_LOG_INIT(nrf_bootloader_dfu_timer_counter_get);
    NRF_LOG_DEFAULT_BACKENDS_INIT();

    NRF_LOG_INFO(&amp;quot;Inside main&amp;quot;);

    nrf_gpio_cfg_output (11);
    nrf_gpio_pin_set (11);
    ret_val = nrf_bootloader_init(dfu_observer);
    APP_ERROR_CHECK(ret_val);


    // Either there was no DFU functionality enabled in this project or the DFU module detected
    // no ongoing DFU operation and found a valid main application.
    // Boot the main application.
    nrf_bootloader_app_start();

    // Should never be reached.
    NRF_LOG_INFO(&amp;quot;After main&amp;quot;);
}

/**
 * @}
 */
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Just adding 2 lines to existing secure bootloader example file, to config pin 11 as output and set it, doesn&amp;#39;t work (line 142, 143).&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: GPIO in secure bootloader example in sdk v15.2</title><link>https://devzone.nordicsemi.com/thread/184469?ContentTypeID=1</link><pubDate>Tue, 30 Apr 2019 08:18:44 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fbe8f47d-125b-4feb-a48d-f2fa9bde08bc</guid><dc:creator>haakonsh</dc:creator><description>&lt;p&gt;Hmm that&amp;#39;s wierd.&lt;br /&gt;&lt;br /&gt;Do you mind sharing your bootloader code?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: GPIO in secure bootloader example in sdk v15.2</title><link>https://devzone.nordicsemi.com/thread/184458?ContentTypeID=1</link><pubDate>Tue, 30 Apr 2019 07:58:49 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7c91a747-eb57-4c7a-bf9e-938cdc7536d9</guid><dc:creator>chaitz</dc:creator><description>&lt;p&gt;Yes, I have tried that already. The boot loader is executing and breakpoints can be added to other statements too.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: GPIO in secure bootloader example in sdk v15.2</title><link>https://devzone.nordicsemi.com/thread/184453?ContentTypeID=1</link><pubDate>Tue, 30 Apr 2019 07:43:42 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:adfe2137-774e-4af3-9ed2-411b0e3aa21d</guid><dc:creator>haakonsh</dc:creator><description>&lt;p&gt;Are you even executing the bootloader? I&amp;#39;d start by adding a breakpoint to the bootloader to verify that you&amp;#39;re actually executing it.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>