From 5c3089ac3d191a6124e825847b53438030746df7 Mon Sep 17 00:00:00 2001 From: jimmytai Date: Sat, 26 Aug 2023 22:07:26 +0800 Subject: [PATCH] Fix device address is not the same with APP --- CHANGELOG.md | 1 + firmware/application/src/app_cmd.c | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e2671821..0641377d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ All notable changes to this project will be documented in this file. This project uses the changelog in accordance with [keepchangelog](http://keepachangelog.com/). Please use this to write notable changes, which is not the same as git commit log... ## [unreleased][unreleased] + - Fix device address is not the same with APP (@taichunmin) - Added initial version of the user guides (@GameTec-live) - Added support for pasting several command lines at once with prompt_toolkit (@doegox) - Added support for interrupting sleep sequence with a button press during animation (@doegox) diff --git a/firmware/application/src/app_cmd.c b/firmware/application/src/app_cmd.c index a916effd..b679a442 100644 --- a/firmware/application/src/app_cmd.c +++ b/firmware/application/src/app_cmd.c @@ -83,8 +83,12 @@ data_frame_tx_t *cmd_processor_get_device_chip_id(uint16_t cmd, uint16_t status, data_frame_tx_t *cmd_processor_get_device_address(uint16_t cmd, uint16_t status, uint16_t length, uint8_t *data) { uint32_t device_address[2]; + // The FICR value is a just a random number, with no knowledge + // of the Bluetooth Specification requirements for random addresses. + // So we need to set a Bluetooth LE random address as a static address. + // See: https://github.com/zephyrproject-rtos/zephyr/blob/7b6b1328a0cb96fe313a5e2bfc57047471df236e/subsys/bluetooth/controller/hci/nordic/hci_vendor.c#L29 device_address[0] = NRF_FICR->DEVICEADDR[0]; - device_address[1] = NRF_FICR->DEVICEADDR[1]; + device_address[1] = NRF_FICR->DEVICEADDR[1] | 0xC000; return data_frame_make(cmd, STATUS_DEVICE_SUCCESS, 6, (uint8_t *)(&device_address[0])); }