Skip to content

Commit

Permalink
Release v2.3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
smtc-bot committed Oct 15, 2024
1 parent 0003d57 commit 5cf9794
Show file tree
Hide file tree
Showing 14 changed files with 150 additions and 132 deletions.
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,18 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).


## [v2.3.0] - 2024-09-13

### Changed

- Default LR11xx LoRa IQ configuration set to *standard* instead of *inverted*
- Add frequency argument to RTTOF function `get_recommended_rx_tx_delay_indicator`

### Fixed

- RTToF example just runs once and then stops if it is compiled by Keil.

## [v2.2.1] - 2024-07-24

### Changed
Expand Down
2 changes: 1 addition & 1 deletion common/inc/common_version.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ extern "C" {
* --- PUBLIC MACROS -----------------------------------------------------------
*/

#define COMMON_SDK_VERSION "v2.2.1"
#define COMMON_SDK_VERSION "v2.3.0"

/*
* -----------------------------------------------------------------------------
Expand Down
3 changes: 2 additions & 1 deletion libs/smtc-shields/lr11xx/inc/smtc_shield_lr11x0_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@ extern "C" {
*/
const smtc_shield_lr11xx_xosc_cfg_t* smtc_shield_lr11x0_common_get_xosc_cfg( void );

bool smtc_shield_lr11x0_common_rttof_recommended_rx_tx_delay_indicator( lr11xx_radio_lora_bw_t bw,
bool smtc_shield_lr11x0_common_rttof_recommended_rx_tx_delay_indicator( uint32_t rf_freq_in_hz,
lr11xx_radio_lora_bw_t bw,
lr11xx_radio_lora_sf_t sf,
uint32_t* delay_indicator );

Expand Down
3 changes: 2 additions & 1 deletion libs/smtc-shields/lr11xx/inc/smtc_shield_lr11x1_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@ extern "C" {
*/
const smtc_shield_lr11xx_xosc_cfg_t* smtc_shield_lr11x1_common_get_xosc_cfg( void );

bool smtc_shield_lr11x1_common_rttof_recommended_rx_tx_delay_indicator( lr11xx_radio_lora_bw_t bw,
bool smtc_shield_lr11x1_common_rttof_recommended_rx_tx_delay_indicator( uint32_t rf_freq_in_hz,
lr11xx_radio_lora_bw_t bw,
lr11xx_radio_lora_sf_t sf,
uint32_t* delay_indicator );

Expand Down
11 changes: 7 additions & 4 deletions libs/smtc-shields/lr11xx/inc/smtc_shield_lr11xx.h
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,8 @@ typedef const smtc_shield_lr11xx_pinout_t* ( *smtc_shield_lr11xx_get_pinout_f )(
/**
* @brief Function pointer to abstract RTToF recommented Tx/Rx delay indicator getter
*/
typedef bool ( *smtc_shield_lr11xx_get_rttof_recommended_rx_tx_delay_indicator_f )( lr11xx_radio_lora_bw_t bw,
typedef bool ( *smtc_shield_lr11xx_get_rttof_recommended_rx_tx_delay_indicator_f )( uint32_t rf_freq_in_hz,
lr11xx_radio_lora_bw_t bw,
lr11xx_radio_lora_sf_t sf,
uint32_t* delay_indicator );

Expand Down Expand Up @@ -219,6 +220,7 @@ static inline const smtc_shield_lr11xx_pinout_t* smtc_shield_lr11xx_get_pinout(
* @brief Return the RTToF recommended Rx/Tx delay indicator
*
* @param [in] shield Pointer to a shield data structure
* @param [in] rf_freq_in_hz Frequency to get the recommended delay indicator for
* @param [in] bw Bandwidth to get the recommended delay indicator for
* @param [in] sf Spreading factor to get the recommended delay indicator for
* @param [out] delay_indicator Recommended delay indicator corresponding to sf/bw. Only valid if the call returned
Expand All @@ -228,11 +230,12 @@ static inline const smtc_shield_lr11xx_pinout_t* smtc_shield_lr11xx_get_pinout(
* @retval false The RTToF recommanded Rx/Tx delay indicator has not been found and must not be used
*/
static inline bool smtc_shield_lr11xx_get_rttof_recommended_rx_tx_delay_indicator( const smtc_shield_lr11xx_t* shield,
lr11xx_radio_lora_bw_t bw,
lr11xx_radio_lora_sf_t sf,
uint32_t rf_freq_in_hz,
lr11xx_radio_lora_bw_t bw,
lr11xx_radio_lora_sf_t sf,
uint32_t* delay_indicator )
{
return shield->get_rttof_recommended_rx_tx_delay_indicator( bw, sf, delay_indicator );
return shield->get_rttof_recommended_rx_tx_delay_indicator( rf_freq_in_hz, bw, sf, delay_indicator );
}

#ifdef __cplusplus
Expand Down
199 changes: 84 additions & 115 deletions libs/smtc-shields/lr11xx/src/smtc_shield_lr11x0_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,36 @@
* --- PRIVATE MACROS-----------------------------------------------------------
*/

/*!
* @brief Recommanded for frequency from 430MHz to 510MHz
*/
static const uint32_t rttof_delay_indicator_table_below_600mhz[3][8] = {
/* SF5, SF6, SF7, SF8, SF9, SF10, SF11, SF12 */
{ 19107, 19122, 19113, 19114, 19113, 19114, 19036, 19024 }, // BW125
{ 20265, 20279, 20278, 20273, 20270, 20272, 20236, 20232 }, // BW250
{ 20166, 20249, 20288, 20309, 20318, 20312, 20295, 20298 }, // BW500
};

/*!
* @brief Recommanded for frequency from 860MHz to 928MHz
*/
static const uint32_t rttof_delay_indicator_table_from_600mhz_to_2ghz[3][8] = {
/* SF5, SF6, SF7, SF8, SF9, SF10, SF11, SF12 */
{ 19115, 19113, 19121, 19127, 19141, 19178, 19036, 19024 }, // BW125
{ 20265, 20266, 20279, 20292, 20236, 20305, 20236, 20232 }, // BW250
{ 20154, 20268, 20298, 20319, 20323, 20314, 20295, 20298 }, // BW500
};

/*!
* @brief Recommanded for 2.4G frequency
*/
static const uint32_t rttof_delay_indicator_table_above_2ghz[3][8] = {
/* SF5, SF6, SF7, SF8, SF9, SF10, SF11, SF12 */
{ 19118, 19123, 19120, 19124, 19121, 19119, 19036, 19024 }, // BW125
{ 20221, 20230, 20226, 20231, 20236, 20223, 20236, 20232 }, // BW250
{ 20143, 20230, 20252, 20284, 20305, 20288, 20295, 20298 }, // BW500
};

/*
* -----------------------------------------------------------------------------
* --- PRIVATE CONSTANTS -------------------------------------------------------
Expand Down Expand Up @@ -89,136 +119,75 @@ const smtc_shield_lr11xx_xosc_cfg_t* smtc_shield_lr11x0_common_get_xosc_cfg( voi
return &smtc_shield_lr11x0_common_xosc_cfg;
}

bool smtc_shield_lr11x0_common_rttof_recommended_rx_tx_delay_indicator( lr11xx_radio_lora_bw_t bw,
bool smtc_shield_lr11x0_common_rttof_recommended_rx_tx_delay_indicator( uint32_t rf_freq_in_hz,
lr11xx_radio_lora_bw_t bw,
lr11xx_radio_lora_sf_t sf,
uint32_t* delay_indicator )
{
bool found = true;
uint8_t row_index;
uint8_t column_index;

*delay_indicator = 0u;

if( bw == LR11XX_RADIO_LORA_BW_500 )
switch( bw )
{
case LR11XX_RADIO_LORA_BW_125:
row_index = 0;
break;
case LR11XX_RADIO_LORA_BW_250:
row_index = 1;
break;
case LR11XX_RADIO_LORA_BW_500:
row_index = 2;
break;
default:
return false;
}

switch( sf )
{
if( sf == LR11XX_RADIO_LORA_SF5 )
{
*delay_indicator = 20149u;
}
else if( sf == LR11XX_RADIO_LORA_SF6 )
{
*delay_indicator = 20227u;
}
else if( sf == LR11XX_RADIO_LORA_SF7 )
{
*delay_indicator = 20258u;
}
else if( sf == LR11XX_RADIO_LORA_SF8 )
{
*delay_indicator = 20277u;
}
else if( sf == LR11XX_RADIO_LORA_SF9 )
{
*delay_indicator = 20286u;
}
else if( sf == LR11XX_RADIO_LORA_SF10 )
{
*delay_indicator = 20292u;
}
else if( sf == LR11XX_RADIO_LORA_SF11 )
{
*delay_indicator = 20295u;
}
else if( sf == LR11XX_RADIO_LORA_SF12 )
{
*delay_indicator = 20298u;
}
else
{
found = false;
}
case LR11XX_RADIO_LORA_SF5:
column_index = 0;
break;
case LR11XX_RADIO_LORA_SF6:
column_index = 1;
break;
case LR11XX_RADIO_LORA_SF7:
column_index = 2;
break;
case LR11XX_RADIO_LORA_SF8:
column_index = 3;
break;
case LR11XX_RADIO_LORA_SF9:
column_index = 4;
break;
case LR11XX_RADIO_LORA_SF10:
column_index = 5;
break;
case LR11XX_RADIO_LORA_SF11:
column_index = 6;
break;
case LR11XX_RADIO_LORA_SF12:
column_index = 7;
break;
default:
return false;
}
else if( bw == LR11XX_RADIO_LORA_BW_250 )

if( rf_freq_in_hz < 600000000 )
{
if( sf == LR11XX_RADIO_LORA_SF5 )
{
*delay_indicator = 20235u;
}
else if( sf == LR11XX_RADIO_LORA_SF6 )
{
*delay_indicator = 20239u;
}
else if( sf == LR11XX_RADIO_LORA_SF7 )
{
*delay_indicator = 20238u;
}
else if( sf == LR11XX_RADIO_LORA_SF8 )
{
*delay_indicator = 20237u;
}
else if( sf == LR11XX_RADIO_LORA_SF9 )
{
*delay_indicator = 20236u;
}
else if( sf == LR11XX_RADIO_LORA_SF10 )
{
*delay_indicator = 20235u;
}
else if( sf == LR11XX_RADIO_LORA_SF11 )
{
*delay_indicator = 20236u;
}
else if( sf == LR11XX_RADIO_LORA_SF12 )
{
*delay_indicator = 20232u;
}
else
{
found = false;
}
*delay_indicator = rttof_delay_indicator_table_below_600mhz[row_index][column_index];
}
else if( bw == LR11XX_RADIO_LORA_BW_125 )
else if( ( 600000000 <= rf_freq_in_hz ) && ( rf_freq_in_hz < 2000000000 ) )
{
if( sf == LR11XX_RADIO_LORA_SF5 )
{
*delay_indicator = 19035u;
}
else if( sf == LR11XX_RADIO_LORA_SF6 )
{
*delay_indicator = 19040u;
}
else if( sf == LR11XX_RADIO_LORA_SF7 )
{
*delay_indicator = 19040u;
}
else if( sf == LR11XX_RADIO_LORA_SF8 )
{
*delay_indicator = 19039u;
}
else if( sf == LR11XX_RADIO_LORA_SF9 )
{
*delay_indicator = 19036u;
}
else if( sf == LR11XX_RADIO_LORA_SF10 )
{
*delay_indicator = 19038u;
}
else if( sf == LR11XX_RADIO_LORA_SF11 )
{
*delay_indicator = 19036u;
}
else if( sf == LR11XX_RADIO_LORA_SF12 )
{
*delay_indicator = 19024u;
}
else
{
found = false;
}
*delay_indicator = rttof_delay_indicator_table_from_600mhz_to_2ghz[row_index][column_index];
}
else
{
found = false;
*delay_indicator = rttof_delay_indicator_table_above_2ghz[row_index][column_index];
}
return found;

return true;
}

void smtc_shield_lr11x0_common_gnss_consumption_instantaneous_value(
Expand Down
3 changes: 2 additions & 1 deletion libs/smtc-shields/lr11xx/src/smtc_shield_lr11x1_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,8 @@ const smtc_shield_lr11xx_xosc_cfg_t* smtc_shield_lr11x1_common_get_xosc_cfg( voi
return &smtc_shield_lr11x1_common_xosc_cfg;
}

bool smtc_shield_lr11x1_common_rttof_recommended_rx_tx_delay_indicator( lr11xx_radio_lora_bw_t bw,
bool smtc_shield_lr11x1_common_rttof_recommended_rx_tx_delay_indicator( uint32_t rf_freq_in_hz,
lr11xx_radio_lora_bw_t bw,
lr11xx_radio_lora_sf_t sf,
uint32_t* delay_indicator )
{
Expand Down
7 changes: 4 additions & 3 deletions lr11xx/apps/per/main_per.c
Original file line number Diff line number Diff line change
Expand Up @@ -172,9 +172,10 @@ int main( void )
HAL_DBG_TRACE_PRINTF( "Valid reception amount: %d \n", nb_ok );
HAL_DBG_TRACE_PRINTF( "Timeout reception amount: %d \n", nb_rx_timeout );
HAL_DBG_TRACE_PRINTF( "CRC Error reception amount: %d \n", nb_rx_error );
#if( PACKET_TYPE == LR11XX_RADIO_PKT_TYPE_GFSK )
HAL_DBG_TRACE_PRINTF( "FSK Length Error reception amount: %d \n", nb_fsk_len_error );
#endif
if( PACKET_TYPE == LR11XX_RADIO_PKT_TYPE_GFSK )
{
HAL_DBG_TRACE_PRINTF( "FSK Length Error reception amount: %d \n", nb_fsk_len_error );
}

while( 1 )
{
Expand Down
8 changes: 8 additions & 0 deletions lr11xx/apps/rttof/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,11 @@ Furthermore, the application defines the following parameters in the [`main_rtto
| `RESPONSE_SYMBOLS_COUNT` | Number of symbols contained in the subordinate's RTToF response packet |
| `MANAGER_TX_RX_TIMEOUT_MS` | Manager-side RTToF timeout (waiting for subordinate response) |
| `MANAGER_RTTOF_SLEEP_PERIOD` | Manager-side sleep period between two RTToF executions |

## Notes

Some of the points that need attention as followings.

- Spreading factors from SF5 to SF10 are recommended values.
- Bandwidth shall be chosen among `LR11XX_RADIO_LORA_BW_125`, `LR11XX_RADIO_LORA_BW_250` and `LR11XX_RADIO_LORA_BW_500` for both sub-GHz and 2.4G bands.
- Please set the IQ value - `LORA_IQ`, as the standard mode - `LR11XX_RADIO_LORA_IQ_STANDARD`. Because all the calibration values are based on the standard mode. It might reduce the ranging accuracy if used the inverted mode.
24 changes: 22 additions & 2 deletions lr11xx/common/apps_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -566,8 +566,8 @@ void apps_common_lr11xx_radio_rttof_init( const void* context )
ASSERT_LR11XX_RC( lr11xx_radio_set_lora_sync_word( context, LORA_SYNCWORD ) );

uint32_t rttof_rx_tx_delay = 0u;
if( smtc_shield_lr11xx_get_rttof_recommended_rx_tx_delay_indicator( &shield, lora_mod_params.bw, lora_mod_params.sf,
&rttof_rx_tx_delay ) )
if( smtc_shield_lr11xx_get_rttof_recommended_rx_tx_delay_indicator( &shield, RF_FREQ_IN_HZ, lora_mod_params.bw,
lora_mod_params.sf, &rttof_rx_tx_delay ) )
{
ASSERT_LR11XX_RC( lr11xx_rttof_set_rx_tx_delay_indicator( context, rttof_rx_tx_delay ) );
HAL_DBG_TRACE_INFO( "RTTof delay : %d\n", rttof_rx_tx_delay );
Expand Down Expand Up @@ -974,5 +974,25 @@ void on_gnss_scan_done( void )
{
HAL_DBG_TRACE_INFO( "No IRQ routine defined\n" );
}
void on_rttof_request_valid( void )
{
HAL_DBG_TRACE_INFO( "No IRQ routine defined\n" );
}
void on_rttof_request_discarded( void )
{
HAL_DBG_TRACE_INFO( "No IRQ routine defined\n" );
}
void on_rttof_response_done( void )
{
HAL_DBG_TRACE_INFO( "No IRQ routine defined\n" );
}
void on_rttof_exchange_valid( void )
{
HAL_DBG_TRACE_INFO( "No IRQ routine defined\n" );
}
void on_rttof_timeout( void )
{
HAL_DBG_TRACE_INFO( "No IRQ routine defined\n" );
}

/* --- EOF ------------------------------------------------------------------ */
2 changes: 1 addition & 1 deletion lr11xx/common/apps_configuration.h
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ extern "C" {
#define LORA_PKT_LEN_MODE LR11XX_RADIO_LORA_PKT_EXPLICIT
#endif
#ifndef LORA_IQ
#define LORA_IQ LR11XX_RADIO_LORA_IQ_INVERTED
#define LORA_IQ LR11XX_RADIO_LORA_IQ_STANDARD
#endif
#ifndef LORA_CRC
#define LORA_CRC LR11XX_RADIO_LORA_CRC_ON
Expand Down
1 change: 1 addition & 0 deletions lr11xx/common/lr11xx_hal_context.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ extern "C" {
#include "smtc_hal_mcu_gpio_stm32l4.h"
#include "stm32l4xx_ll_gpio.h"
#include "stm32l4xx_ll_spi.h"
#include "stm32l4xx_ll_utils.h"

/*
* -----------------------------------------------------------------------------
Expand Down
Loading

0 comments on commit 5cf9794

Please sign in to comment.