Skip to content

Commit

Permalink
Release v2.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Matthieu Antoine committed Apr 8, 2021
1 parent 25d6a64 commit 6a2e39d
Show file tree
Hide file tree
Showing 28 changed files with 806 additions and 273 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ 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.2.0] 2021-04-08

### Changed

- Upgraded LR1110 driver to v4.0.0

## [v2.1.0] 2020-10-30

### Added
Expand Down
22 changes: 11 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,25 +1,27 @@

# LR1110 evaluation kit - demonstration application

## Introduction

This repository proposes a demonstration application running on a **LR1110 evaluation kit**.
This project is a demonstrator application for LR1110 Transceiver and LoRa Basics Modem-E.

It provides embedded example code in `embedded/` folder and companion software tools in `host/` folder.
The companion tools are to be used specifically with LR1110 Transceiver, except `AlmanacUpdate` that can be used with both LR1110 Transceiver and LoRa Basics Modem-E.

Additional assets can be found in [the Wiki](https://github.com/Lora-net/lr1110_evk_demo_app/wiki/home) (software packages, command tool, etc.).

## Applicative Host

When using a **LR1110 transceiver**, an applicative companion software running on a computer shall be used.
This project needs an applicative companion software to be running on a computer.

This section describes the steps to build/install/use it.

### Build & Install

To build the host software, proceed as follow:
To build the host softwares, proceed as follow:

```bash
$ cd $TOP_DIR/host
$ python ./setup.py sdist # Build the source distribution archive
$ python ./setup.py sdist # Build the source distribution archive
$ python -m pip install dist/<BUILT_SOURCE_DIST>.tar.gz # Install the previously built source distribution
```

Expand All @@ -28,7 +30,7 @@ $ python -m pip install dist/<BUILT_SOURCE_DIST>.tar.gz # Install the previously
For the demo mode, the applicative companion software is `Lr1110Demo` that is called as follow:

```bash
$ Lr1110Demo <INITIAL_SOLVER_SEARCH_COORDINATE> <EXACT_COORDINATES> -p <HTTP_PORT> -b 921600 -r <ID_SAMPLE> <AUTHENTICATION_TOKEN>
$ Lr1110Demo <INITIAL_SOLVER_SEARCH_COORDINATES> <EXACT_COORDINATES> -p <HTTP_PORT> -b 921600 -r <ID_SAMPLE> <AUTHENTICATION_TOKEN>
```

In case of need, a short help page is available:
Expand All @@ -39,7 +41,7 @@ $ Lr1110Demo --help

### AlmanacUpdate Usage

The `AlmanacUpdate` command line program is to be used to execute a full almanac update operation of the LR1110 (both transceiver and modem).
The `AlmanacUpdate` command line program is to be used to execute a full almanac update operation for both LR1110 Transceiver and LoRa Basics Modem-E.

It can use almanac coming either from a DAS server or from a GLS server (default is DAS server).

Expand All @@ -50,12 +52,10 @@ $ AlmanacUpdate -h
# Display the help message with all possible flags

$ AlmanacUpdate -d <EVK_COM_PORT> <DAS_TOKEN>
# Update the almanac of an evaluation kit connected on <EVK_COM_PORT> using DAS server
# Update the almanac of an EVK connected on <EVK_COM_PORT> using DAS server

$ AlmanacUpdate -g -d <EVK_COM_PORT> <GLS_TOKEN>
# Update the almanac of an evaluation kit connected on <EVK_COM_PORT> using GLS server
# Update the almanac using GLS server
```

A correct execution of the almanac update operation is determined by the trace being terminated with message *Check terminated*.

*Note: this command can also be used to update the almanacs of a **LoRa Basics Modem-E**.*
2 changes: 1 addition & 1 deletion embedded/application/inc/version.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
#ifndef __VERSION_H__
#define __VERSION_H__

#define DEMO_VERSION "v2.1.0"
#define DEMO_VERSION "v2.2.0"

#define VERSION_STRING_LENGTH 10
#define EUI_LENGTH 8
Expand Down
31 changes: 31 additions & 0 deletions embedded/lr1110_driver/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,37 @@ 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).

## [v4.0.0] 2021-04-06

### Added

* [bootloader] `lr1110_bootloader_get_status` function
* [bootloader] `lr1110_bootloader_irq_mask_t` type definition
* [bootloader] `lr1110_bootloader_chip_modes_t` type definition
* [bootloader] `lr1110_bootloader_reset_status_t` type definition
* [bootloader] `lr1110_bootloader_command_status_t` type definition
* [bootloader] `lr1110_bootloader_stat1_t` type definition
* [bootloader] `lr1110_bootloader_stat2_t` type definition
* [timings] Add the functions to compute the radio timings
* [system] Add function `lr1110_system_enable_spi_crc` to enable or disable the CRC on SPI communication
* [HAL] Add the CRC calculation for SPI

### Fixed

* [GNSS] Fix typo: `lr1110_gnss_almanac_single_satellite_update_bytestram_t` to `lr1110_gnss_almanac_single_satellite_update_bytestream_t`
* [GNSS] Fix size of context status

### Changed

* [Wi-Fi] Added field `current_channel` to `lr1110_wifi_extended_full_result_t`

### Removed

* [bootloader] `lr1110_bootloader_get_hash` function
* [bootloader] `lr1110_bootloader_write_flash` function
* [bootloader] `lr1110_bootloader_write_flash_full` function
* [bootloader] `lr1110_bootloader_erase_page` function

## [v3.0.0] 2020-10-12

### Added
Expand Down
111 changes: 45 additions & 66 deletions embedded/lr1110_driver/src/lr1110_bootloader.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,16 +47,14 @@
* --- PRIVATE CONSTANTS -------------------------------------------------------
*/

#define LR1110_FLASH_DATA_UINT32_MAX ( 64 )
#define LR1110_FLASH_DATA_UINT8_MAX ( LR1110_FLASH_DATA_UINT32_MAX * 4 )
#define LR1110_FLASH_DATA_MAX_LENGTH_UINT32 ( 64 )
#define LR1110_FLASH_DATA_MAX_LENGTH_UINT8 ( LR1110_FLASH_DATA_MAX_LENGTH_UINT32 * 4 )

#define LR1110_BL_CMD_NO_PARAM_LENGTH 2
#define LR1110_BL_GET_STATUS_CMD_LENGTH ( 2 + 4 )
#define LR1110_BL_VERSION_CMD_LENGTH LR1110_BL_CMD_NO_PARAM_LENGTH
#define LR1110_BL_ERASE_FLASH_CMD_LENGTH LR1110_BL_CMD_NO_PARAM_LENGTH
#define LR1110_BL_ERASE_PAGE_CMD_LENGTH ( LR1110_BL_CMD_NO_PARAM_LENGTH + 1 )
#define LR1110_BL_WRITE_FLASH_CMD_LENGTH ( LR1110_BL_CMD_NO_PARAM_LENGTH + 4 )
#define LR1110_BL_WRITE_FLASH_ENCRYPTED_CMD_LENGTH ( LR1110_BL_CMD_NO_PARAM_LENGTH + 4 )
#define LR1110_BL_GET_HASH_CMD_LENGTH ( LR1110_BL_CMD_NO_PARAM_LENGTH )
#define LR1110_BL_REBOOT_CMD_LENGTH ( LR1110_BL_CMD_NO_PARAM_LENGTH + 1 )
#define LR1110_BL_GET_PIN_CMD_LENGTH ( LR1110_BL_CMD_NO_PARAM_LENGTH )
#define LR1110_BL_READ_CHIP_EUI_CMD_LENGTH ( LR1110_BL_CMD_NO_PARAM_LENGTH )
Expand All @@ -67,15 +65,15 @@
* --- PRIVATE TYPES -----------------------------------------------------------
*/

/*!
* @brief Operating codes for bootloader-related operations
*/
enum
{
LR1110_BL_GET_STATUS_OC = 0x0100,
LR1110_BL_GET_VERSION_OC = 0x0101,
LR1110_BL_ERASE_FLASH_OC = 0x8000,
LR1110_BL_ERASE_PAGE_OC = 0x8001,
LR1110_BL_WRITE_FLASH_OC = 0x8002,
LR1110_BL_WRITE_FLASH_ENCRYPTED_OC = 0x8003,
LR1110_BL_GET_HASH_OC = 0x8004,
LR1110_BL_REBOOT_OC = 0x8005,
LR1110_BL_GET_PIN_OC = 0x800B,
LR1110_BL_READ_CHIP_EUI_OC = 0x800C,
Expand All @@ -92,6 +90,14 @@ enum
* --- PRIVATE FUNCTIONS DECLARATION -------------------------------------------
*/

/*!
* @brief Return the minimum of the 2 operands given as parameter
*
* @param [in] a First operand
* @param [in] b Second operand
*
* @returns Minimum of a and b
*/
uint32_t min( uint32_t a, uint32_t b )
{
uint32_t min = a;
Expand Down Expand Up @@ -139,6 +145,36 @@ static void lr1110_bootloader_fill_cbuffer_cdata_flash( uint8_t* cbuffer, uint8_
* --- PUBLIC FUNCTIONS DEFINITION ---------------------------------------------
*/

lr1110_status_t lr1110_bootloader_get_status( const void* context, lr1110_bootloader_stat1_t* stat1,
lr1110_bootloader_stat2_t* stat2,
lr1110_bootloader_irq_mask_t* irq_status )
{
uint8_t cbuffer[LR1110_BL_GET_STATUS_CMD_LENGTH] = { 0x00 };
lr1110_status_t status = LR1110_STATUS_ERROR;

cbuffer[0] = ( uint8_t )( LR1110_BL_GET_STATUS_OC >> 8 );
cbuffer[1] = ( uint8_t )( LR1110_BL_GET_STATUS_OC >> 0 );

status = ( lr1110_status_t ) lr1110_hal_write_read( context, cbuffer, cbuffer, LR1110_BL_GET_STATUS_CMD_LENGTH );

if( status == LR1110_STATUS_OK )
{
stat1->is_interrupt_active = ( ( cbuffer[0] & 0x01 ) != 0 ) ? true : false;
stat1->command_status = ( lr1110_bootloader_command_status_t )( cbuffer[0] >> 1 );

stat2->is_running_from_flash = ( ( cbuffer[1] & 0x01 ) != 0 ) ? true : false;
stat2->chip_mode = ( lr1110_bootloader_chip_modes_t )( ( cbuffer[1] & 0x0F ) >> 1 );
stat2->reset_status = ( lr1110_bootloader_reset_status_t )( ( cbuffer[1] & 0xF0 ) >> 4 );

*irq_status = ( ( lr1110_bootloader_irq_mask_t ) cbuffer[2] << 24 ) +
( ( lr1110_bootloader_irq_mask_t ) cbuffer[3] << 16 ) +
( ( lr1110_bootloader_irq_mask_t ) cbuffer[4] << 8 ) +
( ( lr1110_bootloader_irq_mask_t ) cbuffer[5] << 0 );
}

return status;
}

lr1110_status_t lr1110_bootloader_get_version( const void* context, lr1110_bootloader_version_t* version )
{
uint8_t cbuffer[LR1110_BL_VERSION_CMD_LENGTH];
Expand Down Expand Up @@ -171,52 +207,6 @@ lr1110_status_t lr1110_bootloader_erase_flash( const void* context )
return ( lr1110_status_t ) lr1110_hal_write( context, cbuffer, LR1110_BL_ERASE_FLASH_CMD_LENGTH, 0, 0 );
}

lr1110_status_t lr1110_bootloader_erase_page( const void* context, const uint8_t page_number )
{
uint8_t cbuffer[LR1110_BL_ERASE_PAGE_CMD_LENGTH];

cbuffer[0] = ( uint8_t )( LR1110_BL_ERASE_PAGE_OC >> 8 );
cbuffer[1] = ( uint8_t )( LR1110_BL_ERASE_PAGE_OC >> 0 );

cbuffer[2] = page_number;

return ( lr1110_status_t ) lr1110_hal_write( context, cbuffer, LR1110_BL_ERASE_PAGE_CMD_LENGTH, 0, 0 );
}

lr1110_status_t lr1110_bootloader_write_flash( const void* context, const uint32_t offset, const uint32_t* data,
uint8_t length )
{
uint8_t cbuffer[LR1110_BL_WRITE_FLASH_CMD_LENGTH];
uint8_t cdata[256];

lr1110_bootloader_fill_cbuffer_cdata_flash( cbuffer, cdata, LR1110_BL_WRITE_FLASH_OC, offset, data, length );

return ( lr1110_status_t ) lr1110_hal_write( context, cbuffer, LR1110_BL_WRITE_FLASH_CMD_LENGTH, cdata,
length * sizeof( uint32_t ) );
}

lr1110_status_t lr1110_bootloader_write_flash_full( const void* context, const uint32_t offset, const uint32_t* buffer,
const uint32_t length )
{
lr1110_status_t status = LR1110_STATUS_OK;
uint32_t remaining_length = length;
uint32_t local_offset = offset;
uint32_t loop = 0;

while( ( remaining_length != 0 ) && ( status == LR1110_STATUS_OK ) )
{
status = ( lr1110_status_t ) lr1110_bootloader_write_flash( context, local_offset, buffer + loop * 64,
min( remaining_length, 64 ) );

local_offset += LR1110_FLASH_DATA_UINT8_MAX;
remaining_length = ( remaining_length < 64 ) ? 0 : ( remaining_length - 64 );

loop++;
}

return status;
}

lr1110_status_t lr1110_bootloader_write_flash_encrypted( const void* context, const uint32_t offset,
const uint32_t* data, uint8_t length )
{
Expand All @@ -243,7 +233,7 @@ lr1110_status_t lr1110_bootloader_write_flash_encrypted_full( const void* contex
status = ( lr1110_status_t ) lr1110_bootloader_write_flash_encrypted( context, local_offset, buffer + loop * 64,
min( remaining_length, 64 ) );

local_offset += LR1110_FLASH_DATA_UINT8_MAX;
local_offset += LR1110_FLASH_DATA_MAX_LENGTH_UINT8;
remaining_length = ( remaining_length < 64 ) ? 0 : ( remaining_length - 64 );

loop++;
Expand All @@ -252,17 +242,6 @@ lr1110_status_t lr1110_bootloader_write_flash_encrypted_full( const void* contex
return status;
}

lr1110_status_t lr1110_bootloader_get_hash( const void* context, lr1110_bootloader_hash_t hash )
{
uint8_t cbuffer[LR1110_BL_GET_HASH_CMD_LENGTH];

cbuffer[0] = ( uint8_t )( LR1110_BL_GET_HASH_OC >> 8 );
cbuffer[1] = ( uint8_t )( LR1110_BL_GET_HASH_OC >> 0 );

return ( lr1110_status_t ) lr1110_hal_read( context, cbuffer, LR1110_BL_GET_HASH_CMD_LENGTH, hash,
LR1110_BL_HASH_LENGTH );
}

lr1110_status_t lr1110_bootloader_reboot( const void* context, const bool stay_in_bootloader )
{
uint8_t cbuffer[LR1110_BL_REBOOT_CMD_LENGTH];
Expand Down
Loading

0 comments on commit 6a2e39d

Please sign in to comment.