<?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>Can&amp;#39;t write/read 16 bit register addresses on npm1300 through i2c</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/124024/can-t-write-read-16-bit-register-addresses-on-npm1300-through-i2c</link><description>I&amp;#39;m trying to demonstrate that I can write a value to a Nordic npm1300 register and read the same value back. Using the code below, I write 0x5a but read 0x0a, so the msb 5 is getting lost: 
 
 uint8_t pmic_config [] = { 0x06 , 0x01 , 0x5a }; //register</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 02 Sep 2025 14:08:20 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/124024/can-t-write-read-16-bit-register-addresses-on-npm1300-through-i2c" /><item><title>RE: Can't write/read 16 bit register addresses on npm1300 through i2c</title><link>https://devzone.nordicsemi.com/thread/547520?ContentTypeID=1</link><pubDate>Tue, 02 Sep 2025 14:08:20 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a3b87b45-4b9a-4f01-b436-1ff85b79e46a</guid><dc:creator>kruenheck</dc:creator><description>&lt;p&gt;Thank you, the problem was that I was writing/reading a four bit register.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Can't write/read 16 bit register addresses on npm1300 through i2c</title><link>https://devzone.nordicsemi.com/thread/547519?ContentTypeID=1</link><pubDate>Tue, 02 Sep 2025 14:07:17 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6bdaa9b0-426d-4f42-869b-26325f1ffa9f</guid><dc:creator>kruenheck</dc:creator><description>&lt;p&gt;Yes, it should have been three bytes. But as you pointed out, the underlying problem was that the register I was writing to was only four bits.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Can't write/read 16 bit register addresses on npm1300 through i2c</title><link>https://devzone.nordicsemi.com/thread/547452?ContentTypeID=1</link><pubDate>Tue, 02 Sep 2025 11:20:33 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:75d906b3-321d-4078-b568-eb48a3738a3d</guid><dc:creator>SergeiOv</dc:creator><description>&lt;p&gt;If you look at the description of the register you are attempting to write (address 0x0601 corresponds to&amp;nbsp;&lt;a href="https://docs.nordicsemi.com/bundle/ps_npm1300/page/chapters/core_components/gpio/doc/frontpage.html#ariaid-title6"&gt;https://docs.nordicsemi.com/bundle/ps_npm1300/page/chapters/core_components/gpio/doc/frontpage.html#ariaid-title6&lt;/a&gt;), you can see that it uses only the lower 4 bits, so the msb 5 in your case is simply ignored. And yes, the number of bytes to write in the `&lt;span&gt;&lt;/span&gt;&lt;span&gt;i2c_write_dt&lt;/span&gt;&lt;span&gt;` should be equal to the array size.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;To get an idea of how to communicate with the PMIC through I2C it is worth taking a look at how the mfd_npm13xx driver implements this:&amp;nbsp;&lt;a href="https://github.com/zephyrproject-rtos/zephyr/blob/main/drivers/mfd/mfd_npm13xx.c"&gt;github.com/.../mfd_npm13xx.c&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Can't write/read 16 bit register addresses on npm1300 through i2c</title><link>https://devzone.nordicsemi.com/thread/547318?ContentTypeID=1</link><pubDate>Mon, 01 Sep 2025 11:35:12 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6e7bb578-6416-4ce8-93d8-2359060dc1a7</guid><dc:creator>Kenneth</dc:creator><description>[quote user=""]&lt;div&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span&gt;uint8_t&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;pmic_config&lt;/span&gt;&lt;span&gt;[]&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;=&lt;/span&gt;&lt;span&gt; {&lt;/span&gt;&lt;span&gt;0x06&lt;/span&gt;&lt;span&gt;, &lt;/span&gt;&lt;span&gt;0x01&lt;/span&gt;&lt;span&gt;, &lt;/span&gt;&lt;span&gt;0x5a&lt;/span&gt;&lt;span&gt;};&lt;/span&gt;&lt;span&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //register followed by value&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span&gt;ret&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;=&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;i2c_write_dt&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;&amp;amp;&lt;/span&gt;&lt;span&gt;dev_i2c_pmic&lt;/span&gt;&lt;span&gt;, &lt;/span&gt;&lt;span&gt;pmic_config&lt;/span&gt;&lt;span&gt;, &lt;/span&gt;&lt;span&gt;2&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;span&gt;; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;/div&gt;[/quote]
&lt;p&gt;Shouldn&amp;#39;t it be 3 bytes in total? Not 2.&lt;/p&gt;
&lt;p&gt;Also, what register you are writing to, and are both values 8bit? I can see many registers are less than 8bit.&lt;/p&gt;
&lt;p&gt;Kenneth&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Can't write/read 16 bit register addresses on npm1300 through i2c</title><link>https://devzone.nordicsemi.com/thread/547225?ContentTypeID=1</link><pubDate>Fri, 29 Aug 2025 21:47:18 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:244d7ec9-056c-43ef-a595-73c283d61529</guid><dc:creator>kruenheck</dc:creator><description>&lt;p&gt;Note: I&amp;#39;m sure the i2c comm is working somewhat because when I change the write value,&amp;nbsp;&lt;span&gt;the read value also changes. For instance, changing 0x5a to 0x52 give 0x02 as a response.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>