<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://devzone.nordicsemi.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>nrf5340-dk</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/77364/nrf5340-dk</link><description>Hello Sirs 
 I have two questions about the nrf5340-dk evaluation board. 
 The first one is how can I get the scan data of an advertising device? 
 And the second is that how can I change the TX power? 
 There is a sample program (hci_pwr_ctrl) for this</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 14 Jul 2021 13:52:28 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/77364/nrf5340-dk" /><item><title>RE: nrf5340-dk</title><link>https://devzone.nordicsemi.com/thread/320054?ContentTypeID=1</link><pubDate>Wed, 14 Jul 2021 13:52:28 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:458c1535-328a-45af-a1cb-946ef28806a5</guid><dc:creator>ovrebekk</dc:creator><description>&lt;p&gt;Hi&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Do you need dynamic power control, or is static power configuration sufficient?&lt;/p&gt;
&lt;p&gt;If static power configuration is enough I would recommend starting out with some other Bluetooth example more related to what you are trying to do, and then configure the power consumption from there.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;It seems there are some issues with Bluetooth power control in Zephyr/NCS, and that setting this is not as straight forward as I expected.&amp;nbsp;Unfortunately the month of July is peak holiday season here in Norway, so it might take some time to get to the bottom of this, but I will try to find some time to look into this next week.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Best regards&lt;br /&gt;Torbjørn&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf5340-dk</title><link>https://devzone.nordicsemi.com/thread/319781?ContentTypeID=1</link><pubDate>Tue, 13 Jul 2021 12:07:02 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:bb53a76f-35e9-4b80-9d4d-318116e02a40</guid><dc:creator>saeed mahvis</dc:creator><description>&lt;p&gt;Thank you very much for your immediate response. I have changed the CONFIG file as you said , but still I have received the same error&lt;/p&gt;
&lt;p&gt;(Set Tx Power err: -5 reason 0x00) message and the Tx power doesn&amp;#39;t change .Bellow is my entire code:&lt;/p&gt;
&lt;p&gt;/* main.c - Application main entry point */&lt;/p&gt;
&lt;p&gt;/*&lt;br /&gt; * Copyright (c) 2015-2016 Intel Corporation&lt;br /&gt; *&lt;br /&gt; * SPDX-License-Identifier: Apache-2.0&lt;br /&gt; */&lt;/p&gt;
&lt;p&gt;#include &amp;lt;zephyr/types.h&amp;gt;&lt;br /&gt;#include &amp;lt;stddef.h&amp;gt;&lt;br /&gt;#include &amp;lt;sys/printk.h&amp;gt;&lt;br /&gt;#include &amp;lt;sys/util.h&amp;gt;&lt;/p&gt;
&lt;p&gt;#include &amp;lt;bluetooth/bluetooth.h&amp;gt;&lt;br /&gt;#include &amp;lt;bluetooth/hci.h&amp;gt;&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;#include &amp;lt;sys/byteorder.h&amp;gt;&lt;br /&gt;#include &amp;lt;bluetooth/hci_vs.h&amp;gt;&lt;br /&gt;//#include &amp;lt;bluetooth/conn.h&amp;gt;&lt;br /&gt;//#include &amp;lt;bluetooth/uuid.h&amp;gt;&lt;br /&gt;//#include &amp;lt;bluetooth/gatt.h&amp;gt;&lt;br /&gt;//#include &amp;lt;bluetooth/services/hrs.h&amp;gt;&lt;/p&gt;
&lt;p&gt;#define DEVICE_NAME CONFIG_BT_DEVICE_NAME&lt;br /&gt;#define DEVICE_NAME_LEN (sizeof(DEVICE_NAME) - 1)&lt;/p&gt;
&lt;p&gt;static uint16_t default_conn_handle;&lt;br /&gt;static const int8_t txp[8] = {4, 0, -3, -8,&lt;br /&gt; -15, -18, -23, -30};&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;/*&lt;br /&gt; * Set Advertisement data. Based on the Eddystone specification:&lt;br /&gt; * &lt;a href="https://github.com/google/eddystone/blob/master/protocol-specification.md"&gt;github.com/.../protocol-specification.md&lt;/a&gt;&lt;br /&gt; * &lt;a href="https://github.com/google/eddystone/tree/master/eddystone-url"&gt;github.com/.../eddystone-url&lt;/a&gt;&lt;br /&gt; */&lt;br /&gt;#ifndef IBEACON_RSSI&lt;br /&gt;#define IBEACON_RSSI 0xc8&lt;br /&gt;#endif&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;static const struct bt_data ad[] = { // bt_data ibeacon_ad[] = {&lt;br /&gt; BT_DATA_BYTES(BT_DATA_FLAGS, BT_LE_AD_NO_BREDR),&lt;br /&gt; BT_DATA_BYTES(BT_DATA_MANUFACTURER_DATA,&lt;br /&gt; 0x00, 0x4c, /* Apple */&lt;br /&gt; 0x02, 0x15, /* iBeacon */&lt;br /&gt; 0x18, 0xee, 0x15, 0x16, /* UUID[15..12] */&lt;br /&gt; 0x00, 0x01, /* UUID[11..10] */&lt;br /&gt; 0x4b, 0xec, /* UUID[9..8] */&lt;br /&gt; 0xad, 0x96, /* UUID[7..6] */&lt;br /&gt; 0xbc, 0xb9, 0x6d, 0x16, 0x6e, 0x97, /* UUID[5..0] */&lt;br /&gt; 0x00, 0x10, /* Major */&lt;br /&gt; 0x00, 0xff, /* Minor */&lt;br /&gt; IBEACON_RSSI), /* Calibrated RSSI @ 1m */&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;};&lt;/p&gt;
&lt;p&gt;/*&lt;br /&gt;static const struct bt_data ad[] = {&lt;br /&gt; BT_DATA_BYTES(BT_DATA_FLAGS, BT_LE_AD_GENERAL),&lt;br /&gt; BT_DATA_BYTES(BT_DATA_UUID16_ALL, 0xaa,0xfe),&lt;br /&gt; &lt;br /&gt; BT_DATA_BYTES(BT_DATA_SVC_DATA16,&lt;br /&gt; 0xaa, 0xfe, // Eddystone UUID //&lt;br /&gt; 0x10, // Eddystone-URL frame type //&lt;br /&gt; 0x00, // Calibrated Tx power at 0m //&lt;br /&gt; 0x00, // URL Scheme Prefix http://www. //&lt;br /&gt; &amp;#39;z&amp;#39;, &amp;#39;e&amp;#39;, &amp;#39;p&amp;#39;, &amp;#39;h&amp;#39;, &amp;#39;y&amp;#39;, &amp;#39;r&amp;#39;,&lt;br /&gt; &amp;#39;p&amp;#39;, &amp;#39;r&amp;#39;, &amp;#39;o&amp;#39;, &amp;#39;j&amp;#39;, &amp;#39;e&amp;#39;, &amp;#39;c&amp;#39;, &amp;#39;t&amp;#39;,&lt;br /&gt; 0x08), // .org //&lt;/p&gt;
&lt;p&gt;// BT_DATA_BYTES(BT_DATA_GAP_APPEARANCE,&amp;quot;Nasser&amp;quot;)&lt;br /&gt;};&lt;br /&gt;*/&lt;br /&gt;/* Set Scan Response data */&lt;br /&gt;static const struct bt_data sd[] = {&lt;br /&gt; BT_DATA(BT_DATA_NAME_COMPLETE, DEVICE_NAME, DEVICE_NAME_LEN),&lt;br /&gt; &lt;br /&gt;};&lt;/p&gt;
&lt;p&gt;static void bt_ready(int err)&lt;br /&gt;{&lt;br /&gt; char addr_s[BT_ADDR_LE_STR_LEN];&lt;br /&gt; bt_addr_le_t addr = {0};&lt;/p&gt;
&lt;p&gt;printk(&amp;quot;Display Addres Content == %d\n&amp;quot;, addr);&lt;br /&gt; printk(&amp;quot;Display Addres Content of err in bt-ready %d\n&amp;quot;, err);&lt;br /&gt; size_t count = 1;&lt;/p&gt;
&lt;p&gt;if (err) {&lt;br /&gt; printk(&amp;quot;Bluetooth init failed (err %d)\n&amp;quot;, err);&lt;br /&gt; return;&lt;br /&gt; }&lt;/p&gt;
&lt;p&gt;printk(&amp;quot;Bluetooth initialized By Mahvis\n&amp;quot;);&lt;br /&gt; &lt;br /&gt; &lt;br /&gt; /* Start advertising */&lt;br /&gt; err = bt_le_adv_start(BT_LE_ADV_NCONN_IDENTITY, ad, ARRAY_SIZE(ad), // BT_LE_ADV_NCONN&lt;br /&gt; sd, ARRAY_SIZE(sd));&lt;br /&gt; printk(&amp;quot;Arrey Size %s\n&amp;quot;, ARRAY_SIZE(sd));&lt;/p&gt;
&lt;p&gt;printk(&amp;quot;ad = %d\n&amp;quot;,ad );&lt;/p&gt;
&lt;p&gt;&lt;br /&gt; if (err) {&lt;br /&gt; printk(&amp;quot;Advertising failed to start (err %d)\n&amp;quot;, err);&lt;br /&gt; return;&lt;br /&gt; }&lt;/p&gt;
&lt;p&gt;&lt;br /&gt; /* For connectable advertising you would use&lt;br /&gt; * bt_le_oob_get_local(). For non-connectable non-identity&lt;br /&gt; * advertising an non-resolvable private address is used;&lt;br /&gt; * there is no API to retrieve that.&lt;br /&gt; */&lt;/p&gt;
&lt;p&gt;bt_id_get(&amp;amp;addr, &amp;amp;count);&lt;br /&gt; bt_addr_le_to_str(&amp;amp;addr, addr_s, sizeof(addr_s));&lt;/p&gt;
&lt;p&gt;printk(&amp;quot;Beacon started, advertising as %s\n&amp;quot;, addr_s);&lt;br /&gt;}&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;static void set_tx_power(uint8_t handle_type, uint16_t handle, int8_t tx_pwr_lvl)&lt;br /&gt;{&lt;br /&gt; struct bt_hci_cp_vs_write_tx_power_level *cp;&lt;br /&gt; struct bt_hci_rp_vs_write_tx_power_level *rp;&lt;br /&gt; struct net_buf *buf, *rsp = NULL;&lt;br /&gt; int err;&lt;/p&gt;
&lt;p&gt;buf = bt_hci_cmd_create(BT_HCI_OP_VS_WRITE_TX_POWER_LEVEL,&lt;br /&gt; sizeof(*cp));&lt;br /&gt; if (!buf) {&lt;br /&gt; printk(&amp;quot;Unable to allocate command buffer\n&amp;quot;);&lt;br /&gt; return;&lt;br /&gt; }&lt;/p&gt;
&lt;p&gt;cp = net_buf_add(buf, sizeof(*cp));&lt;br /&gt; cp-&amp;gt;handle = sys_cpu_to_le16(handle);&lt;br /&gt; cp-&amp;gt;handle_type = handle_type;&lt;br /&gt; cp-&amp;gt;tx_power_level = tx_pwr_lvl;&lt;/p&gt;
&lt;p&gt;err = bt_hci_cmd_send_sync(BT_HCI_OP_VS_WRITE_TX_POWER_LEVEL,&lt;br /&gt; buf, &amp;amp;rsp);&lt;br /&gt; if (err) {&lt;br /&gt; uint8_t reason = rsp ?&lt;br /&gt; ((struct bt_hci_rp_vs_write_tx_power_level *)&lt;br /&gt; rsp-&amp;gt;data)-&amp;gt;status : 0;&lt;br /&gt; printk(&amp;quot;Set Tx power err: %d reason 0x%02x\n&amp;quot;, err, reason);&lt;br /&gt; return;&lt;br /&gt; }&lt;/p&gt;
&lt;p&gt;rp = (void *)rsp-&amp;gt;data;&lt;br /&gt; printk(&amp;quot;Actual Tx Power: %d\n&amp;quot;, rp-&amp;gt;selected_tx_power);&lt;/p&gt;
&lt;p&gt;net_buf_unref(rsp);&lt;br /&gt;}&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;void main(void)&lt;br /&gt;{&lt;br /&gt; int err;&lt;/p&gt;
&lt;p&gt;printk(&amp;quot;Starting Beacon Demo By Mahvis\n&amp;quot;);&lt;/p&gt;
&lt;p&gt;&lt;br /&gt; &lt;br /&gt; /* Initialize the Bluetooth Subsystem */&lt;br /&gt; err = bt_enable(bt_ready);&lt;br /&gt; if (err) {&lt;br /&gt; printk(&amp;quot;Bluetooth init failed (err %d)\n&amp;quot;, err);&lt;br /&gt; }&lt;/p&gt;
&lt;p&gt;set_tx_power(BT_HCI_VS_LL_HANDLE_TYPE_ADV,&lt;br /&gt; 0,-30 );&lt;/p&gt;
&lt;p&gt;&lt;br /&gt; k_sleep(K_SECONDS(5));&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;}&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf5340-dk</title><link>https://devzone.nordicsemi.com/thread/319736?ContentTypeID=1</link><pubDate>Tue, 13 Jul 2021 09:27:03 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a85223a5-d370-4a6e-94c6-d1cbbf194b88</guid><dc:creator>ovrebekk</dc:creator><description>&lt;p&gt;Hi&lt;/p&gt;
&lt;p&gt;As long as you start the &lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/1.6.0/nrf/include/bluetooth/scan.html"&gt;scan library&lt;/a&gt; in active scanning mode you should get both the advertising data and the scan data.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Whether or not to use active scanning mode is defined in the call to bt_scan_start, as shown &lt;a href="https://github.com/nrfconnect/sdk-nrf/blob/master/samples/bluetooth/central_uart/src/main.c#L592"&gt;here&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;In general, to set the TX power you have to set one of the &lt;a href="https://docs.zephyrproject.org/latest/reference/kconfig/choice_376.html#choice-376"&gt;BT_CTLR_TX_PWR defines&lt;/a&gt;&amp;nbsp;in your prj.conf file.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;As an example, to enable +3 dBm output power, set the config like this:&lt;br /&gt;&lt;em&gt;CONFIG_BT_CTLR_TX_PWR_PLUS_3=y&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;Best regards&lt;br /&gt;Torbjørn&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>