<?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>ATT_MTU_Throughput how does NRF_ERROR_RESOURCES work?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/50364/att_mtu_throughput-how-does-nrf_error_resources-work</link><description>Hi, 
 I am trying to understand one thing about the att_mtu_throughput example. 
 What it does in the char_notification_send() function, which is shown below, is that if it has not sent 1Mbits yet, it tries to send some random data, and increments the</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 31 Jul 2019 10:37:53 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/50364/att_mtu_throughput-how-does-nrf_error_resources-work" /><item><title>RE: ATT_MTU_Throughput how does NRF_ERROR_RESOURCES work?</title><link>https://devzone.nordicsemi.com/thread/201505?ContentTypeID=1</link><pubDate>Wed, 31 Jul 2019 10:37:53 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5b116c3b-9126-4517-91ba-bd0ceea5206b</guid><dc:creator>Den</dc:creator><description>&lt;p&gt;So once busy = true is set, it waits for the &lt;span&gt;BLE_GATTS_EVT_HVN_TX_COMPLETE event&amp;nbsp;&lt;/span&gt;in sleep. Now it makes sense. I missed&amp;nbsp;that bit. Thanks very much for the clarification Einar&lt;span class="emoticon" data-url="https://devzone.nordicsemi.com/cfs-file/__key/system/emoji/1f44d.svg" title="Thumbsup"&gt;&amp;#x1f44d;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: ATT_MTU_Throughput how does NRF_ERROR_RESOURCES work?</title><link>https://devzone.nordicsemi.com/thread/201415?ContentTypeID=1</link><pubDate>Wed, 31 Jul 2019 07:15:58 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ce12408c-448d-4ef0-a613-612b199ade6d</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
[quote user="Denin"]The thing I do not understand is; when we set busy = true and get out of the while loop, the code has to wait somewhere until&amp;nbsp;&lt;span&gt;BLE_GATTS_EVT_HVN_TX_COMPLETE&amp;nbsp;event occurs and on_tx_complete() is called, is this right? Where does it wait?&lt;/span&gt;[/quote]
&lt;p&gt;There is no special logic needed for waiting in this case, since the BLE stack is event-driven. It just sets the busy flag to true, and breaks out of the loop, and then out of the&amp;nbsp;char_notification_send(). Then the&amp;nbsp;char_notification_send() is called again in the handling of the&amp;nbsp;BLE_GATTS_EVT_HVN_TX_COMPLETE only if busy is true.&lt;/p&gt;
&lt;p&gt;After all interrupts are services and nothing else happens, then the main loop will run, which calls&amp;nbsp;idle_state_handle() in main.c of the example. Essentially it will just put the CPU to sleep in this case, waiting for an event/interrupt.&lt;/p&gt;
&lt;p&gt;In detail:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;static void idle_state_handle(void)
{
    cli_process();

    if (is_test_ready())
    {
        NRF_LOG_INFO(&amp;quot;Test started&amp;quot;);
        m_run_test = true;
        test_run();
    }

    if (NRF_LOG_PROCESS() == false)
    {
        nrf_pwr_mgmt_run();
    }
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;If a current test is in progress (which will be the case here), then&amp;nbsp;m_run_test is true, so&amp;nbsp;is_test_ready() will return false. Therefore the only thing that happens is first processing of CLI (if needed), then processing of logs if needed. Then the CPU enters sleep by calling&amp;nbsp;nrf_pwr_mgmt_run().&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: ATT_MTU_Throughput how does NRF_ERROR_RESOURCES work?</title><link>https://devzone.nordicsemi.com/thread/201291?ContentTypeID=1</link><pubDate>Tue, 30 Jul 2019 13:58:27 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6909bd0e-bf6d-4882-a6cd-64885181161c</guid><dc:creator>Den</dc:creator><description>&lt;p&gt;Hi Einer,&lt;/p&gt;
&lt;p&gt;I guess I mentioned this loop stuff myself in my question already :) The thing I do not understand is; when we set busy = true and get out of the while loop, the code has to wait somewhere until&amp;nbsp;&lt;span&gt;BLE_GATTS_EVT_HVN_TX_COMPLETE&amp;nbsp;event occurs and on_tx_complete() is called, is this right? Where does it wait?&lt;/span&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: ATT_MTU_Throughput how does NRF_ERROR_RESOURCES work?</title><link>https://devzone.nordicsemi.com/thread/201284?ContentTypeID=1</link><pubDate>Tue, 30 Jul 2019 13:48:40 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:de9764fb-f4b7-4c0d-8fee-3614844e695e</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;The BLE stack and SDK are event-based, so the&amp;nbsp;BLE_GATTS_EVT_HVN_TX_COMPLETE will be received by the BLE event handlers. In the&amp;nbsp;ATT_MTU_Throughput example in SDK 15.3 this is implemented in&amp;nbsp;examples\ble_central_and_peripheral\experimental\ble_app_att_mtu_throughput\amts.c. There you can see that a&amp;nbsp;BLE_GATTS_EVT_HVN_TX_COMPLETE event causes a call to&amp;nbsp;on_tx_complete(), which calls&amp;nbsp;char_notification_send() if the busy flag was set. And then we are back in the loop&amp;nbsp;&lt;span class="emoticon" data-url="https://devzone.nordicsemi.com/cfs-file/__key/system/emoji/1f642.svg" title="Slight smile"&gt;&amp;#x1f642;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>