diff --git a/ble-firmware/components/boards/my_board.h b/ble-firmware/components/boards/my_board.h
index 41afe3f..e586f91 100644
--- a/ble-firmware/components/boards/my_board.h
+++ b/ble-firmware/components/boards/my_board.h
@@ -100,8 +100,8 @@ extern "C" {
#define USB_INS_PIN 7
//TWI
-#define TWI_STATUS_GPIO 13
-#define MASTER_TWI_INST 1 //!< TWI interface used as a master accessing EEPROM memory.
+#define TWI_STATUS_GPIO 25
+#define MASTER_TWI_INST 0 //!< TWI interface used as a master accessing EEPROM memory.
#define TWI_SCL_M 27 //!< Master SCL pin.
#define TWI_SDA_M 26 //!< Master SDA pin.
#define SLAVE_ADDR 0x48
@@ -113,8 +113,8 @@ extern "C" {
//end HaoBTC
-#define RX_PIN_NUMBER 11
-#define TX_PIN_NUMBER 12
+#define RX_PIN_NUMBER 8
+#define TX_PIN_NUMBER 6
#define CTS_PIN_NUMBER UART_PIN_DISCONNECTED
#define RTS_PIN_NUMBER UART_PIN_DISCONNECTED
#define HWFC false
diff --git a/ble-firmware/components/boards/pca10040.h b/ble-firmware/components/boards/pca10040.h
index 639c644..c365336 100644
--- a/ble-firmware/components/boards/pca10040.h
+++ b/ble-firmware/components/boards/pca10040.h
@@ -86,10 +86,10 @@ extern "C" {
#define BSP_BUTTON_2 BUTTON_3
#define BSP_BUTTON_3 BUTTON_4
-#define RX_PIN_NUMBER 11
-#define TX_PIN_NUMBER 12
-#define CTS_PIN_NUMBER NRF_UART_PSEL_DISCONNECTED
-#define RTS_PIN_NUMBER NRF_UART_PSEL_DISCONNECTED
+#define RX_PIN_NUMBER 8
+#define TX_PIN_NUMBER 6
+#define CTS_PIN_NUMBER 7
+#define RTS_PIN_NUMBER 5
#define HWFC false
#define SPIS_MISO_PIN 28 // SPI MISO signal.
diff --git a/ble-firmware/components/libraries/bootloader/nrf_bootloader.c b/ble-firmware/components/libraries/bootloader/nrf_bootloader.c
index 2aaf061..88f3498 100644
--- a/ble-firmware/components/libraries/bootloader/nrf_bootloader.c
+++ b/ble-firmware/components/libraries/bootloader/nrf_bootloader.c
@@ -233,8 +233,8 @@ static void loop_forever(void)
static void dfu_enter_button_init(void)
{
nrf_gpio_cfg_sense_input(NRF_BL_DFU_ENTER_METHOD_BUTTON_PIN,
- NRF_GPIO_PIN_PULLUP,
- GPIO_PIN_CNF_SENSE_Low);
+ NRF_GPIO_PIN_PULLDOWN,
+ NRF_GPIO_PIN_SENSE_HIGH);
}
@@ -361,7 +361,7 @@ static bool dfu_enter_check(void)
}
if (NRF_BL_DFU_ENTER_METHOD_BUTTON &&
- (nrf_gpio_pin_read(NRF_BL_DFU_ENTER_METHOD_BUTTON_PIN) == 0))
+ (nrf_gpio_pin_read(NRF_BL_DFU_ENTER_METHOD_BUTTON_PIN) == 1))
{
NRF_LOG_DEBUG("DFU mode requested via button.");
button_dfu_flag = 1;
diff --git a/ble-firmware/integration/nrfx/legacy/apply_old_config.h b/ble-firmware/integration/nrfx/legacy/apply_old_config.h
index b486c2e..b371852 100644
--- a/ble-firmware/integration/nrfx/legacy/apply_old_config.h
+++ b/ble-firmware/integration/nrfx/legacy/apply_old_config.h
@@ -1130,7 +1130,7 @@
#undef NRFX_TWI1_ENABLED
#define NRFX_TWI1_ENABLED TWI1_ENABLED
#undef NRFX_TWIM1_ENABLED
-#define NRFX_TWIM1_ENABLED 1
+#define NRFX_TWIM1_ENABLED 0
#elif !defined(TWI_PRESENT) && defined(TWIM_PRESENT)
@@ -1140,7 +1140,7 @@
#define NRFX_TWIM0_ENABLED TWI0_ENABLED
#undef NRFX_TWI1_ENABLED
-#define NRFX_TWI1_ENABLED 1
+#define NRFX_TWI1_ENABLED 0
#undef NRFX_TWIM1_ENABLED
#define NRFX_TWIM1_ENABLED TWI1_ENABLED
diff --git a/dfu/Makefile b/dfu/Makefile
index cfb6b26..eb7bffd 100644
--- a/dfu/Makefile
+++ b/dfu/Makefile
@@ -69,6 +69,11 @@ SRC_FILES += \
$(SDK_ROOT)/components/libraries/fstorage/nrf_fstorage_sd.c \
$(SDK_ROOT)/components/libraries/log/src/nrf_log_frontend.c \
$(SDK_ROOT)/components/libraries/log/src/nrf_log_str_formatter.c \
+ $(SDK_ROOT)/components/libraries/log/src/nrf_log_backend_rtt.c \
+ $(SDK_ROOT)/components/libraries/log/src/nrf_log_backend_serial.c \
+ $(SDK_ROOT)/components/libraries/log/src/nrf_log_default_backends.c \
+ $(SDK_ROOT)/components/libraries/log/src/nrf_log_frontend.c \
+ $(SDK_ROOT)/components/libraries/log/src/nrf_log_str_formatter.c \
$(SDK_ROOT)/components/libraries/mem_manager/mem_manager.c \
$(SDK_ROOT)/components/libraries/memobj/nrf_memobj.c \
$(SDK_ROOT)/components/libraries/queue/nrf_queue.c \
@@ -88,6 +93,9 @@ SRC_FILES += \
$(SDK_ROOT)/external/fprintf/nrf_fprintf_format.c \
$(SDK_ROOT)/external/nano-pb/pb_common.c \
$(SDK_ROOT)/external/nano-pb/pb_decode.c \
+ $(SDK_ROOT)/external/segger_rtt/SEGGER_RTT.c \
+ $(SDK_ROOT)/external/segger_rtt/SEGGER_RTT_Syscalls_GCC.c \
+ $(SDK_ROOT)/external/segger_rtt/SEGGER_RTT_printf.c \
$(SDK_ROOT)/integration/nrfx/legacy/nrf_drv_uart.c \
$(SDK_ROOT)/modules/nrfx/drivers/src/nrfx_uart.c \
$(SDK_ROOT)/modules/nrfx/drivers/src/nrfx_uarte.c \
@@ -154,6 +162,7 @@ INC_FOLDERS += \
$(SDK_ROOT)/modules/nrfx/drivers/include \
$(SDK_ROOT)/modules/nrfx/hal \
$(SDK_ROOT)/modules/nrfx/mdk \
+ $(SDK_ROOT)/external/segger_rtt \
# Libraries common to all targets
LIB_FILES += \
diff --git a/dfu/sdk_config.h b/dfu/sdk_config.h
index 615343d..bcf3130 100644
--- a/dfu/sdk_config.h
+++ b/dfu/sdk_config.h
@@ -2169,6 +2169,39 @@
// nRF_Log
//==========================================================
+// NRF_LOG_BACKEND_RTT_ENABLED - nrf_log_backend_rtt - Log RTT backend
+//==========================================================
+#ifndef NRF_LOG_BACKEND_RTT_ENABLED
+#define NRF_LOG_BACKEND_RTT_ENABLED 1
+#endif
+// NRF_LOG_BACKEND_RTT_TEMP_BUFFER_SIZE - Size of buffer for partially processed strings.
+// Size of the buffer is a trade-off between RAM usage and processing.
+// if buffer is smaller then strings will often be fragmented.
+// It is recommended to use size which will fit typical log and only the
+// longer one will be fragmented.
+
+#ifndef NRF_LOG_BACKEND_RTT_TEMP_BUFFER_SIZE
+#define NRF_LOG_BACKEND_RTT_TEMP_BUFFER_SIZE 64
+#endif
+
+// NRF_LOG_BACKEND_RTT_TX_RETRY_DELAY_MS - Period before retrying writing to RTT
+#ifndef NRF_LOG_BACKEND_RTT_TX_RETRY_DELAY_MS
+#define NRF_LOG_BACKEND_RTT_TX_RETRY_DELAY_MS 1
+#endif
+
+// NRF_LOG_BACKEND_RTT_TX_RETRY_CNT - Writing to RTT retries.
+// If RTT fails to accept any new data after retries
+// module assumes that host is not active and on next
+// request it will perform only one write attempt.
+// On successful writing, module assumes that host is active
+// and scheme with retry is applied again.
+
+#ifndef NRF_LOG_BACKEND_RTT_TX_RETRY_CNT
+#define NRF_LOG_BACKEND_RTT_TX_RETRY_CNT 3
+#endif
+
+//
+
// NRF_LOG_ENABLED - nrf_log - Logger
//==========================================================
#ifndef NRF_LOG_ENABLED
@@ -2225,7 +2258,7 @@
// <16384=> 16384
#ifndef NRF_LOG_BUFSIZE
-#define NRF_LOG_BUFSIZE 1024
+#define NRF_LOG_BUFSIZE 4096
#endif
// NRF_LOG_CLI_CMDS - Enable CLI commands for the module.
@@ -2244,7 +2277,7 @@
// <4=> Debug
#ifndef NRF_LOG_DEFAULT_LEVEL
-#define NRF_LOG_DEFAULT_LEVEL 3
+#define NRF_LOG_DEFAULT_LEVEL 4
#endif
// NRF_LOG_DEFERRED - Enable deffered logger.
@@ -5123,9 +5156,59 @@
#ifndef NRF_LOG_STR_FORMATTER_TIMESTAMP_FORMAT_ENABLED
-#define NRF_LOG_STR_FORMATTER_TIMESTAMP_FORMAT_ENABLED 0
+#define NRF_LOG_STR_FORMATTER_TIMESTAMP_FORMAT_ENABLED 1
+#endif
+
+//
+//==========================================================
+
+// nRF_Segger_RTT
+
+//==========================================================
+// segger_rtt - SEGGER RTT
+
+//==========================================================
+// SEGGER_RTT_CONFIG_BUFFER_SIZE_UP - Size of upstream buffer.
+// Note that either @ref NRF_LOG_BACKEND_RTT_OUTPUT_BUFFER_SIZE
+// or this value is actually used. It depends on which one is bigger.
+
+#ifndef SEGGER_RTT_CONFIG_BUFFER_SIZE_UP
+#define SEGGER_RTT_CONFIG_BUFFER_SIZE_UP 4096
+#endif
+
+// SEGGER_RTT_CONFIG_MAX_NUM_UP_BUFFERS - Maximum number of upstream buffers.
+#ifndef SEGGER_RTT_CONFIG_MAX_NUM_UP_BUFFERS
+#define SEGGER_RTT_CONFIG_MAX_NUM_UP_BUFFERS 2
+#endif
+
+// SEGGER_RTT_CONFIG_BUFFER_SIZE_DOWN - Size of downstream buffer.
+#ifndef SEGGER_RTT_CONFIG_BUFFER_SIZE_DOWN
+#define SEGGER_RTT_CONFIG_BUFFER_SIZE_DOWN 16
+#endif
+
+// SEGGER_RTT_CONFIG_MAX_NUM_DOWN_BUFFERS - Maximum number of downstream buffers.
+#ifndef SEGGER_RTT_CONFIG_MAX_NUM_DOWN_BUFFERS
+#define SEGGER_RTT_CONFIG_MAX_NUM_DOWN_BUFFERS 2
#endif
+// SEGGER_RTT_CONFIG_DEFAULT_MODE - RTT behavior if the buffer is full.
+
+
+// The following modes are supported:
+// - SKIP - Do not block, output nothing.
+// - TRIM - Do not block, output as much as fits.
+// - BLOCK - Wait until there is space in the buffer.
+// <0=> SKIP
+// <1=> TRIM
+// <2=> BLOCK_IF_FIFO_FULL
+
+#ifndef SEGGER_RTT_CONFIG_DEFAULT_MODE
+#define SEGGER_RTT_CONFIG_DEFAULT_MODE 0
+#endif
+
+//
+//==========================================================
+
//
//==========================================================
diff --git a/make_images.sh b/make_images.sh
index e76d8e8..8451ef6 100755
--- a/make_images.sh
+++ b/make_images.sh
@@ -27,7 +27,7 @@ unset BT_SIG_PK
##### FACTORY #####
# gen hex
-$PATH_UTILS/nrfutil settings generate --family NRF52 --application $PATH_APP --application-version 3 --bootloader-version 2 --bl-settings-version 2 $PATH_BL_CONFIG
+$PATH_UTILS/nrfutil settings generate --family NRF52 --application $PATH_APP --application-version 3 --bootloader-version 2 --bl-settings-version 2 --app-boot-validation VALIDATE_ECDSA_P256_SHA256 --key-file $PATH_KEY $PATH_BL_CONFIG
$PATH_UTILS/mergehex --merge $PATH_BOOTLOADER $PATH_BL_CONFIG $PATH_SD $PATH_APP --output $PATH_OUTPUT_FACTORY_HEX
rm $PATH_BL_CONFIG
@@ -39,6 +39,6 @@ rm $PATH_OUTPUT_FACTORY_BIN.tmp
##### OTA #####
# sign app
-$PATH_UTILS/nrfutil pkg generate --application $PATH_APP --application-version 3 --hw-version 52 --sd-req 0xCB --key-file $PATH_KEY $PATH_OUTPUT_ZIP
+$PATH_UTILS/nrfutil pkg generate --application $PATH_APP --application-version 3 --hw-version 52 --sd-req 0xCB --app-boot-validation VALIDATE_ECDSA_P256_SHA256 --key-file $PATH_KEY $PATH_OUTPUT_ZIP
rm $PATH_KEY
$PATH_UTILS/ota_to_onekey_bin.py $PATH_OUTPUT_ZIP $PATH_OUTPUT_OTA_BIN
\ No newline at end of file