<?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>Adding a peripheral to a project using BLE</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/81128/adding-a-peripheral-to-a-project-using-ble</link><description>I have a project that runs I2C to collect data from a pressure sensor and I have a different project that sends arrays of data over Bluetooth and they both work perfectly fine. Now I&amp;#39;m trying to add the I2C part to the Bluetooth project. I added I2C to</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 27 Oct 2021 14:13:53 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/81128/adding-a-peripheral-to-a-project-using-ble" /><item><title>RE: Adding a peripheral to a project using BLE</title><link>https://devzone.nordicsemi.com/thread/336251?ContentTypeID=1</link><pubDate>Wed, 27 Oct 2021 14:13:53 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d0bbe217-8abe-4d89-ac09-ce482f5c8bad</guid><dc:creator>&amp;#216;ivind</dc:creator><description>&lt;p&gt;Great to hear! Yes, it&amp;#39;s a quirk of how projects are handled with SES. No manual update is required when using the VS Code extension for nRF Connect or when using the command line.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Adding a peripheral to a project using BLE</title><link>https://devzone.nordicsemi.com/thread/336240?ContentTypeID=1</link><pubDate>Wed, 27 Oct 2021 13:34:58 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3171802f-62a8-4e71-9301-dbd0d24212db</guid><dc:creator>GunnerDx</dc:creator><description>&lt;p&gt;Yes that was it. It worked, thank you so much. I had no idea I have to do that manually, I thought it was done automatically when you save.&lt;/p&gt;
&lt;p&gt;Thanks again.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Adding a peripheral to a project using BLE</title><link>https://devzone.nordicsemi.com/thread/336226?ContentTypeID=1</link><pubDate>Wed, 27 Oct 2021 13:08:58 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9eae7540-11fe-4bad-ba82-d760f7215b6f</guid><dc:creator>&amp;#216;ivind</dc:creator><description>&lt;p&gt;Ah, if you are using SES, you need to click Project-&amp;gt;Run CMake for any changes in .overlays, prj.conf etc. to be applied.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Adding a peripheral to a project using BLE</title><link>https://devzone.nordicsemi.com/thread/336219?ContentTypeID=1</link><pubDate>Wed, 27 Oct 2021 12:58:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1983977a-5c21-446e-84d9-f89af92ee48d</guid><dc:creator>GunnerDx</dc:creator><description>&lt;p&gt;I tried that but it didn&amp;#39;t work. I feel like the changes I made in the overlay file are not being taken into account. Is there something that needs to be done after modifying the overlay file ? Because I just save it and rebuild the solution everytime. Maybe that is not enough&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Adding a peripheral to a project using BLE</title><link>https://devzone.nordicsemi.com/thread/336216?ContentTypeID=1</link><pubDate>Wed, 27 Oct 2021 12:50:58 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9061fde8-fbaa-4502-b17b-0e088000a487</guid><dc:creator>&amp;#216;ivind</dc:creator><description>&lt;p&gt;In your overlay file, try moving the &amp;quot; &amp;amp;i2c1 {}; &amp;quot; outside the other brackets:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;{
    soc {
    
        ...
    
    };
};

