<?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>How to create a Makefile based project?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/66196/how-to-create-a-makefile-based-project</link><description>Hi, 
 I am new to creating project from scratch. 
 I want to use nRF51802 module. From few support tickets i have come to know that SDK version 12.3 and SoftDevice S130 version 2.0.x are the compatible versions for nRF51802 module. Are these the latest</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 24 Nov 2020 11:22:43 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/66196/how-to-create-a-makefile-based-project" /><item><title>RE: How to create a Makefile based project?</title><link>https://devzone.nordicsemi.com/thread/281516?ContentTypeID=1</link><pubDate>Tue, 24 Nov 2020 11:22:43 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2a5712a4-4625-4d1c-8c9a-bb6ccce9c146</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;Then it looks like your application requires too much RAM.&lt;/p&gt;
&lt;p&gt;Please see my colleague Petter&amp;#39;s answer in &lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/7212/region-ram-overflowed-with-stack"&gt;this ticket&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;BR,&lt;/p&gt;
&lt;p&gt;Edvin&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to create a Makefile based project?</title><link>https://devzone.nordicsemi.com/thread/281508?ContentTypeID=1</link><pubDate>Tue, 24 Nov 2020 11:02:07 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:10fba708-9484-469f-b7ee-f507f599d68a</guid><dc:creator>swetha Paladugu</dc:creator><description>&lt;p&gt;It was a compilation error..&lt;/p&gt;
&lt;p&gt;Initially i didnt get that error..&amp;nbsp; After adding few features in my code, the error started coming.&lt;/p&gt;
&lt;p&gt;I saw in some nordic forum about changing the heap size in startup file to 0. After making that change, the error is gone. But after adding some more application code the error is coming again.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to create a Makefile based project?</title><link>https://devzone.nordicsemi.com/thread/281464?ContentTypeID=1</link><pubDate>Tue, 24 Nov 2020 08:57:07 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:419baa2f-e79c-48f3-9cc5-350f36be1689</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;What did you change that triggered this error?&lt;/p&gt;
&lt;p&gt;Is it a compiler error?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to create a Makefile based project?</title><link>https://devzone.nordicsemi.com/thread/281428?ContentTypeID=1</link><pubDate>Tue, 24 Nov 2020 05:45:33 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4af85fe4-a336-447d-be3e-dec239493837</guid><dc:creator>swetha Paladugu</dc:creator><description>&lt;p&gt;Hi Edvan,&lt;/p&gt;
&lt;p&gt;These are my linkerscript memory settings:&lt;/p&gt;
&lt;p&gt;MEMORY&lt;br /&gt;{&lt;br /&gt; FLASH (rx) : ORIGIN = 0X01B000, LENGTH = 0x25000&lt;br /&gt; RAM (rwx) : ORIGIN = 0x20001fe8, LENGTH = 0x2018&lt;br /&gt;}&lt;/p&gt;
&lt;p&gt;I am getting this error when i add my application files.&lt;/p&gt;
&lt;p&gt;c:/program files (x86)/gnu tools arm embedded/7 2018-q2-update/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/bin/ld.exe: region RAM overflowed with stack.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I have already changed heap size from 2048 to 0 in startup file in nrfsdk/components/toolchain/gcc/gcc_startup_nrf51.S file.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Can you please suggest me what to do?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Thanks,&lt;/p&gt;
&lt;p&gt;Swetha.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to create a Makefile based project?</title><link>https://devzone.nordicsemi.com/thread/277071?ContentTypeID=1</link><pubDate>Tue, 27 Oct 2020 09:34:01 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b3f678d8-5d20-4aab-ac3b-83c1819acbd1</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;Ok. If you insist, then you can start looking into the bootloader example from the SDK. Everything you need is there, and you can follow &lt;a href="https://devzone.nordicsemi.com/nordic/short-range-guides/b/software-development-kit/posts/getting-started-with-nordics-secure-dfu-bootloader"&gt;this guide&lt;/a&gt;.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Make sure that you have a working app first, so that you know where to start looking if the device doesn&amp;#39;t behave like you expect.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;NB:&lt;/p&gt;
&lt;p&gt;When you have a bootloader, it will check the CRC of the application. This means that when the bootloader is programmed, you need to also program bootloader settings if you want to run your app. The alternative is to always update to your app using DFU directly. Whenever you do a tiny change in the application, you must re-generate the bootloader settings and flash them with the application.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Please note that most IDEs will not use the .hex file when debugging, but the .map or .elf file. Because of this, you need to attach the debugger without writing to the flash. I don&amp;#39;t know whether Eclipse supports this. Logging is a useful tool, because you can monitor the log without entering a debug session from your IDE.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Edvin&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to create a Makefile based project?</title><link>https://devzone.nordicsemi.com/thread/277017?ContentTypeID=1</link><pubDate>Tue, 27 Oct 2020 05:55:38 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:17c3fac8-bf2c-43be-bd6a-8870eea83d8a</guid><dc:creator>swetha Paladugu</dc:creator><description>&lt;p&gt;Edvan,&lt;/p&gt;
&lt;p&gt;I already have a working ble app uart working with my IDE setup. Device advertising, able to send and receive data from app, all that working.&lt;/p&gt;
&lt;p&gt;&lt;span&gt;I would need help in creating bootloader dfu project and the necessary changes to be done in application for nrf51802 module.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Please guide me in doing it.&lt;/p&gt;
&lt;p&gt;I have been asking from quite few days about this..&lt;/p&gt;
&lt;p&gt;Please do the necessary..&lt;/p&gt;
&lt;p&gt;Thanks,&lt;/p&gt;
&lt;p&gt;Swetha.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to create a Makefile based project?</title><link>https://devzone.nordicsemi.com/thread/275372?ContentTypeID=1</link><pubDate>Fri, 16 Oct 2020 13:05:17 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:acd16fc5-2508-42d7-88ae-99777ac26b85</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;That sounds like a topic for a new ticket. But I think you should wait with your bootloader until you have an IDE that you know for certain is working properly. If not, I don&amp;#39;t know if your issues are caused because of your IDE or your bootloader.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to create a Makefile based project?</title><link>https://devzone.nordicsemi.com/thread/275310?ContentTypeID=1</link><pubDate>Fri, 16 Oct 2020 10:24:53 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:752da7d6-8c18-41ff-b671-55cc37cffc9e</guid><dc:creator>swetha Paladugu</dc:creator><description>&lt;p&gt;Edvan,&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I would need help in creating bootloader dfu project and the necessary changes to be done in application for nrf51802 module.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to create a Makefile based project?</title><link>https://devzone.nordicsemi.com/thread/274969?ContentTypeID=1</link><pubDate>Thu, 15 Oct 2020 04:38:29 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a4abf5e2-85ab-450f-aa8c-539861acc3ea</guid><dc:creator>swetha Paladugu</dc:creator><description>&lt;p&gt;Hi Edvan,&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;As suggested i have created another ticket, please help me with the issue i&amp;#39;m facing.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/67224/data-is-not-getting-received-in-nus_data_handler"&gt;https://devzone.nordicsemi.com/f/nordic-q-a/67224/data-is-not-getting-received-in-nus_data_handler&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Thanks,&lt;/p&gt;
&lt;p&gt;Swetha.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to create a Makefile based project?</title><link>https://devzone.nordicsemi.com/thread/274933?ContentTypeID=1</link><pubDate>Wed, 14 Oct 2020 14:44:40 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:216d15de-fa30-45c8-8cc6-88d474ed772f</guid><dc:creator>swetha Paladugu</dc:creator><description>&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/1300.Keybox.zip"&gt;devzone.nordicsemi.com/.../1300.Keybox.zip&lt;/a&gt;I&amp;#39;m attaching the project that was created.. Can you please run the project and see the issue?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to create a Makefile based project?</title><link>https://devzone.nordicsemi.com/thread/274929?ContentTypeID=1</link><pubDate>Wed, 14 Oct 2020 14:21:40 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f4740c4b-5749-49b2-b055-51818f9340b0</guid><dc:creator>swetha Paladugu</dc:creator><description>&lt;p&gt;how to share this makefile based eclipse project to u.. all the changes i made are in the makefile, linkerscript, sdk_config.h, and ble_nus.c files&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to create a Makefile based project?</title><link>https://devzone.nordicsemi.com/thread/274922?ContentTypeID=1</link><pubDate>Wed, 14 Oct 2020 14:01:07 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3e303b4a-bdec-4fbe-b43f-4bae09a98821</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;I don&amp;#39;t see anything wrong, but it is hard to check code just by reading it. I need to run it in order to find issues.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to create a Makefile based project?</title><link>https://devzone.nordicsemi.com/thread/274902?ContentTypeID=1</link><pubDate>Wed, 14 Oct 2020 12:58:14 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e3e22fb9-e953-485b-8c1c-ff2f5a0affdb</guid><dc:creator>swetha Paladugu</dc:creator><description>&lt;p&gt;I think i have implemented correctly. Did you see the codes i have shared?&lt;/p&gt;
&lt;p&gt;Do you find any issue in those codes?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to create a Makefile based project?</title><link>https://devzone.nordicsemi.com/thread/274899?ContentTypeID=1</link><pubDate>Wed, 14 Oct 2020 12:52:47 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:92115d11-7ea3-4356-bfb7-6655bc6a8556</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;That is correct. But it depends on how you implemented the nordic uart service. Look at how it is handled in the ble_app_uart example.&lt;/p&gt;
&lt;p&gt;BR,&lt;/p&gt;
&lt;p&gt;Edvin&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to create a Makefile based project?</title><link>https://devzone.nordicsemi.com/thread/274895?ContentTypeID=1</link><pubDate>Wed, 14 Oct 2020 12:46:56 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d6e120b0-3e89-4153-af70-d3fc6d92f40b</guid><dc:creator>swetha Paladugu</dc:creator><description>&lt;p&gt;I will create a different ticket. But before that please see the codes that i have attached..&lt;/p&gt;
&lt;p&gt;Using the ble_app-uart example i have called the api calls to advertise the device.&lt;/p&gt;
&lt;p&gt;This example default has a nus service initialized.. So i also used the same.&lt;/p&gt;
&lt;p&gt;so there is an event handler attached to nus service which is&amp;nbsp;&lt;span&gt;nus_data_handler, so what i am asking is when data comes from nrf connect android app it should come to this handler. But it is not coming.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Is it correct ?&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to create a Makefile based project?</title><link>https://devzone.nordicsemi.com/thread/274884?ContentTypeID=1</link><pubDate>Wed, 14 Oct 2020 12:28:06 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0063643c-010f-4903-b746-5e5f1f9a91b8</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;So this means that you were able to set up your project in eclipse, then?&lt;/p&gt;
&lt;p&gt;If you have application specific questions, I think it is better that you start a new thread. This has nothing to do with the makefile based project, as the title of this issue suggests.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;To answer short:&lt;/p&gt;
&lt;p&gt;I don&amp;#39;t know how you set up your service and characteristic, or what you do on your central when you receive the&amp;nbsp;&lt;span&gt;BLE_GATTS_EVT_RW_AUTHORIZE_REQUEST&amp;nbsp;event. That is not clear. It looks like you are trying to read a characteristic on the nRF from the central (a phone?). Write a detailed description in the new ticket how you set up the service and characteristics, and what you did to trigger the&amp;nbsp;BLE_GATTS_EVT_RW_AUTHORIZE_REQUEST event.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to create a Makefile based project?</title><link>https://devzone.nordicsemi.com/thread/274867?ContentTypeID=1</link><pubDate>Wed, 14 Oct 2020 11:29:08 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:55f1ad7b-e0d8-4bbc-8109-1c851cb8888d</guid><dc:creator>swetha Paladugu</dc:creator><description>&lt;p&gt;Edvan,&lt;/p&gt;
&lt;p&gt;I think i&amp;#39;m not clear with my question.. Leave the earlier discussion.&lt;/p&gt;
&lt;p&gt;Currently i have kept my device in advertising mode and enabled tx rx characteristics on nus service.&lt;/p&gt;
&lt;p&gt;And established ble connection with nrf connect android application.&lt;/p&gt;
&lt;p&gt;Now when i try to send data from nrf connect application, i should get the data in&amp;nbsp;&lt;span&gt;nus_data_handler. But i am not getting in that handler. I kept a break point&amp;nbsp;in that handler but it never comes there. But it comes to a switch case&amp;nbsp;BLE_GATTS_EVT_RW_AUTHORIZE_REQUEST in on_ble_evt(). I hope you understood my question. Please see the code and help me where i&amp;#39;m doing wrong. I need to get data in&amp;nbsp;nus_data_handler().&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;I am sharing code of my main.c file and ble_nus.c file&lt;pre class="ui-code" data-mode="text"&gt;/**
 * Copyright (c) 2012 - 2017, 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.
 * 
 */
