<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Change I2C slave address after init, K20 in Kinetis Microcontrollers</title>
    <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Change-I2C-slave-address-after-init-K20/m-p/1171291#M58569</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;We have several devices using the K20 MCUs running the same software&amp;nbsp;that need to have their I2C slave address assigned on power up based on installed slot programming pin IDs.&lt;/P&gt;&lt;P&gt;Currently&amp;nbsp;the slave address is defined as 7 via the Kinetis Design Studio Component Inspector and have found in the generated code where the slave address is assigned (in IntI2cLdd1_Init() ).&amp;nbsp; The address specified in component inspector is hardcoded in the line&lt;/P&gt;&lt;P align="left"&gt;&lt;FONT size="2"&gt;I2C0_A1 = I2C_A1_AD(0x07); &lt;/FONT&gt;&lt;FONT size="2" color="#3f7f5f"&gt;/* Define slave address */&lt;/FONT&gt;&lt;/P&gt;&lt;P align="left"&gt;&lt;FONT color="#3f7f5f"&gt;&lt;FONT color="#000000"&gt;The program pins are read using a BitsIO component but this takes places after the Processor Expert&lt;/FONT&gt; &lt;/FONT&gt;PE_low_level_init() is executed.&lt;/P&gt;&lt;P align="left"&gt;In order to redefine the I2C slave address can I&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;call the &amp;lt;name&amp;gt;_I2C_Disable() function,&lt;/LI&gt;&lt;LI&gt;set the slave address (repeat the above line of code but with desired address),&lt;/LI&gt;&lt;LI&gt;call the &amp;lt;name&amp;gt;_I2C_Enable function?&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;If not, what should be done to reassign the I2C slave address when running?&lt;/P&gt;&lt;P&gt;An aside, in IntI2cLdd1.h I found:&lt;/P&gt;&lt;P align="left"&gt;&lt;FONT size="2" color="#7f0055"&gt;&lt;STRONG&gt;#define&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT size="2"&gt; IntI2cLdd1_SLAVE_ADDRESS 0x07U &lt;/FONT&gt;&lt;FONT size="2" color="#3f7f5f"&gt;/* Slave address value */ &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;using address defined in Component Inspector but it is not used in the generated code. Why?&lt;/P&gt;&lt;P&gt;thanks,&lt;/P&gt;&lt;P&gt;Fred&lt;/P&gt;</description>
    <pubDate>Wed, 21 Oct 2020 20:15:40 GMT</pubDate>
    <dc:creator>fporter</dc:creator>
    <dc:date>2020-10-21T20:15:40Z</dc:date>
    <item>
      <title>Change I2C slave address after init, K20</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Change-I2C-slave-address-after-init-K20/m-p/1171291#M58569</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;We have several devices using the K20 MCUs running the same software&amp;nbsp;that need to have their I2C slave address assigned on power up based on installed slot programming pin IDs.&lt;/P&gt;&lt;P&gt;Currently&amp;nbsp;the slave address is defined as 7 via the Kinetis Design Studio Component Inspector and have found in the generated code where the slave address is assigned (in IntI2cLdd1_Init() ).&amp;nbsp; The address specified in component inspector is hardcoded in the line&lt;/P&gt;&lt;P align="left"&gt;&lt;FONT size="2"&gt;I2C0_A1 = I2C_A1_AD(0x07); &lt;/FONT&gt;&lt;FONT size="2" color="#3f7f5f"&gt;/* Define slave address */&lt;/FONT&gt;&lt;/P&gt;&lt;P align="left"&gt;&lt;FONT color="#3f7f5f"&gt;&lt;FONT color="#000000"&gt;The program pins are read using a BitsIO component but this takes places after the Processor Expert&lt;/FONT&gt; &lt;/FONT&gt;PE_low_level_init() is executed.&lt;/P&gt;&lt;P align="left"&gt;In order to redefine the I2C slave address can I&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;call the &amp;lt;name&amp;gt;_I2C_Disable() function,&lt;/LI&gt;&lt;LI&gt;set the slave address (repeat the above line of code but with desired address),&lt;/LI&gt;&lt;LI&gt;call the &amp;lt;name&amp;gt;_I2C_Enable function?&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;If not, what should be done to reassign the I2C slave address when running?&lt;/P&gt;&lt;P&gt;An aside, in IntI2cLdd1.h I found:&lt;/P&gt;&lt;P align="left"&gt;&lt;FONT size="2" color="#7f0055"&gt;&lt;STRONG&gt;#define&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT size="2"&gt; IntI2cLdd1_SLAVE_ADDRESS 0x07U &lt;/FONT&gt;&lt;FONT size="2" color="#3f7f5f"&gt;/* Slave address value */ &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;using address defined in Component Inspector but it is not used in the generated code. Why?&lt;/P&gt;&lt;P&gt;thanks,&lt;/P&gt;&lt;P&gt;Fred&lt;/P&gt;</description>
      <pubDate>Wed, 21 Oct 2020 20:15:40 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Change-I2C-slave-address-after-init-K20/m-p/1171291#M58569</guid>
      <dc:creator>fporter</dc:creator>
      <dc:date>2020-10-21T20:15:40Z</dc:date>
    </item>
    <item>
      <title>Re: Change I2C slave address after init, K20</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Change-I2C-slave-address-after-init-K20/m-p/1171460#M58572</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;SPAN class=""&gt;&lt;A id="link_10" class="lia-link-navigation lia-page-link lia-user-name-link" href="https://community.nxp.com/t5/user/viewprofilepage/user-id/179396" target="_self"&gt;fporter&lt;/A&gt;,&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class=""&gt;&amp;nbsp; &amp;nbsp;If you want to change the slave address, if the slave is not started, you can modify the address directly.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class=""&gt;&amp;nbsp; &amp;nbsp;I also think you can use your flow that:&lt;/SPAN&gt;&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;call the &amp;lt;name&amp;gt;_I2C_Disable() function,&lt;/LI&gt;
&lt;LI&gt;set the slave address (repeat the above line of code but with desired address). You can use the register to modify your slave address directly.&lt;/LI&gt;
&lt;LI&gt;call the &amp;lt;name&amp;gt;_I2C_Enable function&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;Please try it on your side.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Wish it helps you!&lt;/P&gt;
&lt;P&gt;If you still have questions about it, please kindly let me know!&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;/P&gt;
&lt;P&gt;Kerry&lt;/P&gt;
&lt;P&gt;-------------------------------------------------------------------------------&lt;/P&gt;
&lt;P&gt;Note:&lt;/P&gt;
&lt;P&gt;- If this post answers your question, please click the "Mark Correct" button. Thank you!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;- We are following threads for 7 weeks after the last post, later replies are ignored&lt;/P&gt;
&lt;P&gt;Please open a new thread and refer to the closed one, if you have a related question at a later point in time.&lt;/P&gt;
&lt;P&gt;-----------------------------------------------------------------------------&lt;/P&gt;</description>
      <pubDate>Thu, 22 Oct 2020 02:38:46 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Change-I2C-slave-address-after-init-K20/m-p/1171460#M58572</guid>
      <dc:creator>kerryzhou</dc:creator>
      <dc:date>2020-10-22T02:38:46Z</dc:date>
    </item>
  </channel>
</rss>

