This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

S112 Soft Device and BLE LESC

The S112 soft device and the nRF52810 datasheet both advertise support for BLE LESC, so I think it's reasonable to assume that it should work.  However, none of the example sdk_config.h for the S112 even contain BLE_LESC_ENABLED, let alone with any value.  (I solved this by adding the attribute, but if I edit with the CMSIS tool, I'm afraid it will revert my change.)

Additionally, the ble_lesc.c file in the SDK cannot compile with the S112 headers, as the S112 does not support the GAP Central role but the ble_lesc.c file looks for defines based on this.  Applying this tiny patch (based on styles used elsewhere in the BLE portion of the SDK) seems to make things compile correctly, but I'd love to know if there's another way I should be doing this.

--- ble_lesc.c.orig	2018-05-13 17:05:25.856517040 -0700
+++ ble_lesc.c	2018-05-13 17:06:31.419426644 -0700
@@ -238,6 +238,7 @@
  *
  * @retval 
  */
+#if !defined (S112)
 static ret_code_t ble_lesc_peer_central_public_key_set(
     uint16_t conn_handle, 
     ble_gap_lesc_p256_pk_t const * const p_public_key)
@@ -276,7 +277,7 @@
 
     return NRF_SUCCESS;
 }
-
+#endif  // !defined (S112)
 
 /**@brief BLE event handler for LESC DHKEY requests
  */
@@ -295,12 +296,15 @@
             ble_gap_lesc_p256_pk_t const * p_pk_peer = 
                 p_ble_evt->evt.gap_evt.params.lesc_dhkey_request.p_pk_peer;
         
+#if !defined (S112)
             if (role == BLE_GAP_ROLE_CENTRAL)
             {        
                 err_code = ble_lesc_peer_central_public_key_set(conn_handle, 
                                                                 p_pk_peer);
             }
-            else if (role == BLE_GAP_ROLE_PERIPH)
+            else
+#endif // !defined (S112)
+            if (role == BLE_GAP_ROLE_PERIPH)
             {
                 err_code = ble_lesc_peer_peripheral_public_key_set(conn_handle, 
                                                                    p_pk_peer);

Related