#include &amp;quot;sdk_common.h&amp;quot;
#if NRF_MODULE_ENABLED(BLE_NUS)
#include &amp;quot;ble_nus.h&amp;quot;
#include &amp;quot;ble_srv_common.h&amp;quot;

#define BLE_UUID_NUS_TX_CHARACTERISTIC 0x0002                      /**&amp;lt; The UUID of the TX Characteristic. */
#define BLE_UUID_NUS_RX_CHARACTERISTIC 0x0003                      /**&amp;lt; The UUID of the RX Characteristic. */

#define BLE_NUS_MAX_RX_CHAR_LEN        BLE_NUS_MAX_DATA_LEN        /**&amp;lt; Maximum length of the RX Characteristic (in bytes). */
#define BLE_NUS_MAX_TX_CHAR_LEN        BLE_NUS_MAX_DATA_LEN        /**&amp;lt; Maximum length of the TX Characteristic (in bytes). */

#define NUS_BASE_UUID                  {{0x9E, 0xCA, 0xDC, 0x24, 0x0E, 0xE5, 0xA9, 0xE0, 0x93, 0xF3, 0xA3, 0xB5, 0x00, 0x00, 0x40, 0x6E}} /**&amp;lt; Used vendor specific UUID. */

/**@brief Function for handling the @ref BLE_GAP_EVT_CONNECTED event from the S110 SoftDevice.
 *
 * @param[in] p_nus     Nordic UART Service structure.
 * @param[in] p_ble_evt Pointer to the event received from BLE stack.
 */
