-
Notifications
You must be signed in to change notification settings - Fork 6.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
sample: board: sensortile_box_pro: add ble-fw-upgrade
This sample implement the ble firmware upgrade using the AN5471 protocol on uart2 channel. Signed-off-by: Armando Visconti <armando.visconti@st.com>
- Loading branch information
Showing
5 changed files
with
494 additions
and
0 deletions.
There are no files selected for viewing
10 changes: 10 additions & 0 deletions
10
samples/boards/sensortile_box_pro/ble-fw-upgrade/CMakeLists.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# Copyright (c) 2024 STMicroelectronics | ||
# | ||
# SPDX-License-Identifier: Apache-2.0 | ||
# | ||
cmake_minimum_required(VERSION 3.20.0) | ||
|
||
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) | ||
project(sensortile_box_pro) | ||
|
||
target_sources(app PRIVATE src/main.c) |
97 changes: 97 additions & 0 deletions
97
samples/boards/sensortile_box_pro/ble-fw-upgrade/README.rst
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
.. _sensortile_box_pro_sample_ble_fwupg: | ||
|
||
ST SensorTile.box Pro BLE Firmware Upgrade | ||
########################################## | ||
|
||
Overview | ||
******** | ||
This sample provides a simple method to upgrade the firmware for | ||
the BLE chip present on :ref:`sensortile_box_pro_board` board. | ||
|
||
It uses the BlueNRG-LPS UART bootloader protocol explained in `AN5471`_ . | ||
|
||
Requirements | ||
************ | ||
|
||
The application requires a SensorTile.box Pro board connected to the PC | ||
through USB. | ||
|
||
To run this sample the console is not strictly needed, but might be useful. | ||
Following is an example for minicom. | ||
|
||
.. code-block:: console | ||
$ minicom -D <tty_device> -b 115200 | ||
Replace :code:`<tty_device>` with the correct device path automatically created on | ||
the host after the SensorTile.box Pro board gets connected to it, | ||
usually :code:`/dev/ttyUSBx` or :code:`/dev/ttyACMx` (with x being 0, 1, 2, ...). | ||
The ``-b`` option sets baud rate ignoring the value from config. | ||
|
||
Building and Running | ||
******************** | ||
|
||
Build and flash the sample in the following way: | ||
|
||
.. zephyr-app-commands:: | ||
:zephyr-app: samples/boards/sensortile_box_pro/ble-fw-upgrade | ||
:board: sensortile_box_pro | ||
:goals: build flash | ||
|
||
Please note that flashing the board requires a few preliminary steps described | ||
in :ref:`sensortile_box_pro_board`. | ||
|
||
After flashing, the sample starts and asks the user to acknowledge the f/w update. | ||
User should press :kbd:`y` or :kbd:`Y` to proceed in upgrading the BLE f/w. | ||
|
||
.. code-block:: console | ||
Start BLE f/w update (press Y to proceed): | ||
Nevertheless it is not strictly necessary to use the console, as the user may also acknowledge | ||
the f/w update pressing the User BT2 button (see :ref:`sensortile_box_pro_board` board and | ||
check on user manual and/or schematic to see where the button is located and how | ||
it works). | ||
|
||
LEDs status | ||
----------- | ||
|
||
The blue LED blinks three times with 200ms interval to indicate the procedure is starting. | ||
Then blue LED start blinking very fast to indicate the BLE flash activity is on going. | ||
|
||
After BLE flashing is complete: | ||
|
||
- If status is OK the green LED blinks three times with 200ms interval and remains on. | ||
- If flashing failed the red LED blinks three times with 200ms interval and remains on. | ||
|
||
Console messages | ||
---------------- | ||
|
||
To properly see messages on your terminale emulatore you may also need to set lineWrap to on. | ||
In case of minicom just enter the menu with :kbd:`Ctrl-A Z` an then press :kbd:`W`. | ||
|
||
The sample outputs following messages. | ||
|
||
.. code-block:: console | ||
SensorTile.box Pro BLE f/w upgrade | ||
bootloader activated! | ||
ble bootloader version is 4.0 | ||
MASS ERASE ok | ||
.............................................................................................. | ||
.............................................................................................. | ||
.............................................................................................. | ||
.............................................................................................. | ||
.............................................................................................. | ||
.............................................................................................. | ||
.............................................................................................. | ||
............................................ | ||
BLE f/w upgrade ok | ||
References | ||
********** | ||
|
||
.. target-notes:: | ||
|
||
.. _AN5471: | ||
https://www.st.com/resource/en/application_note/an5471-the-bluenrglp-bluenrglps-uart-bootloader-protocol-stmicroelectronics.pdf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
CONFIG_GPIO=y | ||
CONFIG_BT=y | ||
CONFIG_LOG=y |
11 changes: 11 additions & 0 deletions
11
samples/boards/sensortile_box_pro/ble-fw-upgrade/sample.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
sample: | ||
description: SensorTile.box Pro board ble firmware upgrade | ||
name: SensorTile.box Pro fw upgrade | ||
tests: | ||
sample.board.sensortile_box_pro.ble-fw-upgrade: | ||
harness: bluetooth | ||
platform_allow: sensortile_box_pro | ||
tags: bluetooth | ||
depends_on: | ||
- gpio | ||
- ble |
Oops, something went wrong.