<?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 do I define an i2c device that has multiple addresses.</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/123795/how-do-i-define-an-i2c-device-that-has-multiple-addresses</link><description>I have a 2 Mbit EEPROM, normally I would configure the overlay as follows: 
 
 But the M24M02 eeprom uses 4 addresses to access 4 blocks of memory within the device, 50, 51, 52, 53. 
 So my question is how do I configure the overlay so that the driver</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 01 Sep 2025 12:26:59 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/123795/how-do-i-define-an-i2c-device-that-has-multiple-addresses" /><item><title>RE: How do I define an i2c device that has multiple addresses.</title><link>https://devzone.nordicsemi.com/thread/547339?ContentTypeID=1</link><pubDate>Mon, 01 Sep 2025 12:26:59 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ae653bc8-3df0-47bc-bcd9-d6e9a4dbe70b</guid><dc:creator>Kenneth</dc:creator><description>&lt;p&gt;Hi Chris,&lt;/p&gt;
&lt;p&gt;Looks like the driver may actually already support this?&amp;nbsp;&lt;br /&gt;&lt;a title="https://github.com/nrfconnect/sdk-zephyr/blob/main/drivers/eeprom/eeprom_at2x.c#l236" href="https://github.com/nrfconnect/sdk-zephyr/blob/main/drivers/eeprom/eeprom_at2x.c#L236" rel="noopener noreferrer" target="_blank"&gt;https://github.com/nrfconnect/sdk-zephyr/blob/main/drivers/eeprom/eeprom_at2x.c#L236&lt;/a&gt;&amp;nbsp;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;/**&lt;br /&gt; * @brief translate an offset to a device address / offset pair&lt;br /&gt; *&lt;br /&gt; * It allows to address several devices as a continuous memory region&lt;br /&gt; * but &lt;strong&gt;also to address higher part of eeprom for chips&lt;/strong&gt;&lt;br /&gt; * &lt;strong&gt;with more than 2^(addr_width) adressable word.&lt;/strong&gt;&lt;br /&gt; */&lt;br /&gt; static uint16_t eeprom_at24_translate_offset(const struct device *dev,&lt;br /&gt;            &amp;nbsp;&amp;nbsp;&amp;nbsp; off_t *offset)&lt;br /&gt; {&lt;br /&gt;   const struct eeprom_at2x_config *config = dev-&amp;gt;config;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;  const uint16_t addr_incr = *offset &amp;gt;&amp;gt; config-&amp;gt;addr_width;&lt;br /&gt;   *offset &amp;amp;= BIT_MASK(config-&amp;gt;addr_width);&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;  &lt;strong&gt;return config-&amp;gt;bus.i2c.addr + addr_incr;&lt;/strong&gt;&lt;br /&gt; }&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 do I define an i2c device that has multiple addresses.</title><link>https://devzone.nordicsemi.com/thread/546941?ContentTypeID=1</link><pubDate>Wed, 27 Aug 2025 13:34:32 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5802cb89-38dc-4960-8fae-631829fecea8</guid><dc:creator>chrisstv</dc:creator><description>&lt;p&gt;Hi&lt;/p&gt;
&lt;p&gt;Sorry, as per the previous suggestion, This shows how to specify two different devices on one bus.&lt;/p&gt;
&lt;p&gt;I have a &lt;strong&gt;single&lt;/strong&gt; device with 4 addresses.&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Which means you have to address the one single eeprom at 4 different addresses (50, 51, 52, 53) each address can access 64K of the eeprom array, making a total of 256k.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Regards&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Chris&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How do I define an i2c device that has multiple addresses.</title><link>https://devzone.nordicsemi.com/thread/546926?ContentTypeID=1</link><pubDate>Wed, 27 Aug 2025 13:12:01 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7a4d7c54-d772-4824-85eb-d985be690ec2</guid><dc:creator>Kazi Afroza Sultana</dc:creator><description>&lt;p&gt;Hello Chris,&lt;/p&gt;
&lt;p&gt;You can have a look this example&amp;nbsp;&lt;a href="https://github.com/nrfconnect/sdk-zephyr/blob/main/samples/sensor/sgp40_sht4x/boards/blackpill_f411ce.overlay"&gt;sdk-zephyr/samples/sensor/sgp40_sht4x/boards/blackpill_f411ce.overlay at main · nrfconnect/sdk-zephyr · GitHub&lt;/a&gt;; which shows how to add multple slave under one bus.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How do I define an i2c device that has multiple addresses.</title><link>https://devzone.nordicsemi.com/thread/546070?ContentTypeID=1</link><pubDate>Tue, 19 Aug 2025 14:04:06 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:39f56a73-131d-4d39-b1c4-fc1c50ac644b</guid><dc:creator>chrisstv</dc:creator><description>&lt;p&gt;Hi Kazi,&lt;/p&gt;
&lt;p&gt;No unfortunately in that example they are actually defining 3 different size EEPROMs I guess their development kit has 3 different size devices on their PCB.&lt;/p&gt;
&lt;p&gt;My issue is that the M24M02 is a 2 Mbit (256K) eeprom. Given eeproms have only 2 x 8 bit address&amp;nbsp;bytes (16 bits) but to access 2 Mbit (256K) you need 18 bits of address.&amp;nbsp; ST use a 2 bit field in the eeprom address register for the extra 2 bits required.&lt;/p&gt;
&lt;p&gt;Which means you have to address the eeprom at 4 different addresses (50, 51, 52, 53) each address can access 64K of the eeprom array, making a total of 256k.&lt;/p&gt;
&lt;p&gt;Regards&lt;/p&gt;
&lt;p&gt;Chris&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How do I define an i2c device that has multiple addresses.</title><link>https://devzone.nordicsemi.com/thread/546061?ContentTypeID=1</link><pubDate>Tue, 19 Aug 2025 13:41:25 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1dbf6e18-343d-40e6-aeec-3bf769ce7ae1</guid><dc:creator>Kazi Afroza Sultana</dc:creator><description>&lt;p&gt;Hello Chris,&lt;/p&gt;
&lt;p&gt;&amp;#39;&amp;#39; So my question is how do I configure the overlay so that the driver can access 4 addresses depenedent of the memory address to be accessed?&lt;/p&gt;
&lt;p&gt;Do I have to define 4 different devices?&amp;#39;&amp;#39;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;This sounds correct. Looks like zephyr&amp;nbsp;x_nucleo_eeprma2 board has similar way of defining eeprom.&lt;/p&gt;
&lt;p&gt;source:&amp;nbsp;&lt;a href="https://github.com/nrfconnect/sdk-zephyr/blob/v4.1.99-ncs1-snapshot1/boards/shields/x_nucleo_eeprma2/x_nucleo_eeprma2.overlay#L21-L58"&gt;sdk-zephyr/boards/shields/x_nucleo_eeprma2/x_nucleo_eeprma2.overlay at v4.1.99-ncs1-snapshot1 · nrfconnect/sdk-zephyr · GitHub&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;However, you need to make sure with the vendor as&amp;nbsp;&lt;span&gt;M24M02 eeprom is not out product.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Thanks.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;BR&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Kazi&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>