static void on_connect(ble_nus_t * p_nus, ble_evt_t * p_ble_evt)
{
    p_nus-&amp;gt;conn_handle = p_ble_evt-&amp;gt;evt.gap_evt.conn_handle;
}


/**@brief Function for handling the @ref BLE_GAP_EVT_DISCONNECTED event from the S110 SoftDevice.
 *
 * @param[in] p_nus     Nordic UART Service structure.
 * @param[in] p_ble_evt Pointer to the event received from BLE stack.
 */
static void on_disconnect(ble_nus_t * p_nus, ble_evt_t * p_ble_evt)
{
    UNUSED_PARAMETER(p_ble_evt);
    p_nus-&amp;gt;conn_handle = BLE_CONN_HANDLE_INVALID;
}


/**@brief Function for handling the @ref BLE_GATTS_EVT_WRITE event from the S110 SoftDevice.
 *
 * @param[in] p_nus     Nordic UART Service structure.
 * @param[in] p_ble_evt Pointer to the event received from BLE stack.
 */
static void on_write(ble_nus_t * p_nus, ble_evt_t * p_ble_evt)
{
    ble_gatts_evt_write_t * p_evt_write = &amp;amp;p_ble_evt-&amp;gt;evt.gatts_evt.params.write;

    if (
        (p_evt_write-&amp;gt;handle == p_nus-&amp;gt;rx_handles.cccd_handle)
        &amp;amp;&amp;amp;
        (p_evt_write-&amp;gt;len == 2)
       )
    {
        if (ble_srv_is_notification_enabled(p_evt_write-&amp;gt;data))
        {
            p_nus-&amp;gt;is_notification_enabled = true;
        }
        else
        {
            p_nus-&amp;gt;is_notification_enabled = false;
        }
    }
    else if (
             (p_evt_write-&amp;gt;handle == p_nus-&amp;gt;tx_handles.value_handle)
             &amp;amp;&amp;amp;
             (p_nus-&amp;gt;data_handler != NULL)
            )
    {
        p_nus-&amp;gt;data_handler(p_nus, p_evt_write-&amp;gt;data, p_evt_write-&amp;gt;len);
    }
    else
    {
        // Do Nothing. This event is not relevant for this service.
    }
}


/**@brief Function for adding RX characteristic.
 *
 * @param[in] p_nus       Nordic UART Service structure.
 * @param[in] p_nus_init  Information needed to initialize the service.
 *
 * @return NRF_SUCCESS on success, otherwise an error code.
 */
static uint32_t rx_char_add(ble_nus_t * p_nus, const ble_nus_init_t * p_nus_init)
{
    /**@snippet [Adding proprietary characteristic to S110 SoftDevice] */
    ble_gatts_char_md_t char_md;
    ble_gatts_attr_md_t cccd_md;
    ble_gatts_attr_t    attr_char_value;
    ble_uuid_t          ble_uuid;
    ble_gatts_attr_md_t attr_md;

    memset(&amp;amp;cccd_md, 0, sizeof(cccd_md));

    BLE_GAP_CONN_SEC_MODE_SET_OPEN(&amp;amp;cccd_md.read_perm);
    BLE_GAP_CONN_SEC_MODE_SET_OPEN(&amp;amp;cccd_md.write_perm);

    cccd_md.vloc = BLE_GATTS_VLOC_STACK;

    memset(&amp;amp;char_md, 0, sizeof(char_md));

    char_md.char_props.notify = 1;
//    char_md.char_props.write  = 1;
//    char_md.char_props.read  = 1;
    char_md.p_char_user_desc  = NULL;
    char_md.p_char_pf         = NULL;
    char_md.p_user_desc_md    = NULL;
    char_md.p_cccd_md         = &amp;amp;cccd_md;
    char_md.p_sccd_md         = NULL;

    ble_uuid.type = p_nus-&amp;gt;uuid_type;
    ble_uuid.uuid = BLE_UUID_NUS_RX_CHARACTERISTIC;

    memset(&amp;amp;attr_md, 0, sizeof(attr_md));

    BLE_GAP_CONN_SEC_MODE_SET_OPEN(&amp;amp;attr_md.read_perm);
    BLE_GAP_CONN_SEC_MODE_SET_OPEN(&amp;amp;attr_md.write_perm);

    attr_md.vloc    = BLE_GATTS_VLOC_STACK;
    attr_md.rd_auth = 1;
    attr_md.wr_auth = 1;
    attr_md.vlen    = 1;

    memset(&amp;amp;attr_char_value, 0, sizeof(attr_char_value));

    attr_char_value.p_uuid    = &amp;amp;ble_uuid;
    attr_char_value.p_attr_md = &amp;amp;attr_md;
    attr_char_value.init_len  = sizeof(uint8_t);
    attr_char_value.init_offs = 0;
    attr_char_value.max_len   = BLE_NUS_MAX_RX_CHAR_LEN;

    return sd_ble_gatts_characteristic_add(p_nus-&amp;gt;service_handle,
                                           &amp;amp;char_md,
                                           &amp;amp;attr_char_value,
                                           &amp;amp;p_nus-&amp;gt;rx_handles);
    /**@snippet [Adding proprietary characteristic to S110 SoftDevice] */
}


