Skip to content

lib/stm32: stm32wba: radio temperature calibration activation #283

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion lib/stm32wba/BLE_TransparentMode/Core/Inc/app_conf.h
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,9 @@ typedef enum
* HW RADIO configuration
******************************************************************************/
/* Link Layer uses temperature based calibration (0 --> NO ; 1 --> YES) */
#define USE_TEMPERATURE_BASED_RADIO_CALIBRATION (0)
#ifndef USE_TEMPERATURE_BASED_RADIO_CALIBRATION
#define USE_TEMPERATURE_BASED_RADIO_CALIBRATION (1)
#endif

#define RADIO_INTR_NUM RADIO_IRQn /* 2.4GHz RADIO global interrupt */
#define RADIO_INTR_PRIO_HIGH (0) /* 2.4GHz RADIO interrupt priority when radio is Active */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@
#include "linklayer_plat.h"
#include "scm.h"
#include "log_module.h"
#ifndef __ZEPHYR__
#if (USE_TEMPERATURE_BASED_RADIO_CALIBRATION == 1)
#include "adc_ctrl.h"
#endif /* (USE_TEMPERATURE_BASED_RADIO_CALIBRATION == 1) */
#ifndef __ZEPHYR__
#if (CFG_LPM_LEVEL != 0)
#include "stm32_lpm.h"
#include "stm32_lpm_if.h"
Expand Down Expand Up @@ -502,6 +502,7 @@ void LINKLAYER_PLAT_RCOStopClbr(void)
while (LL_PWR_IsActiveFlag_VOS() == 0);
#endif /* (CFG_SCM_SUPPORTED == 1) */
}
#endif /*__ZEPHYR__*/

/**
* @brief Link Layer requests temperature.
Expand All @@ -514,7 +515,7 @@ void LINKLAYER_PLAT_RequestTemperature(void)
ll_sys_bg_temperature_measurement();
#endif /* USE_TEMPERATURE_BASED_RADIO_CALIBRATION */
}

#ifndef __ZEPHYR__
/**
* @brief Enable RTOS context switch.
* @param None
Expand Down
10 changes: 4 additions & 6 deletions lib/stm32wba/BLE_TransparentMode/STM32_WPAN/Target/ll_sys_if.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,11 @@
#include "ll_sys.h"
#include "ll_sys_if.h"
#include "utilities_common.h"
#ifndef __ZEPHYR__
#if (USE_TEMPERATURE_BASED_RADIO_CALIBRATION == 1)
#include "temp_measurement.h"
#endif /* (USE_TEMPERATURE_BASED_RADIO_CALIBRATION == 1) */

#endif /*__ZEPHYR__*/
/* Private defines -----------------------------------------------------------*/
/* Radio event scheduling method - must be set at 1 */
#define USE_RADIO_LOW_ISR (1)
Expand Down Expand Up @@ -58,9 +59,6 @@
/* USER CODE END GV */

/* Private functions prototypes-----------------------------------------------*/
#if (USE_TEMPERATURE_BASED_RADIO_CALIBRATION == 1)
static void ll_sys_bg_temperature_measurement_init(void);
#endif /* USE_TEMPERATURE_BASED_RADIO_CALIBRATION */
static void ll_sys_sleep_clock_source_selection(void);
static uint8_t ll_sys_BLE_sleep_clock_accuracy_selection(void);
void ll_sys_reset(void);
Expand Down Expand Up @@ -129,7 +127,6 @@ void ll_sys_config_params(void)
/* Apply the selected link layer sleep timer source */
ll_sys_sleep_clock_source_selection();

#ifndef __ZEPHYR__
/* USER CODE BEGIN ll_sys_config_params_1 */

/* USER CODE END ll_sys_config_params_1 */
Expand All @@ -142,9 +139,10 @@ void ll_sys_config_params(void)
ll_intf_cmn_set_temperature_sensor_state();
#endif /* USE_TEMPERATURE_BASED_RADIO_CALIBRATION */

#ifndef __ZEPHYR__
/* Link Layer power table */
ll_intf_cmn_select_tx_power_table(CFG_RF_TX_POWER_TABLE_ID);
#endif
#endif /*__ZEPHYR__*/
/* USER CODE BEGIN ll_sys_config_params_2 */

/* USER CODE END ll_sys_config_params_2 */
Expand Down
5 changes: 5 additions & 0 deletions lib/stm32wba/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,11 @@ set_target_properties(
stm32wba_ble_lib PROPERTIES IMPORTED_LOCATION ${STM32WBA_BLE_LIB_DIR}/stm32wba_ble_stack_llo.a
)

# Setting the right Cube define according to the Zephyr configuration
if(NOT CONFIG_BT_STM32WBA_USE_TEMPERATURE_BASED_RADIO_CALIBRATION STREQUAL "y")
zephyr_compile_definitions( -DUSE_TEMPERATURE_BASED_RADIO_CALIBRATION=0 )
endif()

# Selecting the proper version of link layer lib according the soc
# Checking all the soc variants and not simply relying on board name

Expand Down
2 changes: 1 addition & 1 deletion lib/stm32wba/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ Patch List:
* Enabled extended advertising in CFG_BLE_OPTIONS:
Impacted file: app_conf.h

* Disable Temperature based radio calibration:
* Allowing Temperature based radio calibration configuration to be externally overwritten:
Impacted file: app_conf.h

* Increased 2.4GHz RADIO low ISR priority:
Expand Down
7 changes: 7 additions & 0 deletions lib/stm32wba/STM32_WPAN/link_layer/ll_sys/inc/ll_sys.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#ifndef LL_SYS_H
#define LL_SYS_H

#include "app_conf.h"
#include "ll_intf.h"
#include "hci.h"
#include "cmsis_compiler.h"
Expand Down Expand Up @@ -99,6 +100,12 @@ ll_sys_status_t ll_sys_dp_slp_exit(void);
ll_sys_dp_slp_state_t ll_sys_dp_slp_get_state(void);
void ll_sys_dp_slp_wakeup_evt_clbk(void const *ptr_arg);

/* Link Layer system interface temperature calibration functions ************************************************/
#if (USE_TEMPERATURE_BASED_RADIO_CALIBRATION == 1)
void ll_sys_bg_temperature_measurement_init(void);
void ll_sys_bg_temperature_measurement(void);
#endif /* USE_TEMPERATURE_BASED_RADIO_CALIBRATION */

/**
* @brief Get the number of concurrent state machines for the Link Layer
* @param None
Expand Down