<?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>How to use I2C on the nRF5340 DK ?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/81019/how-to-use-i2c-on-the-nrf5340-dk</link><description>Greetings, 
 I am trying to develop an application on the nRF5340 DK that requires me to collect data from a sensor using I2C and I am confused on how to do that. I have seen people talking about TWI and others saying that you don&amp;#39;t need TWI. On STM32</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 26 Oct 2021 13:14:08 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/81019/how-to-use-i2c-on-the-nrf5340-dk" /><item><title>RE: How to use I2C on the nRF5340 DK ?</title><link>https://devzone.nordicsemi.com/thread/335986?ContentTypeID=1</link><pubDate>Tue, 26 Oct 2021 13:14:08 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c9860783-79fe-4a94-9dd9-4c625dc83e5f</guid><dc:creator>Simon</dc:creator><description>&lt;p&gt;I&amp;#39;m happy to help &lt;span class="emoticon" data-url="https://devzone.nordicsemi.com/cfs-file/__key/system/emoji/1f642.svg" title="Slight smile"&gt;&amp;#x1f642;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to use I2C on the nRF5340 DK ?</title><link>https://devzone.nordicsemi.com/thread/335858?ContentTypeID=1</link><pubDate>Tue, 26 Oct 2021 06:54:00 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:571750f7-bc1d-4265-8687-88bd9a8d9dae</guid><dc:creator>GunnerDx</dc:creator><description>&lt;p&gt;Thank you so much for explaining everything&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to use I2C on the nRF5340 DK ?</title><link>https://devzone.nordicsemi.com/thread/335825?ContentTypeID=1</link><pubDate>Mon, 25 Oct 2021 18:02:39 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:797c0644-1be5-4f6e-85e1-297b986b4eae</guid><dc:creator>Simon</dc:creator><description>&lt;p&gt;You configure the hardware through the overlay file.&lt;/p&gt;
&lt;p&gt;If you&amp;#39;re using the secure board, modify&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;a href="https://github.com/crfosse/ncs_projects/blob/5e2bfc1a80e86e838d39425dc5a2882d0c6c0549/peripheral_zephyr/i2c/nrf5340dk_nrf5340_cpuapp.overlay#L5-L6"&gt;nrf5340dk_nrf5340_cpuapp.overlay&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;If yo&amp;#39;re using the nonsecure board, modify&amp;nbsp;&lt;a href="https://github.com/crfosse/ncs_projects/blob/5e2bfc1a80e86e838d39425dc5a2882d0c6c0549/peripheral_zephyr/i2c/nrf5340dk_nrf5340_cpuappns.overlay#L5-L6"&gt;nrf5340dk_nrf5340_cpuappns.overlay&lt;/a&gt;&amp;nbsp;(it should be nrf5340dk_nrf5340_cpuapp_ns.overlay in NCS v1.7.0, but I think it will get renamed automatically).&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;I can see that you got a different advice in the ticket&amp;nbsp;&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/80957/nrf5340-i2c-pins"&gt;nRF5340 I2C pins&lt;/a&gt;, but that is the approach for the&amp;nbsp;&lt;a href="https://www.nordicsemi.com/Products/Development-software/nRF5-SDK"&gt;nRF5 SDK&lt;/a&gt;&amp;nbsp;(and in NCS if you&amp;#39;re using the&amp;nbsp;NRFX drivers directly). The nRF5340 is only compatible with the&amp;nbsp;&lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/index.html"&gt;nRF Connect SDK&lt;/a&gt;&amp;nbsp;(NCS), which is the one you&amp;#39;re using now.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Configuring hardware in NCS is always done through the device tree (.overlay, .dts, .dtsi.. files). Read more about the Device Tree here:&amp;nbsp;&lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/zephyr/guides/dts/index.html"&gt;https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/zephyr/guides/dts/index.html&lt;/a&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Simon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to use I2C on the nRF5340 DK ?</title><link>https://devzone.nordicsemi.com/thread/335811?ContentTypeID=1</link><pubDate>Mon, 25 Oct 2021 14:53:59 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:02f0b743-3482-48a0-960f-f16e5464dd60</guid><dc:creator>GunnerDx</dc:creator><description>&lt;p&gt;Thank you. In the I2C scanner example you provided I can see that the device_get_binding works well for the I2C which is something I was struggling with. However, I would like to be able to change the pins of the SCL and SDA signals. Do you have an idea on how to achieve that ?&lt;/p&gt;
&lt;p&gt;Thank you in advance.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to use I2C on the nRF5340 DK ?</title><link>https://devzone.nordicsemi.com/thread/335794?ContentTypeID=1</link><pubDate>Mon, 25 Oct 2021 14:14:32 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:23a7333e-599e-4573-96bc-7ebfd789357d</guid><dc:creator>Simon</dc:creator><description>&lt;p&gt;&lt;span&gt;TWI is the same as I2C, but there are legal reasons for not using that name.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;You could start with &lt;a href="https://github.com/crfosse/ncs_projects/tree/main/peripheral_zephyr/i2c"&gt;the I2C&amp;nbsp; scanner sample&lt;/a&gt;, created by a colleague of mine. It should work with the nRF5340&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Check out the answer below, where I explained how to use a peripheral, like I2C:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;a href="https://devzone.nordicsemi.com/support-private/support/263222#permalink=629762"&gt;https://devzone.nordicsemi.com/support-private/support/263222#permalink=629762&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;If you don&amp;#39;t get the provided sample to work, or are still confused, please let me know&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Best regards,&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Simon&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>