/**@brief Function for adding TX characteristic.
 *
 * @param[in] p_nus       Nordic UART Service structure.
 * @param[in] p_nus_init  Information needed to initialize the service.
 *
 * @return NRF_SUCCESS on success, otherwise an error code.
 */
static uint32_t tx_char_add(ble_nus_t * p_nus, const ble_nus_init_t * p_nus_init)
{
    ble_gatts_char_md_t char_md;
    ble_gatts_attr_t    attr_char_value;
    ble_uuid_t          ble_uuid;
    ble_gatts_attr_md_t attr_md;

    memset(&amp;amp;char_md, 0, sizeof(char_md));

//    char_md.char_props.notify = 1;
    char_md.char_props.write         = 1;
//    char_md.char_props.read  = 1;
    char_md.char_props.write_wo_resp = 1;
    char_md.p_char_user_desc         = NULL;
    char_md.p_char_pf                = NULL;
    char_md.p_user_desc_md           = NULL;
    char_md.p_cccd_md                = NULL;
    char_md.p_sccd_md                = NULL;

    ble_uuid.type = p_nus-&amp;gt;uuid_type;
    ble_uuid.uuid = BLE_UUID_NUS_TX_CHARACTERISTIC;

    memset(&amp;amp;attr_md, 0, sizeof(attr_md));

    BLE_GAP_CONN_SEC_MODE_SET_OPEN(&amp;amp;attr_md.read_perm);
    BLE_GAP_CONN_SEC_MODE_SET_OPEN(&amp;amp;attr_md.write_perm);

    attr_md.vloc    = BLE_GATTS_VLOC_STACK;
    attr_md.rd_auth = 1;
    attr_md.wr_auth = 1;
    attr_md.vlen    = 1;

    memset(&amp;amp;attr_char_value, 0, sizeof(attr_char_value));

    attr_char_value.p_uuid    = &amp;amp;ble_uuid;
    attr_char_value.p_attr_md = &amp;amp;attr_md;
    attr_char_value.init_len  = sizeof(uint8_t);
    attr_char_value.init_offs = 0;
    attr_char_value.max_len   = BLE_NUS_MAX_TX_CHAR_LEN;

    return sd_ble_gatts_characteristic_add(p_nus-&amp;gt;service_handle,
                                           &amp;amp;char_md,
                                           &amp;amp;attr_char_value,
                                           &amp;amp;p_nus-&amp;gt;tx_handles);
}


void ble_nus_on_ble_evt(ble_nus_t * p_nus, ble_evt_t * p_ble_evt)
{
    if ((p_nus == NULL) || (p_ble_evt == NULL))
    {
        return;
    }

    switch (p_ble_evt-&amp;gt;header.evt_id)
    {
        case BLE_GAP_EVT_CONNECTED:
            on_connect(p_nus, p_ble_evt);
            break;

        case BLE_GAP_EVT_DISCONNECTED:
            on_disconnect(p_nus, p_ble_evt);
            break;

        case BLE_GATTS_EVT_WRITE:
            on_write(p_nus, p_ble_evt);
            break;

        default:
            // No implementation needed.
            break;
    }
}


uint32_t ble_nus_init(ble_nus_t * p_nus, const ble_nus_init_t * p_nus_init)
{
    uint32_t      err_code;
    ble_uuid_t    ble_uuid;
    ble_uuid128_t nus_base_uuid = NUS_BASE_UUID;

    VERIFY_PARAM_NOT_NULL(p_nus);
    VERIFY_PARAM_NOT_NULL(p_nus_init);

    // Initialize the service structure.
    p_nus-&amp;gt;conn_handle             = BLE_CONN_HANDLE_INVALID;
    p_nus-&amp;gt;data_handler            = p_nus_init-&amp;gt;data_handler;
    p_nus-&amp;gt;is_notification_enabled = false;

    /**@snippet [Adding proprietary Service to S110 SoftDevice] */
    // Add a custom base UUID.
    err_code = sd_ble_uuid_vs_add(&amp;amp;nus_base_uuid, &amp;amp;p_nus-&amp;gt;uuid_type);
    VERIFY_SUCCESS(err_code);

    ble_uuid.type = p_nus-&amp;gt;uuid_type;
    ble_uuid.uuid = BLE_UUID_NUS_SERVICE;

    // Add the service.
    err_code = sd_ble_gatts_service_add(BLE_GATTS_SRVC_TYPE_PRIMARY,
                                        &amp;amp;ble_uuid,
                                        &amp;amp;p_nus-&amp;gt;service_handle);
    /**@snippet [Adding proprietary Service to S110 SoftDevice] */
    VERIFY_SUCCESS(err_code);

    // Add the RX Characteristic.
    err_code = rx_char_add(p_nus, p_nus_init);
    VERIFY_SUCCESS(err_code);

    // Add the TX Characteristic.
    err_code = tx_char_add(p_nus, p_nus_init);
    VERIFY_SUCCESS(err_code);

    return NRF_SUCCESS;
}


uint32_t ble_nus_string_send(ble_nus_t * p_nus, uint8_t * p_string, uint16_t length)
{
    ble_gatts_hvx_params_t hvx_params;

    VERIFY_PARAM_NOT_NULL(p_nus);

    if ((p_nus-&amp;gt;conn_handle == BLE_CONN_HANDLE_INVALID) || (!p_nus-&amp;gt;is_notification_enabled))
    {
        return NRF_ERROR_INVALID_STATE;
    }

    if (length &amp;gt; BLE_NUS_MAX_DATA_LEN)
    {
        return NRF_ERROR_INVALID_PARAM;
    }

    memset(&amp;amp;hvx_params, 0, sizeof(hvx_params));

    hvx_params.handle = p_nus-&amp;gt;rx_handles.value_handle;
    hvx_params.p_data = p_string;
    hvx_params.p_len  = &amp;amp;length;
    hvx_params.type   = BLE_GATT_HVX_NOTIFICATION;

    return sd_ble_gatts_hvx(p_nus-&amp;gt;conn_handle, &amp;amp;hvx_params);
}

