<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://test-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>BLE Communication between two nrf5340</title><link>https://test-devzone.nordicsemi.com/f/nordic-q-a/87456/ble-communication-between-two-nrf5340</link><description>Hello, 
 
 I have on nrf5340 an application, that meassures Temperature every second. I need to send the data to another nrf5340. I am going throw the bluetooth samples, but can&amp;#39;t find, how can I astabilish the connection between two nrf5340s. Could you</description><dc:language>en-US</dc:language><generator>Telligent Community 13 Non-Production</generator><lastBuildDate>Mon, 23 May 2022 11:08:15 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://test-devzone.nordicsemi.com/f/nordic-q-a/87456/ble-communication-between-two-nrf5340" /><item><title>RE: BLE Communication between two nrf5340</title><link>https://test-devzone.nordicsemi.com/thread/368983?ContentTypeID=1</link><pubDate>Mon, 23 May 2022 11:08:15 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2c80d2cb-862b-4360-a4a5-bc32f4b759b7</guid><dc:creator>user77782</dc:creator><description>&lt;p&gt;Hi,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Please create a new support case since this issue is away from the original scope.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;-Amanda&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BLE Communication between two nrf5340</title><link>https://test-devzone.nordicsemi.com/thread/368962?ContentTypeID=1</link><pubDate>Mon, 23 May 2022 09:37:09 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8df5c818-dcd5-4dcf-b5d7-a519771f86e8</guid><dc:creator>user115726</dc:creator><description>&lt;p&gt;Hello Amanda&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I&amp;#39;m now trying to set the directed advertising on the peripheral, so it accepts only connections request from my peer, but I can&amp;#39;t find, in which format should i set the address of the central. I tried to change it this way in peripheral main, but it did not connect.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;err = bt_le_adv_start(((struct bt_le_adv_param[]) { 
{ .id = BT_ID_DEFAULT, .sid = 0, .secondary_max_skip = 0, 
.options = (BT_LE_ADV_OPT_CONNECTABLE), .interval_min = (0x00a0), 
.interval_max = (0x00f0), .peer = {0xF0,0x33,0x4D,0x3A,0x9F,0x6B}, } }),
ad, ARRAY_SIZE(ad), sd, ARRAY_SIZE(sd));&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;I am also a little bit confused of the Bluetooth LE Device Adress in addr.h library.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;/** Bluetooth Device Address */
typedef struct {
	uint8_t  val[BT_ADDR_SIZE];
} bt_addr_t;
/**/

/** Length in bytes of an LE Bluetooth address. Not packed, so no sizeof() */
#define BT_ADDR_LE_SIZE 7
/** Bluetooth LE Device Address */
typedef struct {
	uint8_t      type;
	bt_addr_t a;
} bt_addr_le_t;&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;What does the variable type mean and in which&amp;nbsp;way should I write the bt_addr_t?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Here is the log from J-Link RTT Viewer&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;00&amp;gt; [00:00:00.272,583] &amp;lt;inf&amp;gt; fs_nvs: 2 Sectors of 4096 bytes
00&amp;gt; [00:00:00.272,583] &amp;lt;inf&amp;gt; fs_nvs: alloc wra: 0, fc8
00&amp;gt; [00:00:00.272,583] &amp;lt;inf&amp;gt; fs_nvs: data wra: 0, 2c
00&amp;gt; [00:00:00.300,354] &amp;lt;inf&amp;gt; bt_hci_core: No ID address. App must call settings_load()
00&amp;gt; [00:00:00.300,354] &amp;lt;inf&amp;gt; peripheral_uart: Bluetooth initialized
00&amp;gt; [00:00:00.949,981] &amp;lt;inf&amp;gt; peripheral_uart: Connected F0:33:4D:3A:9F:6B (random)
00&amp;gt; [00:00:01.664,978] &amp;lt;wrn&amp;gt; peripheral_uart: Failed to send data over BLE connection&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Sorry for maybe stupid questions, I am just beginner and did not find&amp;nbsp;it anywhere.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BLE Communication between two nrf5340</title><link>https://test-devzone.nordicsemi.com/thread/367769?ContentTypeID=1</link><pubDate>Fri, 13 May 2022 09:00:36 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:de8c6a7d-09ba-4e5c-a372-7b2182a00af0</guid><dc:creator>user77782</dc:creator><description>&lt;p&gt;Happy to know you fix the issue.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;-Amanda&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BLE Communication between two nrf5340</title><link>https://test-devzone.nordicsemi.com/thread/367761?ContentTypeID=1</link><pubDate>Fri, 13 May 2022 08:03:19 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7b822090-9f81-46f8-bf71-abacaaabd1a9</guid><dc:creator>user115726</dc:creator><description>&lt;p&gt;I just solved the issue with the output, I completely forgot that data is an array, so i need to print it like&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;printk(&amp;quot;%x\n&amp;quot;, data[0]);&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Just a beginners mistake :D&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BLE Communication between two nrf5340</title><link>https://test-devzone.nordicsemi.com/thread/367757?ContentTypeID=1</link><pubDate>Fri, 13 May 2022 07:28:54 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b6e221fb-abe3-49a3-a761-567beb2a6b22</guid><dc:creator>user115726</dc:creator><description>&lt;p&gt;Hi Amanda&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;thank you for advice. I have still problems with&amp;nbsp;the received data.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;This is how is changed the ble_write_thread, I just added array number and variable length, and I&amp;#39;m increasing the number everz second and send it to the central.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;uint8_t number[1];
uint16_t length;

