Skip to content

Commit 61effca

Browse files
committed
nRF52: bootloader asks for connection interval 7.5->30ms now, not just 15ms. Should improve DFU on iOS 16 which doesn't honour 15ms request
1 parent 0f3111d commit 61effca

File tree

5 files changed

+134
-111
lines changed

5 files changed

+134
-111
lines changed

ChangeLog

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
Ensure eval("1;;;")==1 - eval("1;")==1 before, but not eval("1;;")
77
Ensure AssignmentExpr returns the value of LHS, not the LHS. `(a=2)=3` now fails (as per spec)
88
Ensure default args for arrow functions fail with error `(a,b=3)=>a+b` now fails (until default args get added)
9+
nRF52: bootloader asks for connection interval 7.5->30ms now, not just 15ms. Should improve DFU on iOS 16 which doesn't honour 15ms request
910

1011
2v19 : Fix Object.values/entries for numeric keys after 2v18 regression (fix #2375)
1112
nRF52: for SD>5 use static buffers for advertising and scan response data (#2367)

targetlibs/nrf5x_12/components/libraries/bootloader/ble_dfu/nrf_ble_dfu.c

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,30 @@
11
/**
22
* Copyright (c) 2016 - 2017, Nordic Semiconductor ASA
3-
*
3+
*
44
* All rights reserved.
5-
*
5+
*
66
* Redistribution and use in source and binary forms, with or without modification,
77
* are permitted provided that the following conditions are met:
8-
*
8+
*
99
* 1. Redistributions of source code must retain the above copyright notice, this
1010
* list of conditions and the following disclaimer.
11-
*
11+
*
1212
* 2. Redistributions in binary form, except as embedded into a Nordic
1313
* Semiconductor ASA integrated circuit in a product or a software update for
1414
* such product, must reproduce the above copyright notice, this list of
1515
* conditions and the following disclaimer in the documentation and/or other
1616
* materials provided with the distribution.
17-
*
17+
*
1818
* 3. Neither the name of Nordic Semiconductor ASA nor the names of its
1919
* contributors may be used to endorse or promote products derived from this
2020
* software without specific prior written permission.
21-
*
21+
*
2222
* 4. This software, with or without modification, must only be used with a
2323
* Nordic Semiconductor ASA integrated circuit.
24-
*
24+
*
2525
* 5. Any software provided in binary form under this license must not be reverse
2626
* engineered, decompiled, modified and/or disassembled.
27-
*
27+
*
2828
* THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
2929
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
3030
* OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
@@ -35,7 +35,7 @@
3535
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
3636
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
3737
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
38-
*
38+
*
3939
*/
4040

4141
#include "nrf_ble_dfu.h"
@@ -143,7 +143,7 @@ static uint32_t conn_params_init(void)
143143
/**@brief Function for the Advertising functionality initialization.
144144
*
145145
* @details Encodes the required advertising data and passes it to the stack.
146-
* The advertising data encoded here is specific for DFU.
146+
* The advertising data encoded here is specific for DFU.
147147
* Setting advertising data can by done by calling @ref ble_advdata_set.
148148
*/
149149
static uint32_t advertising_init(uint8_t adv_flags)
@@ -154,12 +154,12 @@ static uint32_t advertising_init(uint8_t adv_flags)
154154
uint16_t actual_device_name_length = max_device_name_length;
155155

156156
uint8_t p_encoded_advdata[MAX_ADV_DATA_LENGTH];
157-
157+
158158
// Encode flags.
159159
p_encoded_advdata[0] = 0x2;
160160
p_encoded_advdata[1] = BLE_GAP_AD_TYPE_FLAGS;
161161
p_encoded_advdata[2] = adv_flags;
162-
162+
163163
// Encode 'more available' uuid list.
164164
p_encoded_advdata[3] = 0x3;
165165
p_encoded_advdata[4] = BLE_GAP_AD_TYPE_16BIT_SERVICE_UUID_MORE_AVAILABLE;
@@ -172,7 +172,7 @@ static uint32_t advertising_init(uint8_t adv_flags)
172172
{
173173
return err_code;
174174
}
175-
175+
176176
// Set GAP device in advertising data.
177177
if (actual_device_name_length <= max_device_name_length)
178178
{
@@ -524,7 +524,7 @@ static bool on_rw_authorize_req(ble_dfu_t * p_dfu, ble_evt_t * p_ble_evt)
524524
ble_gatts_rw_authorize_reply_params_t auth_reply = {0};
525525
ble_gatts_evt_rw_authorize_request_t * p_authorize_request;
526526
ble_gatts_evt_write_t * p_ble_write_evt;
527-
527+
528528
p_authorize_request = &(p_ble_evt->evt.gatts_evt.params.authorize_request);
529529
p_ble_write_evt = &(p_ble_evt->evt.gatts_evt.params.authorize_request.request.write);
530530

@@ -544,7 +544,7 @@ static bool on_rw_authorize_req(ble_dfu_t * p_dfu, ble_evt_t * p_ble_evt)
544544
{
545545
// Send an error response to the peer indicating that the CCCD is improperly configured.
546546
auth_reply.params.write.gatt_status = BLE_GATT_STATUS_ATTERR_CPS_CCCD_CONFIG_ERROR;
547-
547+
548548
// Ignore response of auth reply
549549
(void)sd_ble_gatts_rw_authorize_reply(m_conn_handle, &auth_reply);
550550
return false;
@@ -660,9 +660,9 @@ static void on_ble_evt(ble_evt_t * p_ble_evt)
660660
{
661661
if (on_rw_authorize_req(&m_dfu, p_ble_evt))
662662
{
663-
err_code = on_ctrl_pt_write(&m_dfu,
663+
err_code = on_ctrl_pt_write(&m_dfu,
664664
&(p_ble_evt->evt.gatts_evt.params.authorize_request.request.write));
665-
#ifdef NRF_DFU_DEBUG_VERSION
665+
#ifdef NRF_DFU_DEBUG_VERSION
666666
if (err_code != NRF_SUCCESS)
667667
{
668668
NRF_LOG_ERROR("Could not handle on_ctrl_pt_write. err_code: 0x%04x\r\n", err_code);
@@ -684,19 +684,19 @@ static void on_ble_evt(ble_evt_t * p_ble_evt)
684684
err_code = sd_ble_gatts_sys_attr_set(p_ble_evt->evt.gap_evt.conn_handle, NULL, 0, 0);
685685
APP_ERROR_CHECK(err_code);
686686
break;
687-
687+
688688
case BLE_GATTS_EVT_WRITE:
689689
on_write(&m_dfu, p_ble_evt);
690690
break;
691691

692692
#if (NRF_SD_BLE_API_VERSION == 3)
693693
case BLE_GATTS_EVT_EXCHANGE_MTU_REQUEST:
694-
err_code = sd_ble_gatts_exchange_mtu_reply(p_ble_evt->evt.gatts_evt.conn_handle,
694+
err_code = sd_ble_gatts_exchange_mtu_reply(p_ble_evt->evt.gatts_evt.conn_handle,
695695
NRF_BLE_MAX_MTU_SIZE);
696696
APP_ERROR_CHECK(err_code);
697697
break; // BLE_GATTS_EVT_EXCHANGE_MTU_REQUEST
698698
#endif
699-
699+
700700
default:
701701
// No implementation needed.
702702
break;
@@ -771,8 +771,8 @@ static uint32_t gap_params_init(void)
771771
strlen(DEVICE_NAME));
772772
VERIFY_SUCCESS(err_code);
773773

774-
gap_conn_params.min_conn_interval = MIN_CONN_INTERVAL;
775-
gap_conn_params.max_conn_interval = MAX_CONN_INTERVAL;
774+
gap_conn_params.min_conn_interval = NRF_DFU_BLE_MIN_CONN_INTERVAL;
775+
gap_conn_params.max_conn_interval = NRF_DFU_BLE_MAX_CONN_INTERVAL;
776776
gap_conn_params.slave_latency = SLAVE_LATENCY;
777777
gap_conn_params.conn_sup_timeout = CONN_SUP_TIMEOUT;
778778

@@ -809,8 +809,8 @@ static uint32_t ble_stack_init(bool init_softdevice)
809809

810810
#if (NRF_SD_BLE_API_VERSION == 3)
811811
ble_enable_params.gatt_enable_params.att_mtu = NRF_BLE_MAX_MTU_SIZE;
812-
#endif
813-
812+
#endif
813+
814814
// Enable BLE stack.
815815
err_code = softdevice_enable(&ble_enable_params);
816816
return err_code;

targets/nrf5x/bluetooth.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -923,6 +923,7 @@ nrf_log_module_dynamic_data_t NRF_LOG_MODULE_DATA_DYNAMIC = {
923923

924924
/// Function for handling an event from the Connection Parameters Module.
925925
static void on_conn_params_evt(ble_conn_params_evt_t * p_evt) {
926+
// Either BLE_CONN_PARAMS_EVT_FAILED or BLE_CONN_PARAMS_EVT_SUCCEEDED - that's it
926927
}
927928

928929
/// Sigh - NFC has lots of these, so we need to define it to build

0 commit comments

Comments
 (0)