#endif // NRF_MODULE_ENABLED(BLE_NUS)
&lt;/pre&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Thanks,&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Swetha.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;pre class="ui-code" data-mode="text"&gt;

#include &amp;lt;stdbool.h&amp;gt;
#include &amp;lt;stdint.h&amp;gt;
#include &amp;quot;app_button.h&amp;quot;
#include &amp;quot;nrf_delay.h&amp;quot;
#include &amp;quot;nordic_common.h&amp;quot;
#include &amp;quot;nrf.h&amp;quot;
#include &amp;quot;ble_hci.h&amp;quot;
#include &amp;quot;ble_advdata.h&amp;quot;
#include &amp;quot;ble_advertising.h&amp;quot;
#include &amp;quot;ble_conn_params.h&amp;quot;
#include &amp;quot;softdevice_handler.h&amp;quot;
#include &amp;quot;app_timer.h&amp;quot;
#include &amp;quot;app_button.h&amp;quot;
#include &amp;quot;ble_nus.h&amp;quot;
#include &amp;quot;app_uart.h&amp;quot;
#include &amp;quot;app_util_platform.h&amp;quot;
#include &amp;quot;bsp.h&amp;quot;
#include &amp;quot;bsp_btn_ble.h&amp;quot;
#include &amp;quot;nrf_queue.h&amp;quot;

#include &amp;quot;nrf_log_ctrl.h&amp;quot;
#include &amp;quot;app_timer.h&amp;quot;
#include &amp;quot;nrf_log.h&amp;quot;
#include &amp;quot;boards.h&amp;quot;
#include &amp;quot;sdk_errors.h&amp;quot;
#include &amp;quot;nrf_drv_gpiote.h&amp;quot;


#define APP_TIMER_PRESCALER             0                                           /**&amp;lt; Value of the RTC1 PRESCALER register. */
#define APP_TIMER_OP_QUEUE_SIZE         4                                           /**&amp;lt; Size of timer operation queues. */

#define CENTRAL_LINK_COUNT              0                                           /**&amp;lt; Number of central links used by the application. When changing this number remember to adjust the RAM settings*/
#define PERIPHERAL_LINK_COUNT           1

static ble_nus_t                        m_nus;                                      /**&amp;lt; Structure to identify the Nordic UART Service. */

static uint16_t                         m_conn_handle = BLE_CONN_HANDLE_INVALID;    /**&amp;lt; Handle of the current connection. */

#define APP_FEATURE_NOT_SUPPORTED       BLE_GATT_STATUS_ATTERR_APP_BEGIN + 2        /**&amp;lt; Reply when unsupported features are requested. */
#define DEVICE_NAME                     &amp;quot;Keybox2&amp;quot;                	               /**&amp;lt; Name of device. Will be included in the advertising data. */
#define MIN_CONN_INTERVAL               MSEC_TO_UNITS(10, UNIT_1_25_MS)             /**&amp;lt; Minimum acceptable connection interval (20 ms), Connection interval uses 1.25 ms units. */
#define MAX_CONN_INTERVAL               MSEC_TO_UNITS(100, UNIT_1_25_MS)             /**&amp;lt; Maximum acceptable connection interval (75 ms), Connection interval uses 1.25 ms units. */
#define SLAVE_LATENCY                   0                                           /**&amp;lt; Slave latency. */
#define CONN_SUP_TIMEOUT                MSEC_TO_UNITS(1000, UNIT_10_MS)             /**&amp;lt; Connection supervisory timeout (4 seconds), Supervision Timeout uses 10 ms units. */
#define FIRST_CONN_PARAMS_UPDATE_DELAY  APP_TIMER_TICKS(5000, APP_TIMER_PRESCALER)  /**&amp;lt; Time from initiating event (connect or start of notification) to first time sd_ble_gap_conn_param_update is called (5 seconds). */
#define NEXT_CONN_PARAMS_UPDATE_DELAY   APP_TIMER_TICKS(30000, APP_TIMER_PRESCALER) /**&amp;lt; Time between each call to sd_ble_gap_conn_param_update after the first call (30 seconds). */
#define MAX_CONN_PARAMS_UPDATE_COUNT    3                                           /**&amp;lt; Number of attempts before giving up the connection parameter negotiation. */

#define DEAD_BEEF                       0xDEADBEEF                                  /**&amp;lt; Value used as error code on stack dump, can be used to identify stack location on stack unwind. */
#define NUS_SERVICE_UUID_TYPE           BLE_UUID_TYPE_VENDOR_BEGIN                  /**&amp;lt; UUID type for the Nordic UART Service (vendor specific). */

static ble_uuid_t                       m_adv_uuids[] = {{BLE_UUID_NUS_SERVICE, NUS_SERVICE_UUID_TYPE}};  /**&amp;lt; Universally unique service identifier. */

#define APP_ADV_INTERVAL                64                                          /**&amp;lt; The advertising interval (in units of 0.625 ms. This value corresponds to 40 ms). */
#define APP_ADV_TIMEOUT_IN_SECONDS      180                                         /**&amp;lt; The advertising timeout (in units of seconds). */

size_t               received_data_len = 0;

#define MAX_PACKET_SIZE          512

NRF_QUEUE_DEF(uint8_t, ble_nrf_queue, MAX_PACKET_SIZE, NRF_QUEUE_MODE_NO_OVERFLOW);

/**@brief Function for the application&amp;#39;s SoftDevice event handler.
 *
 * @param[in] p_ble_evt SoftDevice event.
 */
