<?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>Unable to interface PCF8574 with nr53DK.</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/111058/unable-to-interface-pcf8574-with-nr53dk</link><description>Hello! 
 
 I&amp;#39;m following the NRF Academy Fundamentals course and I am facing an issue with I2C devices. 
 
 I have an STM32 board with HAL code (Non-Zephyr) and I am able to interface the PCF8574 IC successfully. 
 This sensor board has 10k pull-up resistors</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 14 May 2024 08:57:48 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/111058/unable-to-interface-pcf8574-with-nr53dk" /><item><title>RE: Unable to interface PCF8574 with nr53DK.</title><link>https://devzone.nordicsemi.com/thread/483191?ContentTypeID=1</link><pubDate>Tue, 14 May 2024 08:57:48 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0f46610c-1c68-4432-bc33-0ab47ba79b19</guid><dc:creator>Navin</dc:creator><description>&lt;p&gt;Hi Runar,&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Thanks for response!&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I found out what was wrong with my code. The address is supposed to be &lt;strong&gt;0x20&lt;/strong&gt; and not 0x40, as it a 7-bit address. ST HAL API expects an 8-bit left shifted value, which confused me.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Here is an alternating pattern for:&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;code&gt;&lt;/code&gt;&lt;/p&gt;
&lt;div&gt;
&lt;div&gt;&lt;span&gt;uint16_t&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;data&lt;/span&gt;&lt;span&gt; = &lt;/span&gt;&lt;span&gt;0xAA55&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&lt;code&gt;It works with the same DT binding I initially provided with the default arduino pins (P1.03 and P1.02).&amp;nbsp;&lt;/code&gt;&lt;/p&gt;
&lt;div&gt;
&lt;div&gt;&lt;code&gt;&lt;span&gt;&amp;amp;&lt;/span&gt;&lt;span&gt;i2c1&lt;/span&gt;&lt;span&gt; {&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div&gt;&lt;code&gt;&lt;span&gt;&lt;/span&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; mysensor:&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;mysensor&lt;/span&gt;&lt;span&gt;@&lt;/span&gt;&lt;span&gt;20&lt;/span&gt;&lt;span&gt;{&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div&gt;&lt;code&gt;&lt;span&gt;&lt;/span&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; compatible&lt;/span&gt;&lt;span&gt; = &lt;/span&gt;&lt;span&gt;&amp;quot;i2c-device&amp;quot;&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div&gt;&lt;code&gt;&lt;span&gt;&lt;/span&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; status&lt;/span&gt;&lt;span&gt; = &lt;/span&gt;&lt;span&gt;&amp;quot;okay&amp;quot;&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div&gt;&lt;code&gt;&lt;span&gt;&lt;/span&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; reg&lt;/span&gt;&lt;span&gt; = &amp;lt; &lt;/span&gt;&lt;span&gt;0x20&lt;/span&gt;&lt;span&gt; &amp;gt;;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div&gt;&lt;code&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp;};&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div&gt;&lt;code&gt;&lt;span&gt;};&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&lt;code&gt;&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;code&gt;&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;code&gt;&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;img style="max-height:240px;max-width:320px;" src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/IMG_5F00_1572.jpg" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Thanks again for pointing out the issue, it helped in figuring out the solution.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Navin&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Unable to interface PCF8574 with nr53DK.</title><link>https://devzone.nordicsemi.com/thread/483049?ContentTypeID=1</link><pubDate>Mon, 13 May 2024 12:47:01 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ec7a1aec-ace9-485c-b325-5b7c65116bbe</guid><dc:creator>runsiv</dc:creator><description>&lt;p&gt;If you have a look at the device binding which you can find &lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/2.2.99-dev2/zephyr/build/dts/api/bindings/gpio/nxp%2Cpcf8574.html"&gt;here&lt;/a&gt;, you will see that you are missing a few field&amp;nbsp;&lt;/p&gt;
&lt;p&gt;It should look something similar to this&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;&amp;amp;i2c {
  status = &amp;quot;okay&amp;quot;;
  pcf8574: pcf857x@20 {
      compatible = &amp;quot;nxp,pcf857x&amp;quot;;
      status = &amp;quot;okay&amp;quot;;
      reg = &amp;lt;0x20&amp;gt;;
      gpio-controller;
      #gpio-cells = &amp;lt;2&amp;gt;;
      ngpios = &amp;lt;8&amp;gt;;
  };


};&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;If you are using the newest version NCS the Kconfig should be&amp;nbsp;&lt;a title="CONFIG_GPIO_PCF857X" href="https://docs.zephyrproject.org/latest/kconfig.html#CONFIG_GPIO_PCF857X"&gt;&lt;code&gt;&lt;span&gt;CONFIG_GPIO_PCF857X&lt;/span&gt;&lt;/code&gt;&lt;/a&gt;=y&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Regards&lt;/p&gt;
&lt;p&gt;Runar&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Unable to interface PCF8574 with nr53DK.</title><link>https://devzone.nordicsemi.com/thread/482986?ContentTypeID=1</link><pubDate>Mon, 13 May 2024 10:22:07 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:172b4f69-344e-48de-88cd-d75b3ea5cf5c</guid><dc:creator>Navin</dc:creator><description>&lt;p&gt;Hi Runar,&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Thank you for the response!&lt;/p&gt;
&lt;p&gt;Here is &lt;strong&gt;prj.conf&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;#
# Copyright (c) 2016 Intel Corporation
#
# SPDX-License-Identifier: Apache-2.0
#

# STEP 2 - Enable the I2C driver
CONFIG_I2C=y
# STEP 4.2 - Enable floating point format specifiers
CONFIG_CBPRINTF_FP_SUPPORT=y
CONFIG_LOG=y&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;And here is the DTS &lt;strong&gt;overlay&lt;/strong&gt;:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;&amp;amp;i2c1 {

    mysensor: mysensor@40{
        compatible = &amp;quot;i2c-device&amp;quot;;
        status = &amp;quot;okay&amp;quot;;
        reg = &amp;lt; 0x40 &amp;gt;;
    };
};&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Also, please find the final &lt;strong&gt;zephyr.dts&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/6116.zephyr.dts"&gt;devzone.nordicsemi.com/.../6116.zephyr.dts&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Navin&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Unable to interface PCF8574 with nr53DK.</title><link>https://devzone.nordicsemi.com/thread/482698?ContentTypeID=1</link><pubDate>Fri, 10 May 2024 05:28:54 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:bcb0c9ff-c536-4cf8-97d7-1204b5c59463</guid><dc:creator>runsiv</dc:creator><description>&lt;p&gt;Hi Navin&lt;/p&gt;
&lt;p&gt;Could you post your devicetree and your prj.conf?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Nb. We are a bit shorter staffed than usual at devzone due to today being a squeeze day in Norway (Friday after a national holiday) so the response time might be longer then usual.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Regards&lt;/p&gt;
&lt;p&gt;Runar&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>