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 Dec 14, 2023
1 parent 6c3fe0a commit 95c32ff
Show file tree
Hide file tree
Showing 36 changed files with 19,670 additions and 907 deletions.
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,20 @@ 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).

## [2.3.0] - 2023-12-12

### Changed

- [driver] Update driver to v2.4.1
- [driver LR11xx modem] Update driver to v3.1.0

### Added

- Fimrware images
- LR1110 `0x0401`
- LR1120 `0x0201`
- LR1121 `0x0103`

## [2.2.0] - 2023-06-05

### Changed
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ This tool can be compiled with the following toolchains:

### Configure

Before starting to build an example, check the firmware header file being included in the [main file](application/src/main.c).
Before starting to build an example, check the firmware header file being included in the [main file](application/src/main.c), ``application/src/main.c``.

### Build

Expand Down Expand Up @@ -89,7 +89,7 @@ There are multiple ways to do it, among which:

* Drag and drop the binary file to the USB drive listed by our OS - usually shows up as `NODE_L476RG`.
* Load it through the Keil IDE
* A tool like STM32 ST-Link Utility
* A tool like [STM32 Cube Programmer](https://www.st.com/en/development-tools/stm32cubeprog.html)

### Operations

Expand Down
7,741 changes: 7,741 additions & 0 deletions application/inc/lr1110_transceiver_0401.h

Large diffs are not rendered by default.

7,741 changes: 7,741 additions & 0 deletions application/inc/lr1120_transceiver_0201.h

Large diffs are not rendered by default.

2,157 changes: 2,157 additions & 0 deletions application/inc/lr1121_transceiver_0103.h

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion application/inc/version.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ extern "C" {

#ifndef DEMO_VERSION
#warning "No demo version provided"
#define DEMO_VERSION "v2.2.0"
#define DEMO_VERSION "v2.3.0"
#endif

/*
Expand Down
14 changes: 14 additions & 0 deletions application/src/lr11xx_hal.c
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,20 @@ lr11xx_hal_status_t lr11xx_hal_wakeup( const void* radio )
return LR11XX_HAL_STATUS_OK;
}

lr11xx_hal_status_t lr11xx_hal_abort_blocking_cmd( const void* radio )
{
radio_t* radio_local = ( radio_t* ) radio;
uint8_t command[4] = { 0 };

system_gpio_set_pin_state( radio_local->nss, SYSTEM_GPIO_PIN_STATE_LOW );
system_spi_write( radio_local->spi, command, 4 );
system_gpio_set_pin_state( radio_local->nss, SYSTEM_GPIO_PIN_STATE_HIGH );

system_gpio_wait_for_state( radio_local->busy, SYSTEM_GPIO_PIN_STATE_LOW );

return LR11XX_HAL_STATUS_OK;
}

lr11xx_hal_status_t lr11xx_hal_read( const void* radio, const uint8_t* cbuffer, const uint16_t cbuffer_length,
uint8_t* rbuffer, const uint16_t rbuffer_length )
{
Expand Down
8 changes: 8 additions & 0 deletions lr1110_modem_driver/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,14 @@ 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).

## [v3.1.0] 2021-08-06

### Added

* `lr1110_modem_set_crystal_error()` and `lr1110_modem_set_crystal_error()` functions
* `lr1110_modem_helper_get_event_data()` helper function
* `lr1110_modem_event_t` structure definition

## [v3.0.1] 2021-05-11

### Fixed
Expand Down
3 changes: 3 additions & 0 deletions lr1110_modem_driver/src/lr1110_modem_gnss.h
Original file line number Diff line number Diff line change
Expand Up @@ -416,6 +416,9 @@ lr1110_modem_response_code_t lr1110_modem_gnss_set_assistance_position(
/*!
* @brief Function to read the assistance position.
*
* The assistance position read may be different from the one set beforehand
* with lr1110_modem_gnss_set_assistance_position due to a scaling computation.
*
* @param [in] context Chip implementation context
* @param [out] assistance_position latitude 12 bits and longitude 12 bits @ref
* lr1110_modem_gnss_solver_assistance_position_t
Expand Down
70 changes: 69 additions & 1 deletion lr1110_modem_driver/src/lr1110_modem_helper.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
*/

#include "lr1110_modem_helper.h"
#include "lr1110_modem_lorawan.h"

/*
* -----------------------------------------------------------------------------
Expand Down Expand Up @@ -229,6 +228,75 @@ lr1110_modem_helper_status_t lr1110_modem_helper_gnss_get_event_type( const uint
return status;
}

lr1110_modem_helper_status_t lr1110_modem_helper_get_event_data( const void* context,
lr1110_modem_event_t* modem_event )
{
lr1110_modem_helper_status_t status = LR1110_MODEM_HELPER_STATUS_ERROR;
lr1110_modem_response_code_t modem_response_code = LR1110_MODEM_RESPONSE_CODE_OK;
lr1110_modem_event_fields_t event_fields;

modem_response_code = lr1110_modem_get_event( context, &event_fields );

if( modem_response_code == LR1110_MODEM_RESPONSE_CODE_OK )
{
status = LR1110_MODEM_HELPER_STATUS_OK;
modem_event->event_type = event_fields.event_type;
modem_event->missed_events = event_fields.missed_events_count;

switch( modem_event->event_type )
{
case LR1110_MODEM_LORAWAN_EVENT_RESET:
modem_event->event_data.reset.count = ( ( uint16_t ) event_fields.buffer[0] << 8 ) + event_fields.buffer[1];
break;
case LR1110_MODEM_LORAWAN_EVENT_TX_DONE:
modem_event->event_data.txdone.status = ( lr1110_modem_tx_done_event_t ) event_fields.buffer[0];
break;
case LR1110_MODEM_LORAWAN_EVENT_DOWN_DATA:
modem_event->event_data.downdata.rssi = ( ( int8_t ) event_fields.buffer[0] ) - 64;
modem_event->event_data.downdata.snr = ( ( ( int8_t ) event_fields.buffer[1] ) >> 2 );
modem_event->event_data.downdata.flag = ( lr1110_modem_down_data_flag_t ) event_fields.buffer[2];
modem_event->event_data.downdata.fport = event_fields.buffer[3];
modem_event->event_data.downdata.length =
event_fields.buffer_len - 4; // remove rssi/snr/flag and fport from buffer
for( uint8_t i = 0; i < modem_event->event_data.downdata.length; i++ )
{
modem_event->event_data.downdata.data[i] = event_fields.buffer[i + 4];
}
break;
case LR1110_MODEM_LORAWAN_EVENT_UPLOAD_DONE:
modem_event->event_data.upload.status = ( lr1110_modem_upload_event_t ) event_fields.buffer[0];
break;
case LR1110_MODEM_LORAWAN_EVENT_SET_CONF:
modem_event->event_data.setconf.tag = ( lr1110_modem_event_setconf_tag_t ) event_fields.buffer[0];
break;
case LR1110_MODEM_LORAWAN_EVENT_MUTE:
modem_event->event_data.mute.status = ( lr1110_modem_mute_t ) event_fields.buffer[0];
break;
case LR1110_MODEM_LORAWAN_EVENT_WIFI_SCAN_DONE:
modem_event->event_data.wifi.len = event_fields.buffer_len;
for( uint16_t i = 0; i < event_fields.buffer_len; i++ )
{
modem_event->event_data.wifi.buffer[i] = event_fields.buffer[i];
}
break;
case LR1110_MODEM_LORAWAN_EVENT_GNSS_SCAN_DONE:
modem_event->event_data.gnss.len = event_fields.buffer_len;
for( uint16_t i = 0; i < event_fields.buffer_len; i++ )
{
modem_event->event_data.gnss.nav_message[i] = event_fields.buffer[i];
}
break;
case LR1110_MODEM_LORAWAN_EVENT_TIME_UPDATED_ALC_SYNC:
modem_event->event_data.time.status = ( lr1110_modem_alc_sync_state_t ) event_fields.buffer[0];
break;
default:
break;
}
}

return status;
}

/*
* -----------------------------------------------------------------------------
* --- PRIVATE FUNCTIONS DEFINITION --------------------------------------------
Expand Down
82 changes: 82 additions & 0 deletions lr1110_modem_driver/src/lr1110_modem_helper.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ extern "C" {
#include <stdbool.h>
#include <stdint.h>
#include "lr1110_modem_common.h"
#include "lr1110_modem_lorawan.h"
#include "lr1110_modem_gnss.h"

/*
Expand Down Expand Up @@ -86,6 +87,21 @@ extern "C" {
*/
#define LR1110_MODEM_HELPER_NB_DAY_PER_WEEK 7

/**
* @brief Maximum payload size in byte of a downlink
*/
#define LR1110_MODEM_HELPER_MAX_DOWNLINK_LENGTH 242

/*!
* @brief Maximum payload size in byte of a nav message
*/
#define LR1110_MODEM_HELPER_GNSS_MAX_NAV_LENGTH 255

/*!
* @brief Maximum payload size in byte of a Wi-Fi result
*/
#define LR1110_MODEM_HELPER_WIFI_MAX_BUFFER_LENGTH 948 // 12 results * LR1110_WIFI_EXTENDED_FULL_RESULT_SIZE

/*
* -----------------------------------------------------------------------------
* --- PUBLIC TYPES ------------------------------------------------------------
Expand All @@ -100,6 +116,61 @@ typedef enum
LR1110_MODEM_HELPER_STATUS_ERROR = 3,
} lr1110_modem_helper_status_t;

/**
* @brief Structure holding event-related data
*/
typedef struct
{
uint8_t event_type;
uint8_t missed_events; //!< Number of event_type events missed before the current one
union
{
struct
{
uint16_t count;
} reset;
struct
{
lr1110_modem_tx_done_event_t status;
} txdone;
struct
{
int8_t rssi; //!< Signed value in dBm + 64
int8_t snr; //!< Signed value in dB given in 0.25dB step
lr1110_modem_down_data_flag_t flag;
uint8_t fport;
uint8_t data[LR1110_MODEM_HELPER_MAX_DOWNLINK_LENGTH];
uint8_t length;
} downdata;
struct
{
lr1110_modem_upload_event_t status;
} upload;
struct
{
lr1110_modem_event_setconf_tag_t tag;
} setconf;
struct
{
lr1110_modem_mute_t status;
} mute;
struct
{
uint16_t len;
uint8_t buffer[LR1110_MODEM_HELPER_WIFI_MAX_BUFFER_LENGTH];
} wifi;
struct
{
uint16_t len;
uint8_t nav_message[LR1110_MODEM_HELPER_GNSS_MAX_NAV_LENGTH];
} gnss;
struct
{
lr1110_modem_alc_sync_state_t status;
} time;
} event_data;
} lr1110_modem_event_t;

/*
* -----------------------------------------------------------------------------
* --- PUBLIC FUNCTIONS PROTOTYPES ---------------------------------------------
Expand Down Expand Up @@ -171,6 +242,17 @@ lr1110_modem_helper_status_t lr1110_modem_helper_gnss_get_event_type( const uint
const uint16_t result_buffer_size,
lr1110_modem_gnss_scan_done_event_t* event_type );

/**
* @brief Extract the event data contained in the event field buffer
*
* @param [in] context Chip implementation context
* @param [out] modem_event Struct containing the event data \see lr1110_modem_event_t
*
* @returns Operation status
*/
lr1110_modem_helper_status_t lr1110_modem_helper_get_event_data( const void* context,
lr1110_modem_event_t* modem_event );

#ifdef __cplusplus
}
#endif
Expand Down
38 changes: 38 additions & 0 deletions lr1110_modem_driver/src/lr1110_modem_lorawan.c
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,8 @@
#define LR1110_MODEM_GET_NB_TRANS_CMD_LENGTH ( 2 )
#define LR1110_MODEM_SET_STREAM_REDUNDANCY_RATE_CMD_LENGTH ( 2 + 1 )
#define LR1110_MODEM_GET_STREAM_REDUNDANCY_RATE_CMD_LENGTH ( 2 )
#define LR1110_MODEM_SET_CRYSTAL_ERROR_CMD_LENGTH ( 2 + 4 )
#define LR1110_MODEM_GET_CRYSTAL_ERROR_CMD_LENGTH ( 2 )

#define LR1110_MODEM_INFO_FIELDS_RBUFFER_MAX_LENGTH ( 20 )
#define LR1110_MODEM_CHIP_EUI_RBUFFER_LENGTH ( 8 )
Expand Down Expand Up @@ -229,6 +231,8 @@ enum
LR1110_MODEM_GET_NB_TRANS_CMD = 0x50,
LR1110_MODEM_SET_STREAM_REDUNDANCY_RATE_CMD = 0x51,
LR1110_MODEM_GET_STREAM_REDUNDANCY_RATE_CMD = 0x52,
LR1110_MODEM_SET_CRYSTAL_ERROR_CMD = 0x53,
LR1110_MODEM_GET_CRYSTAL_ERROR_CMD = 0x54,
};