static void on_ble_evt(ble_evt_t * p_ble_evt)
{
    uint32_t err_code;

    switch (p_ble_evt-&amp;gt;header.evt_id)
    {
        case BLE_GAP_EVT_CONNECTED:
            m_conn_handle = p_ble_evt-&amp;gt;evt.gap_evt.conn_handle;
            break; // BLE_GAP_EVT_CONNECTED

        case BLE_GAP_EVT_DISCONNECTED:
            m_conn_handle = BLE_CONN_HANDLE_INVALID;
            break; // BLE_GAP_EVT_DISCONNECTED

        case BLE_GAP_EVT_SEC_PARAMS_REQUEST:
            // Pairing not supported
            err_code = sd_ble_gap_sec_params_reply(m_conn_handle, BLE_GAP_SEC_STATUS_PAIRING_NOT_SUPP, NULL, NULL);
            APP_ERROR_CHECK(err_code);
            break; // BLE_GAP_EVT_SEC_PARAMS_REQUEST

        case BLE_GATTS_EVT_SYS_ATTR_MISSING:
            // No system attributes have been stored.
            err_code = sd_ble_gatts_sys_attr_set(m_conn_handle, NULL, 0, 0);
            APP_ERROR_CHECK(err_code);
            break; // BLE_GATTS_EVT_SYS_ATTR_MISSING

        case BLE_GATTC_EVT_TIMEOUT:
            // Disconnect on GATT Client timeout event.
            err_code = sd_ble_gap_disconnect(p_ble_evt-&amp;gt;evt.gattc_evt.conn_handle,
                                             BLE_HCI_REMOTE_USER_TERMINATED_CONNECTION);
            APP_ERROR_CHECK(err_code);
            break; // BLE_GATTC_EVT_TIMEOUT

        case BLE_GATTS_EVT_TIMEOUT:
            // Disconnect on GATT Server timeout event.
            err_code = sd_ble_gap_disconnect(p_ble_evt-&amp;gt;evt.gatts_evt.conn_handle,
                                             BLE_HCI_REMOTE_USER_TERMINATED_CONNECTION);
            APP_ERROR_CHECK(err_code);
            break; // BLE_GATTS_EVT_TIMEOUT

        case BLE_EVT_USER_MEM_REQUEST:
            err_code = sd_ble_user_mem_reply(p_ble_evt-&amp;gt;evt.gattc_evt.conn_handle, NULL);
            APP_ERROR_CHECK(err_code);
            break; // BLE_EVT_USER_MEM_REQUEST

        case BLE_GATTS_EVT_RW_AUTHORIZE_REQUEST:
        {
            ble_gatts_evt_rw_authorize_request_t  req;
            ble_gatts_rw_authorize_reply_params_t auth_reply;

            req = p_ble_evt-&amp;gt;evt.gatts_evt.params.authorize_request;

            if (req.type != BLE_GATTS_AUTHORIZE_TYPE_INVALID)
            {
                if ((req.request.write.op == BLE_GATTS_OP_PREP_WRITE_REQ)     ||
                    (req.request.write.op == BLE_GATTS_OP_EXEC_WRITE_REQ_NOW) ||
                    (req.request.write.op == BLE_GATTS_OP_EXEC_WRITE_REQ_CANCEL))
                {
                    if (req.type == BLE_GATTS_AUTHORIZE_TYPE_WRITE)
                    {
                        auth_reply.type = BLE_GATTS_AUTHORIZE_TYPE_WRITE;
                    }
                    else
                    {
                        auth_reply.type = BLE_GATTS_AUTHORIZE_TYPE_READ;
                    }
                    auth_reply.params.write.gatt_status = APP_FEATURE_NOT_SUPPORTED;
                    err_code = sd_ble_gatts_rw_authorize_reply(p_ble_evt-&amp;gt;evt.gatts_evt.conn_handle,
                                                               &amp;amp;auth_reply);
                    APP_ERROR_CHECK(err_code);
                }
            }
        } break; // BLE_GATTS_EVT_RW_AUTHORIZE_REQUEST

#if (NRF_SD_BLE_API_VERSION == 3)
        case BLE_GATTS_EVT_EXCHANGE_MTU_REQUEST:
            err_code = sd_ble_gatts_exchange_mtu_reply(p_ble_evt-&amp;gt;evt.gatts_evt.conn_handle,
                                                       NRF_BLE_MAX_MTU_SIZE);
            APP_ERROR_CHECK(err_code);
            break; // BLE_GATTS_EVT_EXCHANGE_MTU_REQUEST
#endif

        default:
            // No implementation needed.
            break;
    }
}

/**@brief Function for dispatching a SoftDevice event to all modules with a SoftDevice
 *        event handler.
 *
 * @details This function is called from the SoftDevice event interrupt handler after a
 *          SoftDevice event has been received.
 *
 * @param[in] p_ble_evt  SoftDevice event.
 */
static void ble_evt_dispatch(ble_evt_t * p_ble_evt)
{
    ble_conn_params_on_ble_evt(p_ble_evt);
    ble_nus_on_ble_evt(&amp;amp;m_nus, p_ble_evt);
    on_ble_evt(p_ble_evt);
    ble_advertising_on_ble_evt(p_ble_evt);
//    bsp_btn_ble_on_ble_evt(p_ble_evt);

}

static void ble_stack_init(void)
{
    uint32_t err_code;

    nrf_clock_lf_cfg_t clock_lf_cfg = NRF_CLOCK_LFCLKSRC;

    // Initialize SoftDevice.
    SOFTDEVICE_HANDLER_INIT(&amp;amp;clock_lf_cfg, NULL);

    ble_enable_params_t ble_enable_params;
    err_code = softdevice_enable_get_default_config(CENTRAL_LINK_COUNT,
                                                    PERIPHERAL_LINK_COUNT,
                                                    &amp;amp;ble_enable_params);
    APP_ERROR_CHECK(err_code);

    //Check the ram settings against the used number of links
    CHECK_RAM_START_ADDR(CENTRAL_LINK_COUNT,PERIPHERAL_LINK_COUNT);

    // Enable BLE stack.
#if (NRF_SD_BLE_API_VERSION == 3)
    ble_enable_params.gatt_enable_params.att_mtu = NRF_BLE_MAX_MTU_SIZE;
#endif
    err_code = softdevice_enable(&amp;amp;ble_enable_params);
    APP_ERROR_CHECK(err_code);

    // Subscribe for BLE events.
    err_code = softdevice_ble_evt_handler_set(ble_evt_dispatch);
    APP_ERROR_CHECK(err_code);
}

/**@brief Function for the GAP initialization.
 *
 * @details This function will set up all the necessary GAP (Generic Access Profile) parameters of
 *          the device. It also sets the permissions and appearance.
 */
