<?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>nRF52840 and s340: can BLE and ANT+ be used to send data at the same time?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/58641/nrf52840-and-s340-can-ble-and-ant-be-used-to-send-data-at-the-same-time</link><description>I&amp;#39;m experimenting with multiprotocol support on a PCA10056 (nRF52840) and the S340 softdevice. I need to use BLE and ANT+ at the same time, sending data to either ANT+ or BLE sport receivers. 
 I&amp;#39;m using SDK15.3 and the S340 6.1.1 softdevice 
 I have</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 05 Mar 2020 17:17:25 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/58641/nrf52840-and-s340-can-ble-and-ant-be-used-to-send-data-at-the-same-time" /><item><title>RE: nRF52840 and s340: can BLE and ANT+ be used to send data at the same time?</title><link>https://devzone.nordicsemi.com/thread/238386?ContentTypeID=1</link><pubDate>Thu, 05 Mar 2020 17:17:25 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8f159667-78a2-45cd-b97a-5f08a61de34a</guid><dc:creator>robca</dc:creator><description>&lt;p&gt;Thanks Kenneth,&lt;/p&gt;
&lt;p&gt;I was using the same code as in the&amp;nbsp;&lt;span&gt;ble_ant_app_hrm_pca10056_s340 example, as per below&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Since all the examples I saw were asserting on&amp;nbsp;NRF_ERROR_BUSY returned by&amp;nbsp;sd_ble_gap_phy_update(), I was not sure if it was safe to retry.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;I will implement appropriate retry logic, thanks for confirming that what I&amp;#39;m going is safe (also, re-reading more of the softdevice documentation, and the softdevice is already written to allow BLE and ANT+ to coexist, the cocnurrent multiprotocol/radio timeslot is only for proprietary implementations)&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Do you know why there is no S340 documentation, outside of the list of APIs? All other softdevices are much better documented&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;/**@brief Function for handling BLE events.
 *
 * @param[in]   p_ble_evt   Bluetooth stack event.
 * @param[in]   p_context   Unused.
 */
static void ble_evt_handler(ble_evt_t const * p_ble_evt, void * p_context)
{
    ret_code_t err_code = NRF_SUCCESS;

    switch (p_ble_evt-&amp;gt;header.evt_id)
    {
        case BLE_GAP_EVT_CONNECTED:
            NRF_LOG_INFO(&amp;quot;Connected&amp;quot;);
            err_code = bsp_indication_set(BSP_INDICATE_CONNECTED);
            APP_ERROR_CHECK(err_code);
            m_conn_handle = p_ble_evt-&amp;gt;evt.gap_evt.conn_handle;
            err_code = nrf_ble_qwr_conn_handle_assign(&amp;amp;m_qwr, m_conn_handle);
            APP_ERROR_CHECK(err_code);
            break;

        case BLE_GAP_EVT_DISCONNECTED:
            NRF_LOG_INFO(&amp;quot;Disconnected&amp;quot;);
            m_conn_handle = BLE_CONN_HANDLE_INVALID;
            break;

        case BLE_GAP_EVT_PHY_UPDATE_REQUEST:
        {
            NRF_LOG_DEBUG(&amp;quot;PHY update request.&amp;quot;);
            ble_gap_phys_t const phys =
            {
                .rx_phys = BLE_GAP_PHY_AUTO,
                .tx_phys = BLE_GAP_PHY_AUTO,
            };
            err_code = sd_ble_gap_phy_update(p_ble_evt-&amp;gt;evt.gap_evt.conn_handle, &amp;amp;phys);
            APP_ERROR_CHECK(err_code);
        } break;

        case BLE_GATTC_EVT_TIMEOUT:
            // Disconnect on GATT Client timeout event.
            NRF_LOG_DEBUG(&amp;quot;GATT Client Timeout.&amp;quot;);
            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;

        case BLE_GATTS_EVT_TIMEOUT:
            // Disconnect on GATT Server timeout event.
            NRF_LOG_DEBUG(&amp;quot;GATT Server Timeout.&amp;quot;);
            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;

        default:
            // No implementation needed.
            break;
    }
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52840 and s340: can BLE and ANT+ be used to send data at the same time?</title><link>https://devzone.nordicsemi.com/thread/238203?ContentTypeID=1</link><pubDate>Thu, 05 Mar 2020 09:22:39 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8d35499e-3618-43f7-a29f-352b1d72a456</guid><dc:creator>Kenneth</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;NRF_ERROR_BUSY is not really a critical error that you need to assert on. It basically means busy, try again later (for instance due to an on-going procedure that need to complete before you can execute this one). I don&amp;#39;t know which softdevice call you are trying that is returning this error, but my suggestion is to for instance try again in a while loop (as it seems you are doing) or start an app_timer single shot that try again for instance in 100ms.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;br /&gt;Kenneth&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52840 and s340: can BLE and ANT+ be used to send data at the same time?</title><link>https://devzone.nordicsemi.com/thread/237889?ContentTypeID=1</link><pubDate>Tue, 03 Mar 2020 22:03:55 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7bafedae-4c5d-4627-8532-e19e23134f4e</guid><dc:creator>robca</dc:creator><description>&lt;p&gt;Quick update. I temporarily worked around the issue adding&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;while (sd_ble_gap_phy_update(p_ble_evt-&amp;gt;evt.gap_evt.conn_handle, &amp;amp;phys) != NRF_SUCCESS) 
{}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;in ble_evt_handler(), as per below. I&amp;#39;m not sure, though, if it&amp;#39;s an acceptable workaround, and the&amp;nbsp;ble_ant_app_hrm_pca10056_s340 example doesn&amp;#39;t seem to need this workaround (granted, it looks as if in that case the ANT+ stack is not actively used while waiting for the BLE connection)&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;        case BLE_GAP_EVT_PHY_UPDATE_REQUEST:
        {
            NRF_LOG_DEBUG(&amp;quot;PHY update request.&amp;quot;);
            ble_gap_phys_t const phys =
            {
                .rx_phys = BLE_GAP_PHY_AUTO,
                .tx_phys = BLE_GAP_PHY_AUTO,
            };
            while (sd_ble_gap_phy_update(p_ble_evt-&amp;gt;evt.gap_evt.conn_handle, &amp;amp;phys) != NRF_SUCCESS)
            {}
        } break;&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;After this hack, everything seems to work well, and I can receive BLE and ANT+ data at the same time&lt;/p&gt;
&lt;p&gt;Any recommendations on how safe the hack is? I&amp;#39;m still struggling to understand how BLE and ANT+ coexist in S340&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>