Skip to content

Commit

Permalink
Set BLE TX power. Temporarily removed factory reset make targets
Browse files Browse the repository at this point in the history
  • Loading branch information
tobbeanton committed Feb 6, 2024
1 parent b86e916 commit f0e402b
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 36 deletions.
72 changes: 36 additions & 36 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -310,29 +310,29 @@ flash_s130: $(SDK_ROOT)/components/softdevice/s130/hex/s130_nrf51_2.0.1_softdevi
-c "flash write_image erase $(SDK_ROOT)/components/softdevice/s130/hex/s130_nrf51_2.0.1_softdevice.hex" \
-c "reset run" -c shutdown

flash_mbs: bootloaders/nrf_mbs_v1.0.hex
$(OPENOCD) -d2 -f $(OPENOCD_INTERFACE) $(OPENOCD_CMDS) -f $(OPENOCD_TARGET) -c init -c targets -c "reset halt" \
-c "flash write_image erase $^" -c "verify_image $^" -c "reset halt" \
-c "mww 0x4001e504 0x01" -c "mww 0x10001014 0x3F000" \
-c "reset run" -c shutdown

flash_cload: bootloaders/cload_nrf_v1.0.hex
$(OPENOCD) -d2 -f $(OPENOCD_INTERFACE) $(OPENOCD_CMDS) -f $(OPENOCD_TARGET) -c init -c targets -c "reset halt" \
-c "flash write_image erase $^" -c "verify_image $^" -c "reset halt" \
-c "mww 0x4001e504 0x01" -c "mww 0x10001014 0x3F000" \
-c "mww 0x4001e504 0x01" -c "mww 0x10001080 0x3A000" -c "reset run" -c shutdown

flash_mbs_21: bootloaders/nrf_mbs_cf21.hex
$(OPENOCD) -d2 -f $(OPENOCD_INTERFACE) $(OPENOCD_CMDS) -f $(OPENOCD_TARGET) -c init -c targets -c "reset halt" \
-c "flash write_image erase $^" -c "verify_image $^" -c "reset halt" \
-c "mww 0x4001e504 0x01" -c "mww 0x10001014 0x3F000" \
-c "reset run" -c shutdown

flash_cload_21: bootloaders/cload_nrf_cf21.hex
$(OPENOCD) -d2 -f $(OPENOCD_INTERFACE) $(OPENOCD_CMDS) -f $(OPENOCD_TARGET) -c init -c targets -c "reset halt" \
-c "flash write_image erase $^" -c "verify_image $^" -c "reset halt" \
-c "mww 0x4001e504 0x01" -c "mww 0x10001014 0x3F000" \
-c "mww 0x4001e504 0x01" -c "mww 0x10001080 0x3A000" -c "reset run" -c shutdown
# flash_mbs: bootloaders/nrf_mbs_v1.0.hex
# $(OPENOCD) -d2 -f $(OPENOCD_INTERFACE) $(OPENOCD_CMDS) -f $(OPENOCD_TARGET) -c init -c targets -c "reset halt" \
# -c "flash write_image erase $^" -c "verify_image $^" -c "reset halt" \
# -c "mww 0x4001e504 0x01" -c "mww 0x10001014 0x3F000" \
# -c "reset run" -c shutdown

# flash_cload: bootloaders/cload_nrf_v1.0.hex
# $(OPENOCD) -d2 -f $(OPENOCD_INTERFACE) $(OPENOCD_CMDS) -f $(OPENOCD_TARGET) -c init -c targets -c "reset halt" \
# -c "flash write_image erase $^" -c "verify_image $^" -c "reset halt" \
# -c "mww 0x4001e504 0x01" -c "mww 0x10001014 0x3F000" \
# -c "mww 0x4001e504 0x01" -c "mww 0x10001080 0x3A000" -c "reset run" -c shutdown

# flash_mbs_21: bootloaders/nrf_mbs_cf21.hex
# $(OPENOCD) -d2 -f $(OPENOCD_INTERFACE) $(OPENOCD_CMDS) -f $(OPENOCD_TARGET) -c init -c targets -c "reset halt" \
# -c "flash write_image erase $^" -c "verify_image $^" -c "reset halt" \
# -c "mww 0x4001e504 0x01" -c "mww 0x10001014 0x3F000" \
# -c "reset run" -c shutdown

# flash_cload_21: bootloaders/cload_nrf_cf21.hex
# $(OPENOCD) -d2 -f $(OPENOCD_INTERFACE) $(OPENOCD_CMDS) -f $(OPENOCD_TARGET) -c init -c targets -c "reset halt" \
# -c "flash write_image erase $^" -c "verify_image $^" -c "reset halt" \
# -c "mww 0x4001e504 0x01" -c "mww 0x10001014 0x3F000" \
# -c "mww 0x4001e504 0x01" -c "mww 0x10001080 0x3A000" -c "reset run" -c shutdown

mass_erase:
$(OPENOCD) -d2 -f $(OPENOCD_INTERFACE) $(OPENOCD_CMDS) -f $(OPENOCD_TARGET) -c init -c targets -c "reset halt" \
Expand All @@ -355,16 +355,16 @@ gdb: $(OUTPUT_DIRECTORY)/$(PROGRAM).out
cload: $(OUTPUT_DIRECTORY)/$(PROGRAM).bin
$(CLOAD_SCRIPT) flash $(OUTPUT_DIRECTORY)/$(PROGRAM).bin nrf51-fw

factory_reset:
make mass_erase
make flash_s130
make flash_mbs
make flash_cload
make flash

factory_reset_21:
make mass_erase
make flash_s130
make flash_mbs_21
make flash_cload_21
make flash
# factory_reset:
# make mass_erase
# make flash_s130
# make flash_mbs
# make flash_cload
# make flash

# factory_reset_21:
# make mass_erase
# make flash_s130
# make flash_mbs_21
# make flash_cload_21
# make flash
6 changes: 6 additions & 0 deletions src/ble/ble.c
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,8 @@
#define SEC_PARAM_MIN_KEY_SIZE 7 /**< Minimum encryption key size. */
#define SEC_PARAM_MAX_KEY_SIZE 16 /**< Maximum encryption key size. */

#define TX_POWER_LEVEL (-16) /**< TX Power Level value. This will be set both in the TX Power service, in the advertising data, and also used to set the radio transmit power. */

#define DEAD_BEEF 0xDEADBEEF /**< Value used as error code on stack dump, can be used to identify stack location on stack unwind. */

static uint16_t m_conn_handle = BLE_CONN_HANDLE_INVALID; /**< Handle of the current connection. */
Expand Down Expand Up @@ -856,6 +858,10 @@ int ble_init(void)
// crazyflie2_pm_init();
// crazyflie2_pm_set_state(PM_STATE_SYSTEM_ON);

// Set the tx power
err_code = sd_ble_gap_tx_power_set(TX_POWER_LEVEL) ;
APP_ERROR_CHECK(err_code);

err_code = app_mailbox_create(&m_uplink);
APP_ERROR_CHECK(err_code);

Expand Down

0 comments on commit f0e402b

Please sign in to comment.