static void gap_params_init(void)
{
    uint32_t                err_code;
    ble_gap_conn_params_t   gap_conn_params;
    ble_gap_conn_sec_mode_t sec_mode;

    BLE_GAP_CONN_SEC_MODE_SET_OPEN(&amp;amp;sec_mode);

    err_code = sd_ble_gap_device_name_set(&amp;amp;sec_mode,
                                          (const uint8_t *) DEVICE_NAME,
                                          strlen(DEVICE_NAME));
    APP_ERROR_CHECK(err_code);

    memset(&amp;amp;gap_conn_params, 0, sizeof(gap_conn_params));

    gap_conn_params.min_conn_interval = MIN_CONN_INTERVAL;
    gap_conn_params.max_conn_interval = MAX_CONN_INTERVAL;
    gap_conn_params.slave_latency     = SLAVE_LATENCY;
    gap_conn_params.conn_sup_timeout  = CONN_SUP_TIMEOUT;

    err_code = sd_ble_gap_ppcp_set(&amp;amp;gap_conn_params);
    APP_ERROR_CHECK(err_code);
}

uint32_t handle_ble_data(uint8_t *p_data, size_t p_data_len)
{
   if((NULL == p_data) || (0 == p_data_len))
   {
      return 0;
   }

   nrf_queue_write(&amp;amp;ble_nrf_queue, p_data, p_data_len);
   received_data_len = p_data_len;

   return 0;
}

/**@brief Function for handling the data from the Nordic UART Service.
 *
 * @details This function will process the data received from the Nordic UART BLE Service and send
 *          it to the UART module.
 *
 * @param[in] p_nus    Nordic UART Service structure.
 * @param[in] p_data   Data to be send to UART module.
 * @param[in] length   Length of the data.
 */
/**@snippet [Handling the data received over BLE] */
static void nus_data_handler(ble_nus_t * p_nus, uint8_t * p_data, uint16_t length)
{
//    for (uint32_t i = 0; i &amp;lt; length; i++)
//    {
//        while (app_uart_put(p_data[i]) != NRF_SUCCESS);
//    }
//    while (app_uart_put(&amp;#39;\r&amp;#39;) != NRF_SUCCESS);
//    while (app_uart_put(&amp;#39;\n&amp;#39;) != NRF_SUCCESS);

       handle_ble_data(p_data, length);
}

/**@brief Function for initializing services that will be used by the application.
 */
static void services_init(void)
{
    uint32_t       err_code;
    ble_nus_init_t nus_init;

    memset(&amp;amp;nus_init, 0, sizeof(nus_init));

    nus_init.data_handler = nus_data_handler;

    err_code = ble_nus_init(&amp;amp;m_nus, &amp;amp;nus_init);
    APP_ERROR_CHECK(err_code);
}

/**@brief Function for putting the chip into sleep mode.
 *
 * @note This function will not return.
 */
static void sleep_mode_enter(void)
{
	uint32_t err_code;

//    uint32_t err_code = bsp_indication_set(BSP_INDICATE_IDLE);
//    APP_ERROR_CHECK(err_code);

    // Prepare wakeup buttons.
//    err_code = bsp_btn_ble_sleep_mode_prepare();
//    APP_ERROR_CHECK(err_code);

    // Go to system-off mode (this function will not return; wakeup will cause a reset).
    err_code = sd_power_system_off();
    APP_ERROR_CHECK(err_code);
}

/**@brief Function for handling advertising events.
 *
 * @details This function will be called for advertising events which are passed to the application.
 *
 * @param[in] ble_adv_evt  Advertising event.
 */
static void on_adv_evt(ble_adv_evt_t ble_adv_evt)
{
//    uint32_t err_code;

    switch (ble_adv_evt)
    {
        case BLE_ADV_EVT_FAST:
//            err_code = bsp_indication_set(BSP_INDICATE_ADVERTISING);
//            APP_ERROR_CHECK(err_code);
            break;
        case BLE_ADV_EVT_IDLE:
            sleep_mode_enter();
            break;
        default:
            break;
    }
}



/**@brief Function for initializing the Advertising functionality.
 */
static void advertising_init(void)
{
    uint32_t               err_code;
    ble_advdata_t          advdata;
    ble_advdata_t          scanrsp;
    ble_adv_modes_config_t options;

    // Build advertising data struct to pass into @ref ble_advertising_init.
    memset(&amp;amp;advdata, 0, sizeof(advdata));
    advdata.name_type          = BLE_ADVDATA_FULL_NAME;
    advdata.include_appearance = false;
    advdata.flags              = BLE_GAP_ADV_FLAGS_LE_ONLY_LIMITED_DISC_MODE;

    memset(&amp;amp;scanrsp, 0, sizeof(scanrsp));
    scanrsp.uuids_complete.uuid_cnt = sizeof(m_adv_uuids) / sizeof(m_adv_uuids[0]);
    scanrsp.uuids_complete.p_uuids  = m_adv_uuids;

    memset(&amp;amp;options, 0, sizeof(options));
    options.ble_adv_fast_enabled  = true;
    options.ble_adv_fast_interval = APP_ADV_INTERVAL;
    options.ble_adv_fast_timeout  = APP_ADV_TIMEOUT_IN_SECONDS;

    err_code = ble_advertising_init(&amp;amp;advdata, &amp;amp;scanrsp, &amp;amp;options, on_adv_evt, NULL);
    APP_ERROR_CHECK(err_code);
}

/**@brief Function for handling an event from the Connection Parameters Module.
 *
 * @details This function will be called for all events in the Connection Parameters Module
 *          which are passed to the application.
 *
 * @note All this function does is to disconnect. This could have been done by simply setting
 *       the disconnect_on_fail config parameter, but instead we use the event handler
 *       mechanism to demonstrate its use.
 *
 * @param[in] p_evt  Event received from the Connection Parameters Module.
 */
static void on_conn_params_evt(ble_conn_params_evt_t * p_evt)
{
    uint32_t err_code;

    if (p_evt-&amp;gt;evt_type == BLE_CONN_PARAMS_EVT_FAILED)
    {
        err_code = sd_ble_gap_disconnect(m_conn_handle, BLE_HCI_CONN_INTERVAL_UNACCEPTABLE);
        APP_ERROR_CHECK(err_code);
    }
}

/**@brief Function for handling errors from the Connection Parameters module.
 *
 * @param[in] nrf_error  Error code containing information about what went wrong.
 */