/*
Expand Down Expand Up @@ -1711,6 +1715,40 @@ lr1110_modem_response_code_t lr1110_modem_get_stream_redundancy_rate( const void
stream_redundancy_rate, sizeof( uint8_t ) );
}

lr1110_modem_response_code_t lr1110_modem_set_crystal_error( const void* context, const uint32_t crystal_error )
{
uint8_t cbuffer[LR1110_MODEM_SET_CRYSTAL_ERROR_CMD_LENGTH];

cbuffer[0] = LR1110_MODEM_GROUP_ID_MODEM;
cbuffer[1] = LR1110_MODEM_SET_CRYSTAL_ERROR_CMD;

cbuffer[2] = ( uint8_t )( crystal_error >> 24 );
cbuffer[3] = ( uint8_t )( crystal_error >> 16 );
cbuffer[4] = ( uint8_t )( crystal_error >> 8 );
cbuffer[5] = ( uint8_t ) crystal_error;

return ( lr1110_modem_response_code_t ) lr1110_modem_hal_write( context, cbuffer,
LR1110_MODEM_SET_CRYSTAL_ERROR_CMD_LENGTH, 0, 0 );
}

lr1110_modem_response_code_t lr1110_modem_get_crystal_error( const void* context, uint32_t* crystal_error )
{
uint8_t cbuffer[LR1110_MODEM_GET_CRYSTAL_ERROR_CMD_LENGTH];
uint8_t rbuffer[sizeof( uint32_t )] = { 0x00 };
lr1110_modem_response_code_t rc;

cbuffer[0] = LR1110_MODEM_GROUP_ID_MODEM;
cbuffer[1] = LR1110_MODEM_GET_CRYSTAL_ERROR_CMD;

rc = ( lr1110_modem_response_code_t ) lr1110_modem_hal_read(
context, cbuffer, LR1110_MODEM_GET_CRYSTAL_ERROR_CMD_LENGTH, rbuffer, sizeof( uint32_t ) );

*crystal_error = ( ( uint32_t ) rbuffer[0] << 24 ) + ( ( uint32_t ) rbuffer[1] << 16 ) +
( ( uint32_t ) rbuffer[2] << 8 ) + ( ( uint32_t ) rbuffer[3] );

return rc;
}

/*
* -----------------------------------------------------------------------------
* --- PRIVATE FUNCTIONS DEFINITION --------------------------------------------
Expand Down
Loading

0 comments on commit 95c32ff

Please sign in to comment.