-
Notifications
You must be signed in to change notification settings - Fork 6.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
sensortile_box_pro board: add sample to upgrade BlueNRG SoC firmware #74255
Closed
Closed
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
11 changes: 11 additions & 0 deletions
11
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,11 @@ | ||
# 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) | ||
target_sources(app PRIVATE src/ble_fw.c) |
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 | ||
|
||
mainmenu "Sensortile.box PRO ble f/w upgrade" | ||
|
||
config BLOB_ENABLED | ||
bool "Use ble f/w image blob" | ||
default y | ||
|
||
source "Kconfig.zephyr" |
109 changes: 109 additions & 0 deletions
109
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,109 @@ | ||
.. zephyr:code-sample:: sensortile_box_pro_sample_ble_fwupg | ||
:name: ST SensorTile.box Pro BLE Firmware Upgrade | ||
|
||
Upgrade the BLE firmware on STEVAL-MKBOXPRO board | ||
|
||
Overview | ||
******** | ||
This sample provides a simple method to upgrade the firmware for | ||
the BLE chip present on :ref:`sensortile_box_pro_board` board. | ||
It is based on 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 :samp:`/dev/ttyUSB{x}` or :samp:`/dev/ttyACM{x}` (with x being 0, 1, 2, ...). | ||
The ``-b`` option sets baud rate ignoring the value from config. | ||
|
||
Building and Running | ||
******************** | ||
|
||
To build and flash the sample, it is required fetching the controller-only BLE f/w | ||
image for sensortile_box_pro board, which is hosted by external repo | ||
(see `stsw-mkbox-bleco`_ for more information): | ||
|
||
To fetch Binary Blobs: | ||
|
||
.. code-block:: console | ||
|
||
west blobs fetch stm32 | ||
|
||
Then, build the sample: | ||
|
||
.. 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 | ||
|
||
.. _stsw-mkbox-bleco: | ||
https://www.st.com/en/embedded-software/stsw-mkbox-bleco.html |
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,2 @@ | ||
CONFIG_GPIO=y | ||
CONFIG_LOG=y |
13 changes: 13 additions & 0 deletions
13
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,13 @@ | ||
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 | ||
- uart | ||
extra_configs: | ||
- CONFIG_BLOB_ENABLED=n |
16 changes: 16 additions & 0 deletions
16
samples/boards/sensortile_box_pro/ble-fw-upgrade/src/ble_fw.c
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,16 @@ | ||
/* | ||
* Copyright (c) 2024 STMicroelectronics | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
#include <stdint.h> | ||
|
||
const uint8_t ble_fw_img[] = { | ||
/* if not enabled do nothing, just remove blob dependency */ | ||
#ifdef CONFIG_BLOB_ENABLED | ||
#include <dtm.bin.inc> | ||
#endif | ||
}; | ||
|
||
const uint32_t ble_fw_img_len = sizeof(ble_fw_img); |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the link provided should mention the possibility of downloading some specific blob file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I forgot it. Now there is a mention to it.