static void conn_params_error_handler(uint32_t nrf_error)
{
    APP_ERROR_HANDLER(nrf_error);
}

/**@brief Function for initializing the Connection Parameters module.
 */
static void conn_params_init(void)
{
    uint32_t               err_code;
    ble_conn_params_init_t cp_init;

    memset(&amp;amp;cp_init, 0, sizeof(cp_init));

    cp_init.p_conn_params                  = NULL;
    cp_init.first_conn_params_update_delay = FIRST_CONN_PARAMS_UPDATE_DELAY;
    cp_init.next_conn_params_update_delay  = NEXT_CONN_PARAMS_UPDATE_DELAY;
    cp_init.max_conn_params_update_count   = MAX_CONN_PARAMS_UPDATE_COUNT;
    cp_init.start_on_notify_cccd_handle    = BLE_GATT_HANDLE_INVALID;
    cp_init.disconnect_on_fail             = false;
    cp_init.evt_handler                    = on_conn_params_evt;
    cp_init.error_handler                  = conn_params_error_handler;

    err_code = ble_conn_params_init(&amp;amp;cp_init);
    APP_ERROR_CHECK(err_code);
}

/**
 * @brief Function for application main entry.
 */

int main(void)
{
	ret_code_t err_code;

    // Initialize.
//    APP_TIMER_INIT(APP_TIMER_PRESCALER, APP_TIMER_OP_QUEUE_SIZE, false);
//    uart_init();

//    buttons_leds_init(&amp;amp;erase_bonds);
    ble_stack_init();
    gap_params_init();
    services_init();
    advertising_init();
    conn_params_init();

//    APP_ERROR_CHECK(1);
//    printf(&amp;quot;\r\nUART Start!\r\n&amp;quot;);
    err_code = ble_advertising_start(BLE_ADV_MODE_FAST);
    APP_ERROR_CHECK(err_code);


	for (;;)
	{

	}
}

/**
 *@}
 **/
&lt;/pre&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to create a Makefile based project?</title><link>https://devzone.nordicsemi.com/thread/274817?ContentTypeID=1</link><pubDate>Wed, 14 Oct 2020 08:29:43 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8b7ec793-bd64-46e7-b25f-73b6b36ab51f</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;What was the line_num and file_name? Hover over the file name to see the path to the file. If you don&amp;#39;t see it, then use:&lt;/p&gt;
&lt;p&gt;&amp;quot;nrfjprog --memrd 0x&amp;lt;filename memory address&amp;gt; --n 256&amp;quot;. What does it say?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;And when you figure out what it says, check where this points to in your application, and what function that returned that value (err_code).&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;BR,&lt;/p&gt;
&lt;p&gt;Edvin&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to create a Makefile based project?</title><link>https://devzone.nordicsemi.com/thread/274788?ContentTypeID=1</link><pubDate>Wed, 14 Oct 2020 07:09:36 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:12c32a8e-5048-4782-9374-2a35f2d237e5</guid><dc:creator>swetha Paladugu</dc:creator><description>&lt;p&gt;Edvan,&lt;/p&gt;
&lt;p&gt;I dont see any logs.. Since i am running the code in debug mode.&lt;/p&gt;
&lt;p&gt;I did what u said earlier... it came to&amp;nbsp;app_error_handler() with error code as 1.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to create a Makefile based project?</title><link>https://devzone.nordicsemi.com/thread/274786?ContentTypeID=1</link><pubDate>Wed, 14 Oct 2020 06:59:40 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d1ee68ee-bc76-4d14-a527-9693ed4490b5</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;Ok. Do you see any logs? Does it say anything? Try to define DEBUG in your preprocessor definitions, and put a breakpoint in the error handler. To make sure that you set the breakpoint the correct place, try adding APP_ERROR_CHECK(1); before advertising_start();&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to create a Makefile based project?</title><link>https://devzone.nordicsemi.com/thread/274783?ContentTypeID=1</link><pubDate>Wed, 14 Oct 2020 06:47:18 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8ad72a69-f2c6-47d4-934a-37c3d33b2883</guid><dc:creator>swetha Paladugu</dc:creator><description>&lt;p&gt;Hi Edvan,&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I have an issue, i am connecting my device with nrf connect application and trying to send data... but in code, it doesn&amp;#39;t hit the breakpoint in&amp;nbsp;nus_data_handler() function. Instead it is hitting break point in&amp;nbsp; BLE_GATTS_EVT_RW_AUTHORIZE_REQUEST case in&amp;nbsp;on_ble_evt() function.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Can you please help?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to create a Makefile based project?</title><link>https://devzone.nordicsemi.com/thread/274715?ContentTypeID=1</link><pubDate>Tue, 13 Oct 2020 14:55:06 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:337c4d2f-c5b3-4a6e-ac0e-487480279af7</guid><dc:creator>swetha Paladugu</dc:creator><description>&lt;p&gt;Advertising is happening.. advertising_start is returning 0.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to create a Makefile based project?</title><link>https://devzone.nordicsemi.com/thread/274706?ContentTypeID=1</link><pubDate>Tue, 13 Oct 2020 14:23:02 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:aaac7723-e01f-415a-a111-1d40c3486d0f</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;Yes, but you can add this later. When you are struggling with the IDE setup, bootloader causes a lot more pain than it does good.&lt;/p&gt;
&lt;p&gt;Let me know when you find out what ble_advertising_start() returns.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to create a Makefile based project?</title><link>https://devzone.nordicsemi.com/thread/274675?ContentTypeID=1</link><pubDate>Tue, 13 Oct 2020 13:30:01 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e9a5539c-22c0-4ee8-84e0-b8a8b64f9c7d</guid><dc:creator>swetha Paladugu</dc:creator><description>&lt;p&gt;but i would need bootloader also since i have ota to do in my project..&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to create a Makefile based project?</title><link>https://devzone.nordicsemi.com/thread/274672?ContentTypeID=1</link><pubDate>Tue, 13 Oct 2020 13:24:30 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:32d94453-894b-432b-8198-6a4aed5e2b13</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;I think you should skip the bootloader for now. On this stage, a bootloader may introduce more confusing elements. I would make sure that I have a working IDE setup before introducing a bootloader.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
[quote user="Edvin Holmseth"]What does advertising_start() return? If it is not reached, where does the application stop? Is the main() function reached at all?[/quote]
&lt;p&gt;&amp;nbsp;No bootloader this time.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>