&amp;amp;i2c1 {
    ...
};&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Adding a peripheral to a project using BLE</title><link>https://devzone.nordicsemi.com/thread/336200?ContentTypeID=1</link><pubDate>Wed, 27 Oct 2021 12:21:08 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7805ba32-25a5-4c77-8007-95b9f4e1c236</guid><dc:creator>GunnerDx</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;I the bluetooth project I&amp;#39;m working on is the &amp;#39;peripheral_uart&amp;#39; example to which I want to add the I2C code and send the data via Bluetooth.&lt;/p&gt;
&lt;p&gt;Here is the code in the .overlay file :&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt; {
	soc {

                &amp;amp;i2c1 {
                      status = &amp;quot;okay&amp;quot;;
                      compatible = &amp;quot;nordic,nrf-twim&amp;quot;;
                      label = &amp;quot;I2C_1&amp;quot;;
                      sda-pin = &amp;lt;5&amp;gt;;
                      scl-pin = &amp;lt;4&amp;gt;;
                      clock-frequency = &amp;lt;400000&amp;gt;; 
              };
		/* Add a flash controller which has the compatible
		 * &amp;#39;zephyr,sim-flash&amp;#39;. This will ensure that the flash
		 * simulator can use it. None of the other properties in this
		 * node is used for anything.
		 */
		nordic_ram_flash_controller: nordic_ram-flash-controller@0 {
			compatible = &amp;quot;zephyr,sim-flash&amp;quot;;
			reg = &amp;lt;0x00000000 DT_SIZE_K(40)&amp;gt;;
			#address-cells = &amp;lt;1&amp;gt;;
			#size-cells = &amp;lt;1&amp;gt;;
			erase-value = &amp;lt;0xff&amp;gt;;
			label = &amp;quot;nordic_ram_flash_flash_controller&amp;quot;;

			/* This node label must match that used in the flash
			 * simulator.
			 */
			flash_sim0: flash_sim@0 {
				status = &amp;quot;okay&amp;quot;;
				compatible = &amp;quot;soc-nv-flash&amp;quot;;
				label = &amp;quot;simulated_flash&amp;quot;;
				erase-block-size = &amp;lt;4096&amp;gt;;
				write-block-size = &amp;lt;4&amp;gt;;
				reg = &amp;lt;0x00000000 DT_SIZE_K(256)&amp;gt;;

				partitions {
					compatible = &amp;quot;fixed-partitions&amp;quot;;
					#address-cells = &amp;lt;1&amp;gt;;
					#size-cells = &amp;lt;1&amp;gt;;

					/* This partition must be defined for
					 * MCUboot to find the partition ID
					 * of the primary slot for image 1,
					 * which is stored in this partition.
					 */
					slot2_partition: partition@0 {
						label = &amp;quot;image-2&amp;quot;;
						reg = &amp;lt;0x00000000 0x00000A000&amp;gt;;
					};
				};
			};
		};
	};
};
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Here is the prj.conf :&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;# Enable the UART driver
CONFIG_UART_ASYNC_API=y
CONFIG_NRFX_UARTE0=y
CONFIG_SERIAL=y

CONFIG_GPIO=y

# Make sure printk is printing to the UART console
CONFIG_CONSOLE=y
CONFIG_UART_CONSOLE=y

# Stacks and heaps
CONFIG_MAIN_STACK_SIZE=16384
CONFIG_HEAP_MEM_POOL_SIZE=16384

# I2C
CONFIG_I2C=y
CONFIG_NRFX_TWIM=y
CONFIG_NRFX_TWIM1=y

# Rebooot
CONFIG_REBOOT=n
CONFIG_RESET_ON_FATAL_ERROR=n

CONFIG_BT=y
CONFIG_BT_PERIPHERAL=y
CONFIG_BT_DEVICE_NAME=&amp;quot;Nordic_UART_Service&amp;quot;
CONFIG_BT_DEVICE_APPEARANCE=833
CONFIG_BT_MAX_CONN=1
CONFIG_BT_MAX_PAIRED=1

# Enable the NUS service
CONFIG_BT_NUS=y

# Enable bonding
CONFIG_BT_SETTINGS=y
CONFIG_FLASH=y
CONFIG_FLASH_PAGE_LAYOUT=y
CONFIG_FLASH_MAP=y
CONFIG_NVS=y
CONFIG_SETTINGS=y

# Enable DK LED and Buttons library
CONFIG_DK_LIBRARY=y

# This example requires more workqueue stack
CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=2048

# Config logger
CONFIG_LOG=y
CONFIG_USE_SEGGER_RTT=y
CONFIG_LOG_BACKEND_RTT=y
CONFIG_LOG_BACKEND_UART=n

CONFIG_ASSERT=y
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;I am calling the device_get_binding() function in main() :&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;    const struct device *i2c_dev;

    i2c_dev = device_get_binding(&amp;quot;I2C_1&amp;quot;);
    
    if (i2c_dev==NULL) printk(&amp;quot;I2C_Driver NOT Found\n&amp;quot;);

    else  printk(&amp;quot;I2C_Driver Found\n&amp;quot;);&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;I am probably doing something wrong&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Adding a peripheral to a project using BLE</title><link>https://devzone.nordicsemi.com/thread/336191?ContentTypeID=1</link><pubDate>Wed, 27 Oct 2021 12:10:17 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fb6c5e7d-cc2c-409c-83a3-eadb6888453a</guid><dc:creator>&amp;#216;ivind</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Could I see the .overlay file, prj.conf file, and the code where you call the device_get_binding() function?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>