<?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>What is an Application Event?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/70655/what-is-an-application-event</link><description>I am searching for a straight answer to this question. &amp;#39;Application event&amp;#39; is used frequently in the documentation but never defined. I write the application but I clearly do not define these events. Initially I assumed they were events I defined and</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 22 Feb 2021 11:41:53 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/70655/what-is-an-application-event" /><item><title>RE: What is an Application Event?</title><link>https://devzone.nordicsemi.com/thread/295553?ContentTypeID=1</link><pubDate>Mon, 22 Feb 2021 11:41:53 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:90521851-1c2f-43a6-843f-f309f6eec3b4</guid><dc:creator>Karl Ylvisaker</dc:creator><description>&lt;p&gt;To accomplish this without using the app_util.h file from the SKD, I suppose you could just take out the relevant parts of the file, to be used in your application.&lt;br /&gt;For example, take a look at the following code from the app_util.h file.&lt;br /&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;#elif defined(__SES_ARM)
extern uint32_t * _vectors;
extern uint32_t __FLASH_segment_used_end__;
#define CODE_START ((uint32_t)&amp;amp;_vectors)
#define CODE_END   ((uint32_t)&amp;amp;__FLASH_segment_used_end__)
#define CODE_SIZE  (CODE_END - CODE_START)&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;You could then have your application calculate where the first free page is located by subtracting the application and SoftDevice size from the available flash.&lt;br /&gt;Keep in mind that if you at any point add a DFU bootloader or similar at the top of the memory, you will need to account for this yourself, in your application logic.&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Karl&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: What is an Application Event?</title><link>https://devzone.nordicsemi.com/thread/295300?ContentTypeID=1</link><pubDate>Fri, 19 Feb 2021 11:09:46 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:65724091-e9ea-41f1-ad40-b5b265535d58</guid><dc:creator>brianreinhold</dc:creator><description>&lt;p&gt;Only thing missing is finding the start of free flash programmatically. I&amp;#39;ll work on that issue later.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: What is an Application Event?</title><link>https://devzone.nordicsemi.com/thread/295299?ContentTypeID=1</link><pubDate>Fri, 19 Feb 2021 10:55:05 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e83fb806-4302-4bda-af7f-543bc8f448cf</guid><dc:creator>Karl Ylvisaker</dc:creator><description>&lt;p&gt;Hello Brian,&lt;br /&gt;&lt;br /&gt;I have been out of office for some days, thank you for your patience.&lt;/p&gt;
[quote user="brianreinhold"]I also do most of my design work using the pc-ble-driver as it is obviously easier to create new designs on a PC than any embedded platform. That makes portability of that test code to any on-device implementation quite easy.[/quote][quote user="brianreinhold"]Lastly, we are working on a new health device standard that is generic. Clearly there is no support for such a standard on any platform. One of the guiding principles here is that it be a simple as possible with minimum Bluetooth knowledge needed. I want to make it as easy as possible to develop using the fewest and most basic GATT GAP operations possible.[/quote]
&lt;p&gt;Thank you for elaborating - I definitely understand what you mean about the SDK&amp;#39;s changing more dramatically then the SoftDevice API&amp;#39;s, and I suppose that if you aspire to always keep the SDK up to date with the latest version, this is a better way of doing it - especially since you are able to implement all the functionality you are after, using this way.&lt;/p&gt;
[quote user="brianreinhold"]this is flash on an embedded system! When is that ever completely simple?[/quote]
&lt;p&gt;I wholeheartedly concur! I am also glad to hear that you have found an approach that achieves your intended functionality, in an easy way.&amp;nbsp;&lt;/p&gt;
[quote user="brianreinhold"]Okay, I have grown fond of SoftDevice. I can understand what it does because I have a good understanding of BTLE at the GATT/GAP level. When I need something, I have a good idea what to look for.[/quote]
&lt;p&gt;I am happy to hear that, brianreinhold! Then you have already gotten to &amp;#39;the sweet spot&amp;#39; of BLE development, in my opinion! Good knowledge of the protocol - and SoftDevice implementation of it - significantly speeds up the development, and makes the whole process significantly easier.&lt;br /&gt;&lt;br /&gt;Please do not hesitate to open a new ticket if you should encounter any issues or questions in the future.&lt;br /&gt;&lt;br /&gt;Good luck with your development!&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Karl&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: What is an Application Event?</title><link>https://devzone.nordicsemi.com/thread/293784?ContentTypeID=1</link><pubDate>Wed, 10 Feb 2021 13:58:33 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:10663abb-b85b-49f1-8238-2661abc420ae</guid><dc:creator>brianreinhold</dc:creator><description>&lt;p&gt;Karl,&lt;/p&gt;
&lt;p&gt;There are a couple of reasons I am not using the SDK. I am covering a range of platforms from s110 to s140 and these SoftDevice API do change, but not by much. The associated SDKs, on the other hand, change dramatically; the storage routines perhaps changed the most. Once I changed the original SDK-based s110 code to use just SoftDevice, moving to s130 was trivial. I also do most of my design work using the pc-ble-driver as it is obviously easier to create new designs on a PC than any embedded platform. That makes portability of that test code to any on-device implementation quite easy.&lt;/p&gt;
&lt;p&gt;Lastly, we are working on a new health device standard that is generic. Clearly there is no support for such a standard on any platform. One of the guiding principles here is that it be a simple as possible with minimum Bluetooth knowledge needed. I want to make it as easy as possible to develop using the fewest and most basic GATT GAP operations possible.&lt;/p&gt;
&lt;p&gt;Except for finding the first free start address, I found using SoftDevice to write to flash to be very straight forward and simple. Yes, it was a bit of a pain to assure 4-byte boundaries and write in 4-byte chunks. But this is flash on an embedded system! When is that ever completely simple?&lt;/p&gt;
&lt;p&gt;Also, I could only figure out how to emulate semaphores using the sd_ calls. I needed to indicate and notify characteristics that were multiple MTUs in length. In the driver, I use semaphores. On the platform, I cannot. I could only figure out how to do that using softdevice. Basically two calls to handle the wait for event and get events/dispatch events in the main loop. I could not figure out how to do the same using the SDK.&lt;/p&gt;
&lt;p&gt;Okay, I have grown fond of SoftDevice. I can understand what it does because I have a good understanding of BTLE at the GATT/GAP level. When I need something, I have a good idea what to look for.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: What is an Application Event?</title><link>https://devzone.nordicsemi.com/thread/293354?ContentTypeID=1</link><pubDate>Mon, 08 Feb 2021 13:47:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b82cfe3c-e992-4da0-be44-d66f930091da</guid><dc:creator>Karl Ylvisaker</dc:creator><description>[quote user="brianreinhold"]I have looked at them a little bit but I am not using the SDK but SoftDevice. That is because I am also using pc-ble-driver with similar code. There is no SDK for that.[/quote]
&lt;p&gt;Yes, I have understood this - but I have not quite understood your aversion to using the SDK for your firmware developing. Could you elaborate on why this is so?&lt;br /&gt;As mentioned the pc-ble-driver is just a serialized SoftDevice API, so there really is not a lot to go on in terms of creating an SDK for the pc-ble-driver, unless you by this mean that there should be an array of examples using the pc-ble-driver akin to the SDK&amp;#39;s examples?&lt;/p&gt;
[quote user="brianreinhold"]However, it sounds like you are saying that it is an impossible task. I have to manually hard code the start location based upon reading a map file every compile - then recompile.[/quote]
&lt;p&gt;Well, both yes and no. If you insist on not using any parts of the SDK other than the SoftDevice API, then yes, you will have to keep track of the size of your application yourself. However, if you open for using the SDK then you will have multiple options.&lt;br /&gt;For example, with you current setup you may use the CODE_START, CODE_END, and CODE_SIZE define&amp;#39;s from the app_util.h file.&lt;br /&gt;Or, you may use the fds or fstorage libraries, as they both start at the top of the Flash(also checking if there is a bootloader present and proceeding accordingly), and writes downwards.&lt;br /&gt;&lt;br /&gt;Again, I would recommend that you do make use of the SDK components instead of implementing these things yourself - it will save you a lot of time and work.&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Karl&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: What is an Application Event?</title><link>https://devzone.nordicsemi.com/thread/292657?ContentTypeID=1</link><pubDate>Wed, 03 Feb 2021 11:41:35 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e91035ac-8ca4-4aaf-adad-698c133de985</guid><dc:creator>brianreinhold</dc:creator><description>&lt;p&gt;I have looked at them a little bit but I am not using the SDK but SoftDevice. That is because I am also using pc-ble-driver with similar code. There is no SDK for that.&lt;/p&gt;
&lt;p&gt;I did search through the code to see if I could find some indication has how the end of used flash could be obtained programmatically. I already write to flash using the last page, so writing to flash is not the problem. Its programmatically finding where to start.&lt;/p&gt;
&lt;p&gt;However, it sounds like you are saying that it is an impossible task. I have to manually hard code the start location based upon reading a map file every compile - then recompile.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: What is an Application Event?</title><link>https://devzone.nordicsemi.com/thread/292639?ContentTypeID=1</link><pubDate>Wed, 03 Feb 2021 10:29:44 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6bd5b758-49f5-4afc-bcc1-9319636454a3</guid><dc:creator>Karl Ylvisaker</dc:creator><description>[quote user="brianreinhold"]The example I am referring to it the demo &amp;#39;write to flash&amp;#39; example.[/quote]
&lt;p&gt;Thank you for clarifying.&lt;/p&gt;
[quote user="brianreinhold"]By dynamic I mean the size of the application I write will be dynamic, As I add/change code the size of its footprint will change.[/quote]
&lt;p&gt;That is true - the memory requirement of the application will certainly change during development.&lt;br /&gt;If you do not want to update your memory map for each time this happens, you could make due with a smaller partition during development, and then resize it once the development of the application is done.&lt;/p&gt;
[quote user="brianreinhold"]I do not store measurement data in my example but I want to. In order to do that I will need more than the last page.[/quote]
&lt;p&gt;Have you taken a look at the &lt;a href="https://infocenter.nordicsemi.com/topic/sdk_nrf5_v17.0.2/fstorage_example.html"&gt;Flash Storage&lt;/a&gt; and &lt;a href="https://infocenter.nordicsemi.com/topic/sdk_nrf5_v17.0.2/fstorage_example.html"&gt;Flash Data Storage&lt;/a&gt; examples? They demonstrate the usage of both the fstorage and fds library.&lt;br /&gt;It sounds like either of them could be a good fit for the use-case you describe.&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Karl&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: What is an Application Event?</title><link>https://devzone.nordicsemi.com/thread/292335?ContentTypeID=1</link><pubDate>Mon, 01 Feb 2021 17:48:11 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fefde45b-3a15-44cd-b26a-501adb09a2f0</guid><dc:creator>brianreinhold</dc:creator><description>&lt;p&gt;The example I am referring to it the demo &amp;#39;write to flash&amp;#39; example. By dynamic I mean the size of the application I write will be dynamic, As I add/change code the size of its footprint will change. What would be nice in the example is if they would illustrate how to find the first free area of flash so you would have the maximum amount of storage available. I do not store measurement data in my example but I want to. In order to do that I will need more than the last page.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: What is an Application Event?</title><link>https://devzone.nordicsemi.com/thread/292317?ContentTypeID=1</link><pubDate>Mon, 01 Feb 2021 16:08:05 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1dd0e0cb-85c1-440b-81fd-aed7595c5dcd</guid><dc:creator>Karl Ylvisaker</dc:creator><description>[quote user="brianreinhold"]That being said, it would be helpful if the documentation on&amp;nbsp;&lt;span&gt;sd_app_evt_wait()&amp;nbsp; were updated. At the moment it says only one code is returned; NRF_SUCCESS. Why check when you know what it is?&lt;/span&gt;[/quote]
&lt;p&gt;I certainly see your point here - but I would again argue that error codes should always be checked, no matter what, if it is specified that an error code is to be returned.&lt;br /&gt;I wholeheartedly agree that the documentation should reflect that there exists a possibility of a != NRF_SUCCESS error code return.&lt;br /&gt;I will add this as a second documentation review request.&lt;/p&gt;
[quote user="brianreinhold"]With respect to using flash I would assume that would take quite a bit of flash memory. Right now I am stuck with using the last page (as in the example) because I do not know how to &lt;em&gt;programmatically&lt;/em&gt; obtain the first free page available. At the moment I do not need much space so the last page suffices.[/quote]
&lt;p&gt;I do not know anything about the size of your application, but I am happy to hear that you found the functionality of the logger module helpful and that you have found a solution that works out for you for the time being.&lt;/p&gt;
[quote user="brianreinhold"]The example does not illustrate or explain how one can programmatically obtain the location of the next free space after the application is loaded, or even the next free page. Application size is dynamic; it changes for every change you make in the source.[/quote]
&lt;p&gt;Which example are you referring to here?&lt;br /&gt;I am not sure I understand the last part of your comment here - the application size is not dynamic in the sense the word dynamic in relation to memory is usually used.&lt;br /&gt;Unless you are working with dynamic memory allocation in your application?&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Karl&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: What is an Application Event?</title><link>https://devzone.nordicsemi.com/thread/291716?ContentTypeID=1</link><pubDate>Thu, 28 Jan 2021 09:39:47 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e801907a-f6ad-4c4e-932e-4936c34e8982</guid><dc:creator>brianreinhold</dc:creator><description>&lt;p&gt;Karl,&lt;/p&gt;
&lt;p&gt;That being said, it would be helpful if the documentation on&amp;nbsp;&lt;span&gt;sd_app_evt_wait()&amp;nbsp; were updated. At the moment it says only one code is returned; NRF_SUCCESS. Why check when you know what it is? In any case there is a second code it can return and that is&amp;nbsp;NRF_ERROR_SOFTDEVICE_NOT_ENABLED. I do not know if it can return additional codes. Again, this is s130. It may be corrected in later versions of SoftDevice but this is the latest version I can use with nrf51822.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;With respect to using flash I would assume that would take quite a bit of flash memory. Right now I am stuck with using the last page (as in the example) because I do not know how to &lt;em&gt;programmatically&lt;/em&gt; obtain the first free page available. At the moment I do not need much space so the last page suffices.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;The example does not illustrate or explain how one can programmatically obtain the location of the next free space after the application is loaded, or even the next free page. Application size is dynamic; it changes for every change you make in the source.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Eventually when the manufacturers decide to support a trickle charge so the RTC can run while not in use, I would like to be able to store data (stored data requires a time stamp by spec). Then I would like to make use of a lost more flash and the last page will not be enough.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: What is an Application Event?</title><link>https://devzone.nordicsemi.com/thread/291690?ContentTypeID=1</link><pubDate>Thu, 28 Jan 2021 08:26:57 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:859d69b0-7fd7-42bd-9efb-720b04322b99</guid><dc:creator>Karl Ylvisaker</dc:creator><description>[quote user="brianreinhold"]When things are not working and you see two different methods in the documentation, you don&amp;#39;t know which is right, especially when you try both and neither works.[/quote]
&lt;p&gt;Yes, as I said - I can completely relate to this.&lt;/p&gt;
[quote user="brianreinhold"]In any case, the message sequence diagram in the s130 for the&amp;nbsp;&lt;span&gt;Thread Mode Event Retrieval is incorrect.&lt;/span&gt;[/quote]
&lt;p&gt;Yes, thank you for pointing that out. I have created an internal ticket for this issue and marked it for review.&lt;/p&gt;
[quote user="brianreinhold"]The APP:ERROR:ERROR:Fatal was due to me disabling softdevice and then calling the sd_app_evt_wait() method.. The docs indicate that it can only return NRF_SUCCESS, so I never checked.[/quote]
&lt;p&gt;I am glad that you were able to identify the cause of the issue, and I must urge you to &lt;em&gt;always&lt;/em&gt; check all returned error codes, since this is the only way for you to know that a function has failed (for whatever reason), and that the program can not proceed as normal - this is especially useful to catch and resolve transient errors.&lt;/p&gt;
[quote user="brianreinhold"]Since I use the UART in the production device to talk to the sensor MCU, I cannot use the log.[/quote]
&lt;p&gt;Yes, then your options are limited. If you intended to use the logging for debug purposes after deployment, could it be an option to have it saved to flash instead?&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Karl&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: What is an Application Event?</title><link>https://devzone.nordicsemi.com/thread/291596?ContentTypeID=1</link><pubDate>Wed, 27 Jan 2021 17:58:29 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6f1d7be0-f814-4424-9993-f3bd7e0b93e2</guid><dc:creator>brianreinhold</dc:creator><description>&lt;p&gt;Karl,&lt;/p&gt;
&lt;p&gt;When things are not working and you see two different methods in the documentation, you don&amp;#39;t know which is right, especially when you try both and neither works. It turned out the problem was the NRF_LOG; I was looking for errors in all the wrong places.&amp;nbsp; &amp;nbsp;In any case, the message sequence diagram in the s130 for the&amp;nbsp;&lt;span&gt;Thread Mode Event Retrieval is incorrect.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;The APP:ERROR:ERROR:Fatal was due to me disabling softdevice and then calling the sd_app_evt_wait() method.. The docs indicate that it can only return NRF_SUCCESS, so I never checked.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Since I use the UART in the production device to talk to the sensor MCU, I cannot use the log.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Wnen I shut down, the device will power off. In the end I do a reset so I dont have to re-enable the softdevice.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: What is an Application Event?</title><link>https://devzone.nordicsemi.com/thread/291583?ContentTypeID=1</link><pubDate>Wed, 27 Jan 2021 16:17:00 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fbbfaa5e-e48c-48ed-994d-4e47ee8d2f3f</guid><dc:creator>Karl Ylvisaker</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
[quote user="brianreinhold"]I get an APP:ERROR:FATAL when I write to flash (pairing and bonding data) but the write succeeds. [/quote]
&lt;p&gt;That sounds strange. Could you paste me the entire error message?&lt;/p&gt;
[quote user="brianreinhold"]If I had ONLY looked at the diagram, I would not have looped over the sd_ble_evt_get() until I got no more events.[/quote]
&lt;p&gt;I understand how this could cause confusion. However, I would also argue that it is unwise to use most any function without first reading its API reference documentation. In this case, it is thoroughly explained in &lt;a href="https://infocenter.nordicsemi.com/index.jsp?topic=%2Fcom.nordic.infocenter.s112.api.v6.1.1%2Fgroup___b_l_e___c_o_m_m_o_n___f_u_n_c_t_i_o_n_s.html&amp;amp;anchor=ga412b12b43c253dd744bcf574d6e86f43"&gt;the sd_ble_evt_get documentation&lt;/a&gt;, which reads:&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;&lt;em&gt;This call allows the application to pull a BLE event from the BLE stack. The application is signaled that an event is available from the BLE stack by the triggering of the SD_EVT_IRQn interrupt. The application is free to choose whether to call this function from thread mode (main context) or directly from the Interrupt Service Routine that maps to SD_EVT_IRQn. In any case however, and because the BLE stack runs at a higher priority than the application, this function should be called in a loop (until&amp;nbsp;&lt;a href="https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.s112.api.v6.1.1/group__nrf__error.html#ga349d25ada15be023e0d507f45ada682c"&gt;NRF_ERROR_NOT_FOUND&lt;/a&gt;&amp;nbsp;is returned) every time SD_EVT_IRQn is raised to ensure that all available events are pulled from the BLE stack. Failure to do so could potentially leave events in the internal queue without the application being aware of this fact.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;Undoubtedly I also agree that all documentation should point in the same direction, to avoid any confusion. Could you link the exact diagram in question here for me, so I could mark it for internal review?&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
[quote user="brianreinhold"]Given the issues I was having I tried all kinds of combinations (many made no sense but one got desperate)![/quote]
&lt;p&gt;I think absolutely all programmers can relate to this! :)&amp;nbsp;&lt;/p&gt;
[quote user="brianreinhold"]What is the proper way to shut down? Exit from the above loop?[/quote]
&lt;p&gt;When you say shut down, do you mean SYSTEM_OFF?&lt;br /&gt;If you are using the same sleep loop as from the examples you may use &lt;a href="https://infocenter.nordicsemi.com/index.jsp?topic=%2Fcom.nordic.infocenter.s132.api.v3.0.0%2Fgroup___n_r_f___s_o_c___f_u_n_c_t_i_o_n_s.html&amp;amp;anchor=ga774947ee0e200456ea3aec3fc7f8bd6b"&gt;sd_power_system_off&lt;/a&gt;&amp;nbsp;function to enter SYSTEM_OFF. Keep in mind that the only way to wake from SYSTEM_OFF is with a reset, and thus you will have to setup a way to reset(such as the push of a button) if you intend for your device to wake up again.&lt;br /&gt;How to configure wakeup from SYSTEM_OFF is demonstrated in most of the BLE examples in the SDK, such as &lt;a href="https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.sdk5.v12.3.0/ble_sdk_app_hrs.html"&gt;the Heart Rate monitor example&lt;/a&gt;&amp;#39;s&amp;nbsp;&lt;em&gt;sleep_mode_enter&lt;/em&gt; function.&lt;/p&gt;
[quote user="brianreinhold"]In any case, I cannot use the log when I deploy it on the actual device (I assume). All I have connecting the actual device to Keil is the SWD interface on the DK.[/quote]
&lt;p&gt;You may use the logger module on a third party device without a debugger, but you will then be forced to use the loggers UART backend, which leaves you without UART for the rest of your application. &lt;a href="https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.sdk5.v12.3.0/nrf_log.html"&gt;You can read more about the logger library here&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Karl&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: What is an Application Event?</title><link>https://devzone.nordicsemi.com/thread/290991?ContentTypeID=1</link><pubDate>Mon, 25 Jan 2021 11:01:43 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c371bd44-581b-4bc1-9505-975f410b59a2</guid><dc:creator>brianreinhold</dc:creator><description>&lt;p&gt;The main problem I have with the site is the &amp;#39;reply&amp;#39; button not being displayed. It is shown after some posts but not all them. Someone figured out a clever way to make it display, but it does not always get all of the missing ones.&lt;/p&gt;
&lt;p&gt;In any case the contradiction I was mentioning is the between the message diagram and the text description for the sd_ble_evt_get(). The message diagram shows no repeat of the sd_ble_evt_get(), the sd_ble_evt_get() is done once and then one is back to the sd_app_evt_wait().&lt;/p&gt;
&lt;p&gt;If I had ONLY looked at the diagram, I would not have looped over the sd_ble_evt_get() until I got no more events. Given the issues I was having I tried all kinds of combinations (many made no sense but one got desperate)!&lt;/p&gt;
&lt;p&gt;As far as the logging goes I do use the deferred approach and process the log in that final for(;;) loop used in all the examples. So It has something to do with the size of the string. If the string is short, no problem. But when it is not, it freezes. I do use the&amp;nbsp;nrf_log_push() to contain the string.&lt;/p&gt;
&lt;p&gt;In any case, I cannot use the log when I deploy it on the actual device (I assume). All I have connecting the actual device to Keil is the SWD interface on the DK.&lt;/p&gt;
&lt;p&gt;Here is my final loop&lt;pre class="ui-code" data-mode="text"&gt;static void main_loop(void)
{
    uint8_t enabled;
    uint16_t len;
    uint32_t result;
    for (;;)
    {
        indicate_data();        // when flag is set, a set of data is indicated. Flag reset in method
        main_wait();            // Contains the sd_app_evt_wait()
        while(true)
        {
            sd_softdevice_is_enabled(&amp;amp;enabled); // Don&amp;#39;t do this if disabled, for example when writing flash at the end
            if (enabled != 1)
            {
                break;
            }
            result = sd_ble_evt_get(NULL, &amp;amp;len);    // Get sixe of event
            if (result == NRF_ERROR_NOT_FOUND)      // If there aren&amp;#39;t any, go back to wait
            {
                break;
            }
            evt_buf = (uint8_t *)calloc(1, len);                // Make space for event
            result = sd_ble_evt_get((uint8_t *)evt_buf, &amp;amp;len);  // get the event
            if (result == NRF_SUCCESS)
            {
                ble_evt_t *evt = (ble_evt_t *)evt_buf;
                ble_evt_dispatch(evt);                          // dispatch event to handler
                NRF_LOG_PROCESS();                              // SHould I do this here to get a tighter display of log?
            }
            else                                                // Hopefully no error but just in case log it.
            {        
                #if (USE_DK == 1)
                NRF_LOG_DEBUG(&amp;quot;PENDING BLE Event return error: %u\r\n&amp;quot;, result);
                #endif
                free(evt_buf);  // Clean up
                break;          // back to wait
            }
            free(evt_buf);      // clean up and get the next event
        }
    }
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;I get an APP:ERROR:FATAL when I write to flash (pairing and bonding data) but the write succeeds. On a reconnect all the data is present and valid. This is the only scar remaining though it odes not affect performance. After the data is sent, the nrf51822 disconnects, disables SofDevice, writes to flash (only on a first time connect) and then has no more do.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;What is the proper way to shut down? Exit from the above loop?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: What is an Application Event?</title><link>https://devzone.nordicsemi.com/thread/290980?ContentTypeID=1</link><pubDate>Mon, 25 Jan 2021 10:36:28 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:27b52aac-b1f1-471a-b16d-c4ac8339c655</guid><dc:creator>Karl Ylvisaker</dc:creator><description>&lt;p&gt;Hello again brianreinhold,&lt;/p&gt;
[quote user="brianreinhold"]I have to reply here as this site is once again messing up and there is no reply button to the reply I need to reply to. One of these days this site will get fixed![/quote]
&lt;p&gt;I am sorry to hear that&amp;nbsp;your experience with the site&amp;nbsp;is not up to par - we&amp;#39;re continuously working on making the forum better, and I will submit this as an issue internally to be looked into.&lt;/p&gt;
[quote user="brianreinhold"]Just wanted to say all my problems were due to NRF_LOG_DEBUG. Printing a string that was too long I guess. Don&amp;#39;t know. But removing it solved all my issues. That aside, at least I know what an application event is.[/quote]
&lt;p&gt;Thank you for the update - I am happy to hear that you were able to identify and resolve all your issues!&lt;br /&gt;To limit the effects that the logger module has on your program you may want to use the&amp;nbsp;&lt;em&gt;deferred_logging&amp;nbsp;&lt;/em&gt;option of the logger. This will allow you to process loggings only when you have the time, and not where the call to NRF_LOG_DEBUG is actually made. You can see how this is implemented as part of most example&amp;#39;s&amp;nbsp;&lt;em&gt;idle_state_handler.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;&lt;/em&gt;Regarding your previous comment on the contradiction I am unfortunately still not seeing where my answer contradicts the documentation - you&amp;#39;re interpretation of my suggestion regarding the sending loop - retry if != NRF_SUCCESS is returned, wait for application layer ack before sending next - is correct.&lt;br /&gt;&lt;br /&gt;Please do not hesitate to open a new ticket if you should encounter any issues or questions in the future.&lt;br /&gt;&lt;br /&gt;Good luck with your development!&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Karl&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: What is an Application Event?</title><link>https://devzone.nordicsemi.com/thread/290879?ContentTypeID=1</link><pubDate>Sun, 24 Jan 2021 22:27:42 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:325babd8-c518-433c-8bd4-0aecce21f415</guid><dc:creator>brianreinhold</dc:creator><description>&lt;p&gt;I have to reply here as this site is once again messing up and there is no reply button to the reply I need to reply to. One of these days this site will get fixed!&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Just wanted to say all my problems were due to NRF_LOG_DEBUG. Printing a string that was too long I guess. Don&amp;#39;t know. But removing it solved all my issues. That aside, at least I know what an application event is.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: What is an Application Event?</title><link>https://devzone.nordicsemi.com/thread/290855?ContentTypeID=1</link><pubDate>Sat, 23 Jan 2021 14:13:46 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:20915bb1-83a7-40d9-b93f-976753bcb6b8</guid><dc:creator>brianreinhold</dc:creator><description>&lt;p&gt;Second reply.&lt;/p&gt;
&lt;p&gt;This is getting very frustrating as none of these approaches are working. They all hang, and due to the NRF LOG restrictions I cannot find what is hanging. The furthest I have been able to get was before I did all this &amp;#39;main thread&amp;#39; things and was just using the classic ble dispatch handler as used in the health device examples. I did a while loop on the sd_indicate method until not busy. I got as far as three indication sequences before hanging.&lt;/p&gt;
&lt;p&gt;So I am clearly missing a critical piece of information - I just don&amp;#39;t know what. I went and looked at the&amp;nbsp;void intern_softdevice_events_execute(void) handler in the softdevice_handler.c file to see if I could find some hints. This method dispatches events to my app if I register in the normal way. I see the&amp;nbsp;void intern_softdevice_events_execute(void) method is called by&amp;nbsp;void SOFTDEVICE_EVT_IRQHandler(void). However, the&amp;nbsp;&lt;span&gt;intern_softdevice_events_execute(void) enters an infinite loop and only exits if the user suspends the handler.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;I find this confusing as it seems like&amp;nbsp;SOFTDEVICE_EVT_IRQHandler(void) would be called several times and invoke the&amp;nbsp;intern_softdevice_events_execute(void) which is already in an infinite loop. I do not see any use of the&amp;nbsp;sd_app_evt_wait() method.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;There must be an easier way to do this; it&amp;#39;s such a basic need! Clearly one must face this need all the time; indicate a sequence of data! Is it best to go back to the standard approach used in the health device examples and figure out why the wait on busy loop freezes? I got further using that approach than doing anything else, and all just using sd_ calls.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;What happens if I invoke&amp;nbsp;sd_app_evt_wait() in more than one place? For example in the standard for(;;) loop all the examples use and after doing something like&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;    error_code = sd_ble_gatts_hvx(m_connection_handle, &amp;amp;hvx_params);
    sd_app_evt_wait();

&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: What is an Application Event?</title><link>https://devzone.nordicsemi.com/thread/290779?ContentTypeID=1</link><pubDate>Fri, 22 Jan 2021 14:29:24 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1ffe7b6f-9282-452e-8820-35e063a1c4c1</guid><dc:creator>brianreinhold</dc:creator><description>&lt;p&gt;I am calling from the main context (as suggested).&lt;/p&gt;
&lt;p&gt;THe contradiction I am talking about is that the message sequence does NOT do any retries. It simply calls the ble get event and then the wait. That&amp;#39;s not what the docs say. They say I need to re-call the ble get event method if I get an event. That is not present in the message sequence - it is not mentioned.&lt;/p&gt;
&lt;p&gt;So what you are saying is that I must do the loop on the get event until I get no more events before calling the wait (regardless of what the message sequence diagrams).&lt;/p&gt;
&lt;p&gt;So lets take a look at what you are suggesting:&lt;/p&gt;
&lt;p&gt;First I have an array of 200 bytes to indicate using an MTU of 23 so I get 20 bytes per indication.&lt;/p&gt;
&lt;p&gt;I call the sd method to send the indication&lt;/p&gt;
&lt;p&gt;now what I would like to is wait for the event indicating it was acked.&lt;/p&gt;
&lt;p&gt;If I get a busy, call again with no wait.&lt;/p&gt;
&lt;p&gt;If I get a success, wait for the ack event using the sd_wait and sd_ble get event methods in a loop unitl I get what I want, jump back to the outer loop where I send the next 20 bytes.&lt;/p&gt;
&lt;p&gt;Is this correct?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: What is an Application Event?</title><link>https://devzone.nordicsemi.com/thread/290765?ContentTypeID=1</link><pubDate>Fri, 22 Jan 2021 13:58:27 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e783c74a-f443-4464-b836-faab853ae1b1</guid><dc:creator>Karl Ylvisaker</dc:creator><description>&lt;p&gt;Hello,&lt;br /&gt;&lt;br /&gt;Thank you for your patience.&lt;/p&gt;
[quote user="brianreinhold"]But what you have said contradicts the information I am getting in another thread. If I get an NRF_ERROR_BUSY I need to try again. If I don&amp;#39;t it is as if that call was never made.[/quote]
&lt;p&gt;I am not exactly sure what contradicting information you are referring to, but it is correct that you will need to try again if you get an error - any returned error code != NRF_SUCCESS indicates that the returning function did not succeed for whatever reason, so if you intend to have that packet transferred it will need to be tried again - this is also written in the documentation I referenced. So, your assessment here is correct.&lt;br /&gt;If this is not the contradicting part, please elaborate on what I have said that contradicts prior information, so we could clear up any possible misunderstandings.&lt;/p&gt;
[quote user="brianreinhold"]Now ideally what I wanted to do&amp;nbsp; ( and did do in the pc-ble-driver) is make the&amp;nbsp;sd_ble_gatts_hvx()&amp;nbsp; call and wait on a semaphore. WHen I got the BLE_GATTS_EVT_HVC event, I released the semaphore. Worked great. No such tool here. So all the issues I am having are related to trying to simulate the functionality of a semaphore.[/quote]
&lt;p&gt;I see. Are you doing the sd_ble_gatts_hvx call as part of a interrupt handler or from the main context like suggested by my colleague Vidar in your other ticket? - if you are calling it from an interrupt handler, what is the priority of this interrupt configured to?&lt;br /&gt;My suggestion here would be close to what Vidar already has suggested for you - if you receive a BUSY error, place the indication in a queue and wait for the BLE_GATTS_EVT_HVC after which you try it again. This should work, but you will also have to ensure that there is no pile-up of unsent indications by checking the the rate of new indications vs. the rate of indications going through. Since the indication requires an application level ACK it will at least be 1 full connection interval until this is received.&lt;/p&gt;
[quote user="brianreinhold"]OH, by the way, when I say I am not using the SDK, I mean I am using sd_* calls for all BLE functionality and anything else that I can do (flash writing for example).[/quote]
&lt;p&gt;&amp;nbsp;Thank you for clarifying.&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Karl&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: What is an Application Event?</title><link>https://devzone.nordicsemi.com/thread/290241?ContentTypeID=1</link><pubDate>Wed, 20 Jan 2021 12:35:26 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:eb8cb9c0-a85a-478c-b883-523e9bedaa27</guid><dc:creator>brianreinhold</dc:creator><description>&lt;p&gt;Karl, I am doing the classic &amp;#39;busy&amp;#39; loop when calling the&amp;nbsp;&lt;span&gt;sd_ble_gatts_hvx(). I am discussing that in another thread. But what you have said contradicts the information I am getting in another thread. If I get an NRF_ERROR_BUSY I need to try again. If I don&amp;#39;t it is as if that call was never made.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Now ideally what I wanted to do&amp;nbsp; ( and did do in the pc-ble-driver) is make the&amp;nbsp;sd_ble_gatts_hvx()&amp;nbsp; call and wait on a semaphore. WHen I got the BLE_GATTS_EVT_HVC event, I released the semaphore. Worked great. No such tool here. So all the issues I am having are related to trying to simulate the functionality of a semaphore.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;OH, by the way, when I say I am not using the SDK, I mean I am using sd_* calls for all BLE functionality and anything else that I can do (flash writing for example).&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;The other thread is&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/70569/how-to-send-a-sequence-of-indications"&gt;https://devzone.nordicsemi.com/f/nordic-q-a/70569/how-to-send-a-sequence-of-indications&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;That&amp;#39;s how application events came up and I could not get a clear answer on what they were. In the end it appears to be any event that is passed up to my application.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: What is an Application Event?</title><link>https://devzone.nordicsemi.com/thread/290227?ContentTypeID=1</link><pubDate>Wed, 20 Jan 2021 11:40:12 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:49ac0f58-512f-42d4-a30d-109d8ceea940</guid><dc:creator>Karl Ylvisaker</dc:creator><description>[quote user="brianreinhold"]First I am not using the SDK for any Bluetooth, but only SoftDevice[/quote]
&lt;p&gt;What do you mean by this exactly, do you mean that you are only using the SoftDevice API from the SDK?&lt;/p&gt;
[quote user="brianreinhold"]but mainly that I am working with the BT SIG Med group to define a&amp;nbsp;single generic health device standard that can be used for all devices.[/quote]
&lt;p&gt;Thank you for clarifying.&lt;/p&gt;
[quote user="brianreinhold"]Also I am using the pc-ble-driver for the same purpose.[/quote]
&lt;p&gt;Please be advised that the pc-ble-driver only exposes a subset of the available SoftDevice API.&lt;/p&gt;
[quote user="brianreinhold"]I have another posted thread on this site about that. But in that thread and in the documentation there are endless references to &amp;#39;application event&amp;#39; without ever defining what that was.[/quote]
&lt;p&gt;I see. If any part of an answer you receive from us should be unclear, please do not hesitate to let us know and we will do our best to elaborate on it.&lt;/p&gt;
[quote user="brianreinhold"]Right now when I do a while loop on the sd_ble_gatts_hvx() call and the NRF_ERROR_BUSY it hangs after about three indications. I am calling the method from a timer started in the ble event handler.[/quote]
&lt;p&gt;Could you elaborate on what you mean when you say that it hangs after three indications? Does it return a different error code after three indications - if so, which?&lt;br /&gt;Could you also confirm for me that the device is receiving a response to its indications? The device may not proceed from an indication before receiving an ACK.&lt;br /&gt;&lt;br /&gt;An exempt from the sd_ble_gatts_hvx doumentation reads:&lt;/p&gt;
&lt;table&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td colspan="1" rowspan="1"&gt;&lt;a title="Busy." href="https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.s140.api.v7.0.1/group__nrf__error.html#ga5d2d8608f6d6a0329f58961a969e946e"&gt;NRF_ERROR_BUSY&lt;/a&gt;&lt;/td&gt;
&lt;td colspan="1" rowspan="1"&gt;For&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;a href="https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.s140.api.v7.0.1/group___b_l_e___g_a_t_t___h_v_x___t_y_p_e_s.html#ga47f3222bcefb5eb4aed9a1dc7c796b1f"&gt;BLE_GATT_HVX_INDICATION&lt;/a&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;Procedure already in progress. Wait for a&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;a href="https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.s140.api.v7.0.1/group___b_l_e___g_a_t_t_s___e_n_u_m_e_r_a_t_i_o_n_s.html#ggae537647902af1b05c1e32f12d6b401c7af6a065c5c7e0682989ddd6cc557e0ffa"&gt;BLE_GATTS_EVT_HVC&lt;/a&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;event and retry.&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;Please have a look at &lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/99/notification-indication-difference"&gt;the excellent answer by my colleague Håkon in this ticket, where he details the difference between notifications and indications&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Karl&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: What is an Application Event?</title><link>https://devzone.nordicsemi.com/thread/290029?ContentTypeID=1</link><pubDate>Tue, 19 Jan 2021 14:09:51 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b70d0bd7-ed23-439b-b1d8-8ba1fd33b352</guid><dc:creator>brianreinhold</dc:creator><description>&lt;p&gt;First I am not using the SDK for any Bluetooth, but only SoftDevice, I have several good reasons for that, but mainly that I am working with the BT SIG Med group to define a&amp;nbsp;single generic health device standard that can be used for all devices. Also I am using the pc-ble-driver for the same purpose. (Here I am writing for the nRF51822 to use on a real device.) Nice to have the two as similar as possible.&lt;/p&gt;
&lt;p&gt;The problem I am trying to solve is the simulation of a semaphore. I have a characteristic value that is several MTUs long, so I indicate, need to wait for the response event, and repeat. The start of the sequence is given when the peer writes a command to do so. I have another posted thread on this site about that. But in that thread and in the documentation there are endless references to &amp;#39;application event&amp;#39; without ever defining what that was.&lt;/p&gt;
&lt;p&gt;Thus this post to get a straight concrete answer so I can move forward and have a better understand of what my options are. Being able to &amp;#39;indicate&amp;#39; long characteristic values is central to this standard. Right now when I do a while loop on the sd_ble_gatts_hvx() call and the NRF_ERROR_BUSY it hangs after about three indications. I am calling the method from a timer started in the ble event handler.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: What is an Application Event?</title><link>https://devzone.nordicsemi.com/thread/290010?ContentTypeID=1</link><pubDate>Tue, 19 Jan 2021 13:05:24 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:271f1b66-d77b-4f1c-aa76-6a3fa29b4a0c</guid><dc:creator>Karl Ylvisaker</dc:creator><description>&lt;p&gt;Hello,&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;
[quote user=""]I write the application but I clearly do not define these events. Initially I assumed they were events I defined and I could use them with &lt;span&gt;sd_app_evt_wait(). Alas that is not the case.&lt;/span&gt;[/quote]
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/6945/tasks-events-and-registers"&gt;Please see the answer by my colleague Susheel in this ticket&lt;/a&gt;.&lt;/p&gt;
[quote user=""]&lt;p&gt;&lt;span&gt;So what is an application event?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;All events received by my application?&lt;/span&gt;&lt;/p&gt;[/quote]
&lt;p&gt;In essence, yes. Application events are the subset of all the possible events, that is passed to the application - for instance, many of the events are only used by the SoftDevice, and thus not forwarded to the Application layer.&lt;br /&gt;You may use the &lt;a href="https://infocenter.nordicsemi.com/index.jsp?topic=%2Fsdk_nrf5_v17.0.2%2Fgroup__nrf__sdh__ble.html&amp;amp;anchor=gad162c1f4d4c248e4d4567dfa70e0e10e"&gt;NRF_SDH_BLE_OBSERVER&lt;/a&gt; macro to forward BLE events to handlers in your application.&lt;/p&gt;
[quote user=""]I might be able to use&amp;nbsp;sd_app_evt_wait() to support semaphore-like behavior that I really need.[/quote]
&lt;p&gt;Could you elaborate on exactly what this behavior you are looking for is?&lt;br /&gt;Are you developing with the nRF5 SDK, or nRF Connect SDK? In the case of the latter you should know that &lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/zephyr/reference/kernel/synchronization/semaphores.html"&gt;Zephyr is an RTOS that already provide this for you&lt;/a&gt;.&lt;/p&gt;
[quote user=""]I guess while your at it, can you tell me what application interrupts are? These sound more like interrupts I define unlike application events.[/quote]
&lt;p&gt;The explanation here is the same as for the application events - the application interrupts are the subset of interrupts which are passed to and handled by the application.&lt;br /&gt;An example of this would be a TIMER instance that you setup to periodically trigger an interrupt in your application - this is an application interrupt.&lt;br /&gt;An example of a &amp;#39;non-application interrupt&amp;#39; would be the SoftDevice&amp;#39;s own timers interrupt, which are never seen by the application.&lt;br /&gt;&lt;br /&gt;Please let me know if anything should still be unclear, or if you encounter any other issues or questions.&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Karl&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>