<?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 enable I2C 10-bit addressing on ncs v2.4.2?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/103897/how-to-enable-i2c-10-bit-addressing-on-ncs-v2-4-2</link><description>I need to use nRF5240 device to control LED driver IC through I2C interface. And I also need to use I2C 10-bit addressing. How to enable I2C 10-bit addressing on ncs v2.4.2?</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 19 Sep 2023 11:28:02 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/103897/how-to-enable-i2c-10-bit-addressing-on-ncs-v2-4-2" /><item><title>RE: How to enable I2C 10-bit addressing on ncs v2.4.2?</title><link>https://devzone.nordicsemi.com/thread/446634?ContentTypeID=1</link><pubDate>Tue, 19 Sep 2023 11:28:02 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:aeb30c97-00f9-4bcf-bb03-5e507ea94bc1</guid><dc:creator>snowuyl</dc:creator><description>&lt;p&gt;Thanks for your reply! I can read/write registers now.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;static int _lp5861ReadReg(uint16_t regAddr, uint8_t *regVal) {
    printk(&amp;quot;tca6424aReadReg(regAddr=0x%x)\n&amp;quot;, regAddr);
    const uint16_t devAddr   = LP5861_CHIP_ADDRESS | _lp5861GetRegAddrHigh(regAddr);
    const uint8_t  startAddr = _lp5861GetRegAddrLow(regAddr);
    printk(&amp;quot;devAddr=0x%x, startAddr=0x%x\n&amp;quot;, devAddr, startAddr);
    uint8_t rbuf[2];
    const int ret = i2c_burst_read(_gI2cDev, devAddr, startAddr, rbuf, sizeof(rbuf));
    if (ret &amp;lt; 0) {
        printk(&amp;quot;i2c_burst_read(0x%x) failed, ret=%d\n&amp;quot;, regAddr, ret);
        return ERROR_I2C_READ_FAIL;
    }

    printk(&amp;quot;rbuf[0]=0x%x, rbuf[1]=0x%x\n&amp;quot;, rbuf[0], rbuf[1]);
    *regVal = rbuf[0];
    return 0;
}

static int _lp5861WriteReg(uint16_t regAddr, uint8_t regVal) {
    printk(&amp;quot;tca6424aWriteReg(regAddr=0x%x, regVal0x%x)\n&amp;quot;, regAddr, regVal);
    const uint16_t devAddr   = LP5861_CHIP_ADDRESS | _lp5861GetRegAddrHigh(regAddr);
    const uint8_t  startAddr = _lp5861GetRegAddrLow(regAddr);
    printk(&amp;quot;_lp5861GetRegAddrHigh(regAddr)=0x%x\n&amp;quot;, _lp5861GetRegAddrHigh(regAddr));
    printk(&amp;quot;devAddr=0x%x, startAddr=0x%x\n&amp;quot;, devAddr, startAddr);
    const uint8_t wbuf[2] = { regVal,  0x00};
    const int ret =  i2c_burst_write(_gI2cDev, devAddr, startAddr, wbuf, sizeof(wbuf));
    if (ret &amp;lt; 0) {
        printk(&amp;quot;i2c_burst_write(0x%x) failed, ret=%d\n&amp;quot;, regAddr, ret);
        return ERROR_I2C_WRITE_FAIL;
    }

    return 0;
}&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to enable I2C 10-bit addressing on ncs v2.4.2?</title><link>https://devzone.nordicsemi.com/thread/446625?ContentTypeID=1</link><pubDate>Tue, 19 Sep 2023 10:57:45 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:22afc8b6-0424-4565-a0c4-cfecbc61bc30</guid><dc:creator>Kenneth</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;From the TWI peripheral description in the nRF5340 product specification you can find that only 7-bit address is supported by the hardware:&lt;br /&gt;&lt;a href="https://infocenter.nordicsemi.com/topic/ps_nrf5340/twim.html#register.ADDRESS"&gt;https://infocenter.nordicsemi.com/topic/ps_nrf5340/twim.html#register.ADDRESS&lt;/a&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Looking at the screenshots you shared it may seem as it&amp;#39;s possible to use 7-bit address to expand this to 10-bit by actually using 16-bit. We don&amp;#39;t have any example on how to do this, however in theory (I believe) it can be possible to use the low level&amp;nbsp;nrfx_twim_xfer() api directly&amp;nbsp;to have more&amp;nbsp;control of what bytes are sent on the bus. There are example in ncs showing the use of nrfx_twim directly that may be used as basis for this:&lt;br /&gt;&lt;a href="https://github.com/zephyrproject-rtos/hal_nordic/tree/master/nrfx/samples/src"&gt;https://github.com/zephyrproject-rtos/hal_nordic/tree/master/nrfx/samples/src&lt;/a&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Kenneth&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to enable I2C 10-bit addressing on ncs v2.4.2?</title><link>https://devzone.nordicsemi.com/thread/446544?ContentTypeID=1</link><pubDate>Tue, 19 Sep 2023 03:00:20 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9cc51a8d-25ba-4775-8e7f-df0bacc3dd73</guid><dc:creator>snowuyl</dc:creator><description>&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/7242.registers.png" alt=" " /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to enable I2C 10-bit addressing on ncs v2.4.2?</title><link>https://devzone.nordicsemi.com/thread/446543?ContentTypeID=1</link><pubDate>Tue, 19 Sep 2023 02:59:59 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4e61d8a2-b2d9-48d7-b864-3550b0f5a85e</guid><dc:creator>snowuyl</dc:creator><description>&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/0121.I2c_5F00_timing.png" alt=" " /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to enable I2C 10-bit addressing on ncs v2.4.2?</title><link>https://devzone.nordicsemi.com/thread/446542?ContentTypeID=1</link><pubDate>Tue, 19 Sep 2023 02:59:15 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0379535b-6645-493f-9223-7f9f5a9332ae</guid><dc:creator>snowuyl</dc:creator><description>&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/7802.I2c_5F00_data_5F00_format.png" alt=" " /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to enable I2C 10-bit addressing on ncs v2.4.2?</title><link>https://devzone.nordicsemi.com/thread/446541?ContentTypeID=1</link><pubDate>Tue, 19 Sep 2023 02:58:55 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1609bac7-8022-4a27-9a7d-f9c63c785f15</guid><dc:creator>snowuyl</dc:creator><description>&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/3527.10_2D00_bit-addressing.png" alt=" " /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>