From 406f7a204c0409fd029458d54e0288e55620e65f Mon Sep 17 00:00:00 2001 From: Antonio Sconza Date: Wed, 19 Mar 2025 10:34:59 +0100 Subject: [PATCH] [PRJ] Fetch the RSSI calibration from memory before performing the LBT verification in Sigfox applications of 'B-WL5M-SUBG1' and 'NUCLEO-WL55JC1' boards --- .../Applications/Sigfox/Sigfox_AT_Slave/Sigfox/Target/rf_api.c | 3 +++ .../Sigfox/Sigfox_PushButton/Sigfox/Target/rf_api.c | 3 +++ .../Sigfox_PushButton_DualCore/CM0PLUS/Sigfox/Target/rf_api.c | 3 +++ .../Applications/Sigfox/Sigfox_AT_Slave/Sigfox/Target/rf_api.c | 3 +++ .../Sigfox_AT_Slave_DualCore/CM0PLUS/Sigfox/Target/rf_api.c | 3 +++ .../Sigfox/Sigfox_PushButton/Sigfox/Target/rf_api.c | 3 +++ .../Sigfox_PushButton_DualCore/CM0PLUS/Sigfox/Target/rf_api.c | 3 +++ 7 files changed, 21 insertions(+) diff --git a/Projects/B-WL5M-SUBG1/Applications/Sigfox/Sigfox_AT_Slave/Sigfox/Target/rf_api.c b/Projects/B-WL5M-SUBG1/Applications/Sigfox/Sigfox_AT_Slave/Sigfox/Target/rf_api.c index c8ad7e18..35eb75b7 100644 --- a/Projects/B-WL5M-SUBG1/Applications/Sigfox/Sigfox_AT_Slave/Sigfox/Target/rf_api.c +++ b/Projects/B-WL5M-SUBG1/Applications/Sigfox/Sigfox_AT_Slave/Sigfox/Target/rf_api.c @@ -485,6 +485,7 @@ sfx_u8 RF_API_wait_for_clear_channel(sfx_u8 cs_min, sfx_s8 cs_threshold, sfx_rx_ { sfx_u8 status = SFX_ERR_NONE; sfx_rx_state_enum_t cs_state = DL_TIMEOUT; + sfx_s8 lbt_threshold_cal; /* Starts Rx Windows to sense if channel is occupied or clear* * If the channel is clear during the minimum carrier sense * value (cs_min), under the limit of the cs_threshold, @@ -502,6 +503,8 @@ sfx_u8 RF_API_wait_for_clear_channel(sfx_u8 cs_min, sfx_s8 cs_threshold, sfx_rx_ HAL_Delay(Radio.GetWakeupTime()); + lbt_threshold_cal = E2P_Read_RssiCal(); + cs_threshold += lbt_threshold_cal; APP_LOG(TS_ON, VLEVEL_M, "CS start cs_min=%dms, cs_threshold=%dBm\n\r", cs_min, cs_threshold); while (RxCarrierSenseGetStatus() == 0) diff --git a/Projects/B-WL5M-SUBG1/Applications/Sigfox/Sigfox_PushButton/Sigfox/Target/rf_api.c b/Projects/B-WL5M-SUBG1/Applications/Sigfox/Sigfox_PushButton/Sigfox/Target/rf_api.c index c8ad7e18..35eb75b7 100644 --- a/Projects/B-WL5M-SUBG1/Applications/Sigfox/Sigfox_PushButton/Sigfox/Target/rf_api.c +++ b/Projects/B-WL5M-SUBG1/Applications/Sigfox/Sigfox_PushButton/Sigfox/Target/rf_api.c @@ -485,6 +485,7 @@ sfx_u8 RF_API_wait_for_clear_channel(sfx_u8 cs_min, sfx_s8 cs_threshold, sfx_rx_ { sfx_u8 status = SFX_ERR_NONE; sfx_rx_state_enum_t cs_state = DL_TIMEOUT; + sfx_s8 lbt_threshold_cal; /* Starts Rx Windows to sense if channel is occupied or clear* * If the channel is clear during the minimum carrier sense * value (cs_min), under the limit of the cs_threshold, @@ -502,6 +503,8 @@ sfx_u8 RF_API_wait_for_clear_channel(sfx_u8 cs_min, sfx_s8 cs_threshold, sfx_rx_ HAL_Delay(Radio.GetWakeupTime()); + lbt_threshold_cal = E2P_Read_RssiCal(); + cs_threshold += lbt_threshold_cal; APP_LOG(TS_ON, VLEVEL_M, "CS start cs_min=%dms, cs_threshold=%dBm\n\r", cs_min, cs_threshold); while (RxCarrierSenseGetStatus() == 0) diff --git a/Projects/B-WL5M-SUBG1/Applications/Sigfox/Sigfox_PushButton_DualCore/CM0PLUS/Sigfox/Target/rf_api.c b/Projects/B-WL5M-SUBG1/Applications/Sigfox/Sigfox_PushButton_DualCore/CM0PLUS/Sigfox/Target/rf_api.c index c8ad7e18..35eb75b7 100644 --- a/Projects/B-WL5M-SUBG1/Applications/Sigfox/Sigfox_PushButton_DualCore/CM0PLUS/Sigfox/Target/rf_api.c +++ b/Projects/B-WL5M-SUBG1/Applications/Sigfox/Sigfox_PushButton_DualCore/CM0PLUS/Sigfox/Target/rf_api.c @@ -485,6 +485,7 @@ sfx_u8 RF_API_wait_for_clear_channel(sfx_u8 cs_min, sfx_s8 cs_threshold, sfx_rx_ { sfx_u8 status = SFX_ERR_NONE; sfx_rx_state_enum_t cs_state = DL_TIMEOUT; + sfx_s8 lbt_threshold_cal; /* Starts Rx Windows to sense if channel is occupied or clear* * If the channel is clear during the minimum carrier sense * value (cs_min), under the limit of the cs_threshold, @@ -502,6 +503,8 @@ sfx_u8 RF_API_wait_for_clear_channel(sfx_u8 cs_min, sfx_s8 cs_threshold, sfx_rx_ HAL_Delay(Radio.GetWakeupTime()); + lbt_threshold_cal = E2P_Read_RssiCal(); + cs_threshold += lbt_threshold_cal; APP_LOG(TS_ON, VLEVEL_M, "CS start cs_min=%dms, cs_threshold=%dBm\n\r", cs_min, cs_threshold); while (RxCarrierSenseGetStatus() == 0) diff --git a/Projects/NUCLEO-WL55JC1/Applications/Sigfox/Sigfox_AT_Slave/Sigfox/Target/rf_api.c b/Projects/NUCLEO-WL55JC1/Applications/Sigfox/Sigfox_AT_Slave/Sigfox/Target/rf_api.c index c8ad7e18..35eb75b7 100644 --- a/Projects/NUCLEO-WL55JC1/Applications/Sigfox/Sigfox_AT_Slave/Sigfox/Target/rf_api.c +++ b/Projects/NUCLEO-WL55JC1/Applications/Sigfox/Sigfox_AT_Slave/Sigfox/Target/rf_api.c @@ -485,6 +485,7 @@ sfx_u8 RF_API_wait_for_clear_channel(sfx_u8 cs_min, sfx_s8 cs_threshold, sfx_rx_ { sfx_u8 status = SFX_ERR_NONE; sfx_rx_state_enum_t cs_state = DL_TIMEOUT; + sfx_s8 lbt_threshold_cal; /* Starts Rx Windows to sense if channel is occupied or clear* * If the channel is clear during the minimum carrier sense * value (cs_min), under the limit of the cs_threshold, @@ -502,6 +503,8 @@ sfx_u8 RF_API_wait_for_clear_channel(sfx_u8 cs_min, sfx_s8 cs_threshold, sfx_rx_ HAL_Delay(Radio.GetWakeupTime()); + lbt_threshold_cal = E2P_Read_RssiCal(); + cs_threshold += lbt_threshold_cal; APP_LOG(TS_ON, VLEVEL_M, "CS start cs_min=%dms, cs_threshold=%dBm\n\r", cs_min, cs_threshold); while (RxCarrierSenseGetStatus() == 0) diff --git a/Projects/NUCLEO-WL55JC1/Applications/Sigfox/Sigfox_AT_Slave_DualCore/CM0PLUS/Sigfox/Target/rf_api.c b/Projects/NUCLEO-WL55JC1/Applications/Sigfox/Sigfox_AT_Slave_DualCore/CM0PLUS/Sigfox/Target/rf_api.c index c8ad7e18..35eb75b7 100644 --- a/Projects/NUCLEO-WL55JC1/Applications/Sigfox/Sigfox_AT_Slave_DualCore/CM0PLUS/Sigfox/Target/rf_api.c +++ b/Projects/NUCLEO-WL55JC1/Applications/Sigfox/Sigfox_AT_Slave_DualCore/CM0PLUS/Sigfox/Target/rf_api.c @@ -485,6 +485,7 @@ sfx_u8 RF_API_wait_for_clear_channel(sfx_u8 cs_min, sfx_s8 cs_threshold, sfx_rx_ { sfx_u8 status = SFX_ERR_NONE; sfx_rx_state_enum_t cs_state = DL_TIMEOUT; + sfx_s8 lbt_threshold_cal; /* Starts Rx Windows to sense if channel is occupied or clear* * If the channel is clear during the minimum carrier sense * value (cs_min), under the limit of the cs_threshold, @@ -502,6 +503,8 @@ sfx_u8 RF_API_wait_for_clear_channel(sfx_u8 cs_min, sfx_s8 cs_threshold, sfx_rx_ HAL_Delay(Radio.GetWakeupTime()); + lbt_threshold_cal = E2P_Read_RssiCal(); + cs_threshold += lbt_threshold_cal; APP_LOG(TS_ON, VLEVEL_M, "CS start cs_min=%dms, cs_threshold=%dBm\n\r", cs_min, cs_threshold); while (RxCarrierSenseGetStatus() == 0) diff --git a/Projects/NUCLEO-WL55JC1/Applications/Sigfox/Sigfox_PushButton/Sigfox/Target/rf_api.c b/Projects/NUCLEO-WL55JC1/Applications/Sigfox/Sigfox_PushButton/Sigfox/Target/rf_api.c index c8ad7e18..35eb75b7 100644 --- a/Projects/NUCLEO-WL55JC1/Applications/Sigfox/Sigfox_PushButton/Sigfox/Target/rf_api.c +++ b/Projects/NUCLEO-WL55JC1/Applications/Sigfox/Sigfox_PushButton/Sigfox/Target/rf_api.c @@ -485,6 +485,7 @@ sfx_u8 RF_API_wait_for_clear_channel(sfx_u8 cs_min, sfx_s8 cs_threshold, sfx_rx_ { sfx_u8 status = SFX_ERR_NONE; sfx_rx_state_enum_t cs_state = DL_TIMEOUT; + sfx_s8 lbt_threshold_cal; /* Starts Rx Windows to sense if channel is occupied or clear* * If the channel is clear during the minimum carrier sense * value (cs_min), under the limit of the cs_threshold, @@ -502,6 +503,8 @@ sfx_u8 RF_API_wait_for_clear_channel(sfx_u8 cs_min, sfx_s8 cs_threshold, sfx_rx_ HAL_Delay(Radio.GetWakeupTime()); + lbt_threshold_cal = E2P_Read_RssiCal(); + cs_threshold += lbt_threshold_cal; APP_LOG(TS_ON, VLEVEL_M, "CS start cs_min=%dms, cs_threshold=%dBm\n\r", cs_min, cs_threshold); while (RxCarrierSenseGetStatus() == 0) diff --git a/Projects/NUCLEO-WL55JC1/Applications/Sigfox/Sigfox_PushButton_DualCore/CM0PLUS/Sigfox/Target/rf_api.c b/Projects/NUCLEO-WL55JC1/Applications/Sigfox/Sigfox_PushButton_DualCore/CM0PLUS/Sigfox/Target/rf_api.c index c8ad7e18..35eb75b7 100644 --- a/Projects/NUCLEO-WL55JC1/Applications/Sigfox/Sigfox_PushButton_DualCore/CM0PLUS/Sigfox/Target/rf_api.c +++ b/Projects/NUCLEO-WL55JC1/Applications/Sigfox/Sigfox_PushButton_DualCore/CM0PLUS/Sigfox/Target/rf_api.c @@ -485,6 +485,7 @@ sfx_u8 RF_API_wait_for_clear_channel(sfx_u8 cs_min, sfx_s8 cs_threshold, sfx_rx_ { sfx_u8 status = SFX_ERR_NONE; sfx_rx_state_enum_t cs_state = DL_TIMEOUT; + sfx_s8 lbt_threshold_cal; /* Starts Rx Windows to sense if channel is occupied or clear* * If the channel is clear during the minimum carrier sense * value (cs_min), under the limit of the cs_threshold, @@ -502,6 +503,8 @@ sfx_u8 RF_API_wait_for_clear_channel(sfx_u8 cs_min, sfx_s8 cs_threshold, sfx_rx_ HAL_Delay(Radio.GetWakeupTime()); + lbt_threshold_cal = E2P_Read_RssiCal(); + cs_threshold += lbt_threshold_cal; APP_LOG(TS_ON, VLEVEL_M, "CS start cs_min=%dms, cs_threshold=%dBm\n\r", cs_min, cs_threshold); while (RxCarrierSenseGetStatus() == 0)