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

ble_app_hrs_freertos Increassing MTU Fatal error

Hi,

Using SDK 15.3.0 , example "ble_app_hrs_freertos", pca10040 with armgcc.

I want to increase MTU and GAP data length.

I started with MTU to 247, and when I try to connect, on log :

<debug> nrf_sdh_freertos: Creating a SoftDevice task.
<info> app: HRS FreeRTOS example started.
<debug> nrf_sdh_freertos: Enter softdevice_task.
<info> app: Fast advertising.
<error> hardfault: HARD FAULT at 0x0002C004
<error> hardfault:   R0:  0x20008214  R1:  0x002A821C  R2:  0x20008214  R3:  0x20008208
<error> hardfault:   R12: 0x00000000  LR:  0x0002AAF1  PSR: 0x8100020E
<error> hardfault: Cause: Data bus error (PC value stacked for the exception return points to the instruction that caused the fault).
<error> hardfault: Bus Fault Address: 0x002A8228

The modifications I have done to the code are :

diff --git a/config/FreeRTOSConfig.h b/config/FreeRTOSConfig.h
index ae2167d..6dee317 100644
--- a/config/FreeRTOSConfig.h
+++ b/config/FreeRTOSConfig.h
@@ -63,7 +63,7 @@
 #define configTICK_RATE_HZ                                                        1024
 #define configMAX_PRIORITIES                                                      ( 3 )
 #define configMINIMAL_STACK_SIZE                                                  ( 60 )
-#define configTOTAL_HEAP_SIZE                                                     ( 4096 )
+#define configTOTAL_HEAP_SIZE                                                     ( 8192 )
 #define configMAX_TASK_NAME_LEN                                                   ( 4 )
 #define configUSE_16_BIT_TICKS                                                    0
 #define configIDLE_SHOULD_YIELD                                                   1
diff --git a/pca10040/s132/config/sdk_config.h b/pca10040/s132/config/sdk_config.h
index 8edaaed..715d28d 100644
--- a/pca10040/s132/config/sdk_config.h
+++ b/pca10040/s132/config/sdk_config.h
@@ -39,6 +39,9 @@
  */


+#ifndef DEBUG
+#define DEBUG 1
+#endif

 #ifndef SDK_CONFIG_H
 #define SDK_CONFIG_H
@@ -7432,7 +7435,7 @@
 // <e> NRF_LOG_BACKEND_RTT_ENABLED - nrf_log_backend_rtt - Log RTT backend
 //==========================================================
 #ifndef NRF_LOG_BACKEND_RTT_ENABLED
-#define NRF_LOG_BACKEND_RTT_ENABLED 0
+#define NRF_LOG_BACKEND_RTT_ENABLED 1
 #endif
 // <o> NRF_LOG_BACKEND_RTT_TEMP_BUFFER_SIZE - Size of buffer for partially processed strings.
 // <i> Size of the buffer is a trade-off between RAM usage and processing.
@@ -7465,7 +7468,7 @@
 // <e> NRF_LOG_BACKEND_UART_ENABLED - nrf_log_backend_uart - Log UART backend
 //==========================================================
 #ifndef NRF_LOG_BACKEND_UART_ENABLED
-#define NRF_LOG_BACKEND_UART_ENABLED 1
+#define NRF_LOG_BACKEND_UART_ENABLED 0
 #endif
 // <o> NRF_LOG_BACKEND_UART_TX_PIN - UART TX pin
 #ifndef NRF_LOG_BACKEND_UART_TX_PIN
@@ -7582,7 +7585,7 @@
 // <4=> Debug

 #ifndef NRF_LOG_DEFAULT_LEVEL
-#define NRF_LOG_DEFAULT_LEVEL 3
+#define NRF_LOG_DEFAULT_LEVEL 4
 #endif

 // <q> NRF_LOG_DEFERRED  - Enable deffered logger.
@@ -7632,7 +7635,7 @@
 // <e> NRF_LOG_USES_COLORS - If enabled then ANSI escape code for colors is prefixed to every string
 //==========================================================
 #ifndef NRF_LOG_USES_COLORS
-#define NRF_LOG_USES_COLORS 0
+#define NRF_LOG_USES_COLORS 1
 #endif
 // <o> NRF_LOG_COLOR_DEFAULT  - ANSI escape code prefix.

@@ -11069,12 +11072,12 @@

 // <o> NRF_SDH_BLE_GATT_MAX_MTU_SIZE - Static maximum MTU size.
 #ifndef NRF_SDH_BLE_GATT_MAX_MTU_SIZE
-#define NRF_SDH_BLE_GATT_MAX_MTU_SIZE 23
+#define NRF_SDH_BLE_GATT_MAX_MTU_SIZE 247
 #endif

 // <o> NRF_SDH_BLE_GATTS_ATTR_TAB_SIZE - Attribute Table size in bytes. The size must be a multiple of 4.
 #ifndef NRF_SDH_BLE_GATTS_ATTR_TAB_SIZE
-#define NRF_SDH_BLE_GATTS_ATTR_TAB_SIZE 1408
+#define NRF_SDH_BLE_GATTS_ATTR_TAB_SIZE 2000
 #endif

 // <o> NRF_SDH_BLE_VS_UUID_COUNT - The number of vendor-specific UUIDs.

I also modified "nrf_sdh_freertos.c" :

#define NRF_BLE_FREERTOS_SDH_TASK_STACK 256 to 512

(not sur it is useful ?)

I also have seen normal ble_app_hrs is with 247 MTU and 251 GAP data lenth, and it works !

Regards,

Parents Reply Children
Related