void ble_write_thread(void)
{
	/* Don&amp;#39;t go any further until BLE is initialized */
	k_sem_take(&amp;amp;ble_init_ok, K_FOREVER);
	length = sizeof(number);
	number[0] = 0b0000001;
	for (;;) {
		if (bt_nus_send(NULL, number, length)) {
			LOG_WRN(&amp;quot;Failed to send data over BLE connection&amp;quot;);
		}
		number[0] ++;
		length = sizeof(number);
		k_msleep(1000);
		printk(&amp;quot;number %x\t length %x\n&amp;quot;, number[0], length);
	}
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;The output in PuTTy of the peripheral looks like this:&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;Starting Nordic UART service example

number 2         length 1

number 3         length 1

number 4         length 1

number 5         length 1
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;When I do no changes to the central, the UART outputs in PuTTy are characters, which I do not need, I need the numbers, so I made following change.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;static uint8_t ble_data_received(struct bt_nus_client *nus,
						uint8_t *data, uint16_t len)
{
	ARG_UNUSED(nus);

	printk(&amp;quot;%x\n&amp;quot;, &amp;amp;data);
	
	return BT_GATT_ITER_CONTINUE;
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;In the central I just let the received data print to console like this (without sending it to UART).&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;But now I don&amp;#39;t get the data I send, I get something like this:&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;pre class="ui-code" data-mode="text"&gt;20003b94

20003b94

20003b94

20003b94

20003b94

20003b94

20003b94

20003b94
&lt;/pre&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Some data, I don&amp;#39;t understand, and every time same. How is it possible?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;I think in the central I work with wrong data, but I can&amp;#39;t find the right.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;I also tried another sample, peripheral_hr and central_hr, I think this programm does the same thing as I tried, the peripheral sends every second increased&amp;nbsp;number, and the central should receive it and print it, but it prints every time the same number.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;PuTTy - Peripheral&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;pre class="ui-code" data-mode="text"&gt;Heartrate 141

Heartrate 142

Heartrate 143

Heartrate 144

Heartrate 145

Heartrate 146

Heartrate 147

Heartrate 148

Heartrate 149
&lt;/pre&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;PuTTy - Central&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;pre class="ui-code" data-mode="text"&gt;[NOTIFICATION] data 20005dc0 length 2

[NOTIFICATION] data 20005dc0 length 2

[NOTIFICATION] data 20005dc0 length 2

[NOTIFICATION] data 20005dc0 length 2

[NOTIFICATION] data 20005dc0 length 2

[NOTIFICATION] data 20005dc0 length 2

[NOTIFICATION] data 20005dc0 length 2

[NOTIFICATION] data 20005dc0 length 2

[NOTIFICATION] data 20005dc0 length 2

&lt;/pre&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;I think it must be some other parameter read.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Could you please give me an advice, how do I get to the data, I actually wanted to send?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Jiri&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BLE Communication between two nrf5340</title><link>https://test-devzone.nordicsemi.com/thread/367166?ContentTypeID=1</link><pubDate>Tue, 10 May 2022 11:41:36 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:87dace00-4781-4b94-ac92-8792f612f10b</guid><dc:creator>user77782</dc:creator><description>&lt;p&gt;Hi,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Take a look at&amp;nbsp;the&amp;nbsp;&lt;a href="https://github.com/nrfconnect/sdk-nrf/blob/main/samples/bluetooth/peripheral_uart/src/main.c#L621"&gt;ble_write_thread&lt;/a&gt;&lt;span&gt;&amp;nbsp;function and &lt;a href="https://test-devzone.nordicsemi.com/guides/nrf-connect-sdk-guides/b/getting-started/posts/nus-on-ncs-the-nordic-uart-service-with-the-nrf-connect-sdk"&gt;this tutorial&lt;/a&gt;.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;-Amanda&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BLE Communication between two nrf5340</title><link>https://test-devzone.nordicsemi.com/thread/366876?ContentTypeID=1</link><pubDate>Mon, 09 May 2022 09:32:20 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:de154c96-6382-4da0-a56a-e16c06981047</guid><dc:creator>user115726</dc:creator><description>&lt;p&gt;Hi Amanda&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Thank you very much for tips, I think I understood the connecting and the communication between the Central and Peripheral. Now I have problems with getting the data from the temperature sensors to the UART sending buffer. I get the temperature data with SPI interface as uint32_t.&lt;/p&gt;
&lt;p&gt;Would you have some advice for me?&lt;/p&gt;
&lt;p&gt;Jiri&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BLE Communication between two nrf5340</title><link>https://test-devzone.nordicsemi.com/thread/366130?ContentTypeID=1</link><pubDate>Wed, 04 May 2022 08:44:39 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:18acccaf-fafa-4fdc-9e54-3d9d64956987</guid><dc:creator>user77782</dc:creator><description>&lt;p&gt;Hi,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;In the UART samples,&amp;nbsp;the UART console is used to send and read data over the NUS service. Debug messages are not displayed in this UART console. Instead, they are printed by the RTT logger. If you want to view the debug messages, follow the procedure in&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;a href="http://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/gs_testing.html#testing-rtt-connect"&gt;&lt;span&gt;Connecting using RTT&lt;/span&gt;&lt;/a&gt;. Once you connect via RTT, you can the&amp;nbsp;&lt;span&gt;event logs.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;-Amanda&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BLE Communication between two nrf5340</title><link>https://test-devzone.nordicsemi.com/thread/366104?ContentTypeID=1</link><pubDate>Wed, 04 May 2022 06:54:26 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1c559e55-505e-4bd0-9f58-8f34cbe10fe7</guid><dc:creator>user115726</dc:creator><description>&lt;p&gt;Hi Amanda&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;thank you very much for the tips.&lt;/p&gt;
&lt;p&gt;While testing those samples, I can&amp;#39;t get any output, that the Kits are connected. I only get a message &amp;quot;Starting Bluetooth Central UART example&amp;quot; in NRF TERMINAL, but nothing else. On the Kit with the Peripheral sample on it indicates the LED 2 that the Kit is connected, but in NRF TERMINAL is also only the &amp;quot;Starting Nordic UART service example&amp;quot; message. I also connected PuTTy to the Central, but I don!&amp;#39;t get any message here. I did not change anything in the Samples so far.&lt;/p&gt;
&lt;p&gt;Could you please give me an advice, what should I do?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Regards, Jirik&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src="https://test-devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/pastedimage1651647257523v1.png" alt=" " /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BLE Communication between two nrf5340</title><link>https://test-devzone.nordicsemi.com/thread/365732?ContentTypeID=1</link><pubDate>Mon, 02 May 2022 11:21:30 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b5c1bb5b-8e0e-4bf4-a090-dde73b792608</guid><dc:creator>user77782</dc:creator><description>&lt;p&gt;Hi,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;You can start from&amp;nbsp;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="http://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/samples/bluetooth/central_uart/README.html"&gt;Bluetooth: Central UART&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/samples/bluetooth/peripheral_uart/README.html"&gt;Bluetooth: Peripheral UART&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Regards,&lt;br /&gt;Amanda&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>