Zephyr 2.1 Released
David Leach
Hi,
Major enhancements with this release include (but are not limited to):
The detailed release notes can be found here: https://github.com/zephyrproject-rtos/zephyr/releases/tag/zephyr-v2.1.0 I would like to thank the community members who contributed to this release. In total 219 contributors provided PRs in the development of 2.1 with a total of 350+ community members providing issues, PRs, and comments. It has taken a lot of hard work from everyone in the Zephyr community! Starting now, the tree is open for new features targeting 2.2 release, which is tentatively scheduled for February 28th 2020.
Thank you again,
David Leach
David Leach
NXP Semiconductors phone: +1.210.241.6761 Email: david.leach@...
|
|||||||||||||||
|
|||||||||||||||
libstdc++ / thread safety
Markus <kho237115@...>
Dear all,
as I can't find any extensions to GCC for Zephyr, I am wondering if C++ / strings can already be used safely on Zephyr? Please have a look at the "Porting to New Hardware or Operating Systems" section of libstdc++ https://gcc.gnu.org/onlinedocs/libstdc++/manual/internals.html#internals.thread_safety Best Regards Markus
|
|||||||||||||||
|
|||||||||||||||
Re: bt_gatt_is_subscribed - any examples?
From: users@... <users@...>
On Behalf Of Lawrence King
Sent: Thursday, December 5, 2019 4:00 PM To: users@... Subject: [Zephyr-users] bt_gatt_is_subscribed - any examples?
Dear All:
I have a similar problem to what Frank Viren is seeing in his thread “bt_gatt_notify multiple characteristics”. How to determine the pointer to the right characteristic.
When my central connects to my device I want to send it several notifications. My device has several characteristics under the primary service. When the central connects (in this case the central is either an iPhone, or an Android phone), if I simply wait 200mS after the connection and sent the notifications with bt_gatt_notify() it ‘almost’ always works. Unfortunately sometimes Android or iOS take a little longer to subscribe for notifications, hence I would like to determine if the phone is ready to receive notifications rather than simply waiting 200mS.
I hunted through the bt_ apis and found bt_gatt_is_subscribed() which looks like I can loop testing to see if the central is ready and then send the notifications. Much better than blindly waiting 200mS.
bool Check if connection have subscribed to attribute. Check if connection has subscribed to attribute value change. The attribute object can be the so called Characteristic Declaration, which is usually declared with BT_GATT_CHARACTERISTIC followed by BT_GATT_CCC, or the Characteristic Value Declaration which is automatically created after the Characteristic Declaration when using BT_GATT_CHARACTERISTIC, or the Client Characteristic Configuration Descriptor (CCCD) which is created by BT_GATT_CCC. Return true if the attribute object has been subscribed. Parameters · conn: Connection object. · attr: Attribute object. · ccc_value: The subscription type, either notifications or indications.
OK, based on the documentation, this seems to be what I want, but the parameters are difficult for a newbie to understand: conn – yes I did declare this with BT_GATT_CHARACTERISTIC I know where it is in my source code, but how do I find a pointer to it? attr – this was automatically created with BT_GATT_CCC in the same place, but again how do I get a pointer to the attr? ccc_value – this is obviously an int, probably with definitions for the bits, but what symbolic enums or defines can I put in this parameter?
Unfortunately a google search of “bt_gatt_is_subscribed” only finds 8 results, the source code, the documentation (on the zephyr site, and on the nordic site), and 2 content aggregators. I did not find a single piece of code that calls this function, but there must be at least one call to the function in at least some test suite. bt_gatt_is_subscribed is never called in any of the zephyr/samples…
Can someone point me to an example please?
Lawrence King Principal Developer Connected Transport Market Unit +1(416)627-7302
CONFIDENTIAL: This e-mail and any attachments are confidential and intended solely for the use of the individual(s) to whom it is addressed. It can contain proprietary confidential information and be subject to legal privilege and/or subject to a non-disclosure Agreement. Unauthorized use, disclosure or copying is strictly prohibited. If you are not the/an addressee and are in possession of this e-mail, please delete the message and notify us immediately. Please consider the environment before printing this e-mail. Thank you.
|
|||||||||||||||
|
|||||||||||||||
LPC55S28JBD100 Zephyr OS
Wu, Hubert <Hubert.Wu@...>
|
|||||||||||||||
|
|||||||||||||||
frv
Hi Carles,
Thanks for the tip. I would be really surprised that I already have a stack issue, as the application is still very simple... Nevertheless it can't harm to have this option enabled. Br, Frank
|
|||||||||||||||
|
|||||||||||||||
Carles Cufi
Hi there,
One of the likely culprits is stack sizing. Please enable CONFIG_HW_STACK_PROTECTION and verify that one of your stacks is not overflowing.
Regards,
Carles
From: devel@... <devel@...>
On Behalf Of frv via Lists.Zephyrproject.Org
Sent: 06 December 2019 13:38 To: devel@... Cc: devel@... Subject: [Zephyr-devel] Persistent memory issue (NVS and FCB) - Zephyr V1.X versus V2 #ble #nrf52
Hi all, CONFIG_BT_SETTINGS=y CONFIG_FLASH=y CONFIG_FLASH_PAGE_LAYOUT=y CONFIG_FLASH_MAP=y CONFIG_FCB=y CONFIG_SETTINGS=y CONFIG_SETTINGS_FCB=y
CONFIG_BT_KEYS_OVERWRITE_OLDEST=y CONFIG_BT_SETTINGS=y CONFIG_FLASH=y CONFIG_FLASH_PAGE_LAYOUT=y CONFIG_FLASH_MAP=y CONFIG_NVS=y CONFIG_SETTINGS=y
CONFIG_FCB=y CONFIG_SETTINGS_FCB=y
|
|||||||||||||||
|
|||||||||||||||
frv
Hi all,
I have the following setup: - nrf52 demo kit running a simple BLE peripheral application - Raspberry Pi running a BLE central application A secured connection is made (authentication based on fixed passkey) and paired information is made persistent (bonded). I set in the peripheral's prj.conf file the following options: CONFIG_BT_SETTINGS=y
CONFIG_FLASH=y
CONFIG_FLASH_PAGE_LAYOUT=y
CONFIG_FLASH_MAP=y
CONFIG_FCB=y
CONFIG_SETTINGS=y
CONFIG_SETTINGS_FCB=y
In V1.X this sometimes resulted in system crash when restarting the peripheral or when the connection was broken en reconnected for paired devices When I built my project in V2.X with these options, I get ALWAYS a OS usage FAULT, Illegal load of EXC_RETURN into PC and results further in a FATAL ERROR and halts the system. However when I use these options in V2.X: CONFIG_BT_KEYS_OVERWRITE_OLDEST=y
CONFIG_BT_SETTINGS=y
CONFIG_FLASH=y
CONFIG_FLASH_PAGE_LAYOUT=y
CONFIG_FLASH_MAP=y
CONFIG_NVS=y
CONFIG_SETTINGS=y
no more system crash. I'm wondering if the issue is related to Flash Circular Buffer support (https://docs.zephyrproject.org/1.13.0/reference/kconfig/CONFIG_FCB.html) CONFIG_FCB=y
CONFIG_SETTINGS_FCB=y In the peripheral sample applic distributed with V2.X CONFIG_SETTINGS_FCB is replaced by CONFIG_NVS Best regards, Frank
|
|||||||||||||||
|
|||||||||||||||
Re: bt_gatt_notify multiple characteristics - always notification for the first characteristic
#ble
Hi all,
Solved... It looks like when BT_GATT_CCC is set in the service MACRO define, it takes not 1 but 2 indices to advance as also there is automatically a descriptor char added if you need to access the second attribute. Best regards, Frank
|
|||||||||||||||
|
|||||||||||||||
Cancelled Event: Zephyr Project: APIs - Tuesday, 31 December 2019
#cal-cancelled
devel@lists.zephyrproject.org Calendar <devel@...>
Cancelled: Zephyr Project: APIs This event has been cancelled. When: Where: Organizer: devel@... Description: Live meeting minutes: https://docs.google.com/
|
|||||||||||||||
|
|||||||||||||||
Cancelled Event: Zephyr Project: APIs - Tuesday, 24 December 2019
#cal-cancelled
devel@lists.zephyrproject.org Calendar <devel@...>
Cancelled: Zephyr Project: APIs This event has been cancelled. When: Where: Organizer: devel@... Description: Live meeting minutes: https://docs.google.com/
|
|||||||||||||||
|
|||||||||||||||
bt_gatt_notify multiple characteristics - always notification for the first characteristic
#ble
frv
Hi all,
I have a user defined BT GATT service with 2 user defined characteristics. The code is as simple as this for defining the GATT service. static struct bt_uuid_128 uuidButtonService = BT_UUID_INIT_128(
0xFB, 0x34, 0x9B, 0x5F, 0x80, 0x00, 0x00, 0x80,
0x00, 0x02, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00);
static struct bt_uuid_128 uuidButtonStateCallStart = BT_UUID_INIT_128(
0xFB, 0x34, 0x9B, 0x5F, 0x80, 0x00, 0x00, 0x80,
0x00, 0x02, 0x00, 0x01, 0x02, 0x00, 0x00, 0x00);
static struct bt_uuid_128 uuidButtonStateCallStop = BT_UUID_INIT_128(
0xFB, 0x34, 0x9B, 0x5F, 0x80, 0x00, 0x00, 0x80,
0x00, 0x02, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00);
BT_GATT_SERVICE_DEFINE(button_svc,
BT_GATT_PRIMARY_SERVICE(&uuidButtonService),
BT_GATT_CHARACTERISTIC(&uuidButtonStateCallStart, BT_GATT_CHRC_NOTIFY,
BT_GATT_PERM_NONE, NULL, NULL, NULL),
BT_GATT_CCC(buttonstate_ccc_cfg_changed, BT_GATT_PERM_READ | BT_GATT_PERM_WRITE),
BT_GATT_CHARACTERISTIC(&uuidButtonStateCallStop, BT_GATT_CHRC_NOTIFY,
BT_GATT_PERM_NONE, NULL, NULL, NULL),
BT_GATT_CCC(buttonstate_ccc_cfg_changed, BT_GATT_PERM_READ | BT_GATT_PERM_WRITE)
);
void button_notify(bool value, uint8_t buttonNbr)
{
printk("Button nbr %u - Notify value = %u\n", buttonNbr, value);
onOffFlag = value;
uint8_t index = 1;
if (buttonNbr == 0)
{
index = 1;
}
else
{
index = 2;
}
printk("--->index is %u\n", index);
bt_gatt_notify(NULL, &button_svc.attrs[index], &onOffFlag, sizeof(onOffFlag));
}
Nevertheless always the notification change of the first characteristic in the user defined service is trapped in the BT central application, despite the index value in button_svc.attrs changes between 1 and 2. I see in my central output that the service and its characteristics are well discovered. uuid service : 00000001-0100-0200-8000-00805f9b34fb uuid char1 : 00000002-0100-0200-8000-00805f9b34fb uuid char2 : 00000003-0100-0200-8000-00805f9b34fb Any idea's what I'm doing wrong? Thanks, Best regards, Frank
|
|||||||||||||||
|
|||||||||||||||
Cancelled Event: Zephyr Project: Dev Meeting - Thursday, 5 December 2019
#cal-cancelled
devel@lists.zephyrproject.org Calendar <devel@...>
Cancelled: Zephyr Project: Dev Meeting This event has been cancelled. When: Where: Organizer: devel@... Description:
|
|||||||||||||||
|
|||||||||||||||
Re: Linkage Zephyr V1.13 versus V2.X
Hi Lawrence,
As far as I know this one CONFIG_BT_GATT_DYNAMIC_DB=y did the trick as specified in your prj.conf as well. Br, Frank
|
|||||||||||||||
|
|||||||||||||||
Re: Linkage Zephyr V1.13 versus V2.X
This is what I have my prj.conf, yours might be different, an I’m not sure what I have is 100% correct:
# BT settings CONFIG_BT=y CONFIG_BT_SMP=y CONFIG_BT_SIGNING=y CONFIG_BT_BONDABLE=y CONFIG_BT_PERIPHERAL=y CONFIG_BT_GATT_DYNAMIC_DB=y CONFIG_BT_GATT_READ_MULTIPLE=y CONFIG_BT_GATT_DIS=y CONFIG_BT_ATT_PREPARE_COUNT=2 CONFIG_BT_PRIVACY=y CONFIG_BT_DEVICE_NAME="My Device" CONFIG_BT_DEVICE_APPEARANCE=833 CONFIG_BT_SETTINGS=n
Lawrence King Principal Developer +1(416)627-7302
From: devel@... <devel@...>
On Behalf Of frv
Sent: Wednesday, December 4, 2019 11:23 AM To: devel@... Subject: Re: [Zephyr-devel] Linkage Zephyr V1.13 versus V2.X
Hi Lawrence,
|
|||||||||||||||
|
|||||||||||||||
Re: Linkage Zephyr V1.13 versus V2.X
frv
Hi all,
Sorry replied the solution to myself and not to the group, but solution is to set the option "CONFIG_BT_GATT_DYNAMIC_DB=y" in the application prj.conf file, otherwise it is no longer possible to call the function bt_gatt_service_register when creating a GATT service (dynamically...). Best regards, Frank
|
|||||||||||||||
|
|||||||||||||||
Re: Linkage Zephyr V1.13 versus V2.X
Hi Lawrence,
Correct, but this one was quite easy to find as the compiler raised the issue as the function parameters no longer matched. Having to specify the option in the prj.conf to support dynamic BT GATT service creation was quite harder :). I had no glue the bt_gatt_service_register code was no longer linked in when the option "CONFIG_BT_GATT_DYNAMIC_DB=y" was not set in the prj.conf file. Thanks for the response, Frank
|
|||||||||||||||
|
|||||||||||||||
Re: Linkage Zephyr V1.13 versus V2.X
I had the same issue when moving forward kernel versions. The API for
At the top level get rid of the bt_gatt_ccc_cfg variables (my code has two characteristics) :
#ifndef NEW_BT_STACK static struct bt_gatt_ccc_cfg iks_atom_ccc_cfg[BT_GATT_CCC_MAX]; static struct bt_gatt_ccc_cfg iks_mtoa_ccc_cfg[BT_GATT_CCC_MAX]; #endif
And inside the bt_gatt_attr change the parameters to the BT_GATT_CCC macro, delete the first parameter it is no longer needed, and add a new 3rd parameter (same thing in two places for me):
#ifdef NEW_BT_STACK BT_GATT_CCC(iks_atom_ccc_cfg_changed,BT_GATT_PERM_WRITE_ENCRYPT), // BT_GATT_CCC(iks_atom_ccc_cfg_changed,BT_GATT_PERM_READ | BT_GATT_PERM_WRITE), // BT_GATT_CCC(iks_atom_ccc_cfg_changed,BT_GATT_PERM_READ | BT_GATT_PERM_WRITE_ENCRYPT), #else //NEW_BT_STACK BT_GATT_CCC(iks_atom_ccc_cfg, iks_atom_ccc_cfg_changed), #endif //NEW_BT_STACK
Lawrence King Principal Developer +1(416)627-7302
From: devel@... <devel@...>
On Behalf Of frv
Sent: Wednesday, December 4, 2019 2:19 AM To: devel@... Subject: [Zephyr-devel] Linkage Zephyr V1.13 versus V2.X
[Edited Message Follows] Hi all,
Recently I have moved from Zephyr 1.13 to V2.
I ported my simple BLE peripheral application based on the sample code peripheral_hr from V1.13 to V2.
However I can't seem to get it build anymore due to a linkage issue. As far as I can see the sources are well compiled but for some reason the linker reports an undefined reference.
"/home/frv/develop/zephyrproject/zephyr/samples/bluetooth/peripheral_hrORIGI/src/button.c:78: undefined reference to `bt_gatt_service_register'"
In my setup the GATT services are still defined in separate files. So next to my main.c that calls the init function (button_init()) I have the sources button.c and button.h file where I define my own GATT service (cfr. hrs.c, hrs.h as done in V1.13) to follow up a button press.
src/main.c /button.c
The CMakeLists.txt has as content (which is pretty simple):
# SPDX-License-Identifier: Apache-2.0
cmake_minimum_required(VERSION 3.13.1)
include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) project(peripheral_hr)
FILE(GLOB app_sources src/*.c) target_sources(app PRIVATE ${app_sources} )
zephyr_library_include_directories($ENV{ZEPHYR_BASE}/samples/bluetooth) //has the button.h file zephyr_library_include_directories($ENV{ZEPHYR_BASE}/samples/bluetooth/gatt)
In the button.c code snippet: ... static struct bt_gatt_service button_svc = BT_GATT_SERVICE(attrs);
void button_init(void) { int result = bt_gatt_service_register(&button_svc); } ...
I have spend some time on looking at the boilerplate concepts but so far without any luck to prevent the linker error.
Any idea's what the issue could be and how to solve this properly. Linkage order?
BTW when I do the call, bt_gatt_service_register, in the main.c this is not seen as an undefined reference.
Thanks, Best regards, Frank
|
|||||||||||||||
|
|||||||||||||||
Linkage Zephyr V1.13 versus V2.X
Hi all,
Recently I have moved from Zephyr 1.13 to V2.
I ported my simple BLE peripheral application based on the sample code peripheral_hr from V1.13 to V2.
However I can't seem to get it build anymore due to a linkage issue.
As far as I can see the sources are well compiled but for some reason the linker reports an undefined reference.
"/home/frv/develop/zephyrproject/zephyr/samples/bluetooth/peripheral_hrORIGI/src/button.c:78: undefined reference to `bt_gatt_service_register'"
In my setup the GATT services are still defined in separate files.
So next to my main.c that calls the init function (button_init()) I have the sources button.c and button.h file where I define my own GATT service (cfr. hrs.c, hrs.h as done in V1.13) to follow up a button press.
src/main.c
/button.c
The CMakeLists.txt has as content (which is pretty simple):
# SPDX-License-Identifier: Apache-2.0
cmake_minimum_required(VERSION 3.13.1)
include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE)
project(peripheral_hr)
FILE(GLOB app_sources src/*.c)
target_sources(app PRIVATE
${app_sources}
)
zephyr_library_include_directories($ENV{ZEPHYR_BASE}/samples/bluetooth)
//has the button.h file
zephyr_library_include_directories($ENV{ZEPHYR_BASE}/samples/bluetooth/gatt)
In the button.c code snippet:
...
static struct bt_gatt_service button_svc = BT_GATT_SERVICE(attrs);
void button_init(void)
{
int result = bt_gatt_service_register(&button_svc);
}
...
I have spend some time on looking at the boilerplate concepts but so far without any luck to prevent the linker error.
I also had a look at this : https://github.com/zephyrproject-rtos/zephyr/issues/8851 Any idea's what the issue could be and how to solve this properly. Linkage order?
BTW when I do the call, bt_gatt_service_register, in the main.c this is not seen as an undefined reference.
Thanks,
Best regards,
Frank
|
|||||||||||||||
|
|||||||||||||||
Zephyr 2.1.0-rc3 tagged
David Leach
Hi Zephyr developers,
Zephyr 2.1.0-rc3 release candidate has been tagged.
Current issue status:
Testing Zephyr release candidate is requested; please, test the code base and file bug reports so they can be addressed before the release deadline.
The full release log can be found here: https://github.com/zephyrproject-rtos/zephyr/releases/tag/v2.1.0-rc3
More details about Zephyr releases is found here: https://github.com/zephyrproject-rtos/zephyr/wiki/Program-Management
Thank you to everybody who contributed to this release!
David Leach
David Leach
NXP Semiconductors phone: +1.210.241.6761 Email: david.leach@...
|
|||||||||||||||
|
|||||||||||||||
Hi Mayank:
I had a similar requirement, also without a button on the same Nordic chip. I simply copied this file into my project, and called smp_svr_init() from my main() after bluetooth was up and running
zephyrproject/zephyr/samples/boards/nrf52/mesh/onoff_level_lighting_vnd_app/src/smp_svr.c
This creates a Bluetooth advertisement for OTA update, and I can push new images from mu Ubuntu system with:
Use mcumgr to upload the new version over Bluetooth ----------------------------------------- sudo bash # must run as root to access the Bluetooth device mcumgr conn add zephyr type=ble connstring=peer_name="My Device" # make a symbolic name for the device mcumgr -c zephyr image list # Query device for its current image list. mcumgr -c zephyr image upload build/zephyr/zephyr.signed.bin # Upload new image to device. mcumgr -c zephyr image test <image-hash> # Tell the device to run the new image on its next boot ("test" the new image). mcumgr -c zephyr reset # Reboot the device. mcumgr -c zephyr image list # Query device for its current image list; ensure new image is running. mcumgr -c zephyr image confirm # Make the image swap permanent.
You do need to get the right bits in your prj.conf file, I think these are all you need, but there may be more… # mcuboot CONFIG_IMG_MANAGER=y CONFIG_MCUBOOT_IMG_MANAGER=y CONFIG_MCUBOOT_TRAILER_SWAP_TYPE=y CONFIG_IMG_BLOCK_BUF_SIZE=512 # Allow for large Bluetooth data packets. CONFIG_BT_L2CAP_TX_MTU=260 CONFIG_BT_RX_BUF_LEN=260 # Enable the Bluetooth and shell mcumgr transports. CONFIG_MCUMGR_SMP_BT=y #CONFIG_MCUMGR_SMP_SHELL=y #CONFIG_MCUMGR_SMP_UART=y # Required by the `taskstat` command. #CONFIG_THREAD_MONITOR=y # Enable statistics and statistic names. #CONFIG_STATS=y #CONFIG_STATS_NAMES=y # Enable all core commands. #CONFIG_MCUMGR_CMD_FS_MGMT=y CONFIG_MCUMGR_CMD_IMG_MGMT=y CONFIG_MCUMGR_CMD_OS_MGMT=y #CONFIG_MCUMGR_CMD_STAT_MGMT=y
Unfortunately you will need to reflash your units with JTAG/SWD to get the smp_svr in, but after that you can do OTA.
Lawrence King Principal Developer +1(416)627-7302
From: devel@... <devel@...>
On Behalf Of Mayank
Sent: Tuesday, December 3, 2019 6:47 AM To: devel@... Subject: [Zephyr-devel] DFU OTA by using mcuboot bootloader in serial recovery mode #ble #hci #nrf52480 #uart
Hello All,
|
|||||||||||||||
|