<?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 Re: I2C stop condition problem in Kinetis Microcontrollers</title>
    <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/I2C-stop-condition-problem/m-p/895601#M52852</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Brian&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Take a look at appendix A of &lt;A href="http://www.utasker.com/docs/uTasker/uTasker_I2C.pdf" target="test_blank"&gt;http://www.utasker.com/docs/uTasker/uTasker_I2C.pdf&lt;/A&gt; to see the I2C interrupts and states (use the non-buffered reference for the K22).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also try &lt;A href="https://github.com/uTasker/uTasker-Kinetis" target="test_blank"&gt;https://github.com/uTasker/uTasker-Kinetis&lt;/A&gt; since it includes I2C simulation which also aids in tracing the operation, interrupts and identifying what may not yet be correct.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Did you write the I2C_stop() function or is it from a library? Resetting the TX bit is possibly a mistake.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Mark&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;EM&gt;Complete Kinetis solutions for professionals, training and support: &lt;A href="http://www.utasker.com/kinetis.html" target="test_blank"&gt;http://www.utasker.com/kinetis.html&lt;/A&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;Kinetis K22:&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;- &lt;A href="http://www.utasker.com/kinetis/FRDM-K22F.html" target="test_blank"&gt;http://www.utasker.com/kinetis/FRDM-K22F.html&lt;/A&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;- &lt;A href="http://www.utasker.com/kinetis/TWR-K22F120M.html" target="test_blank"&gt;http://www.utasker.com/kinetis/TWR-K22F120M.html&lt;/A&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;- &lt;A href="http://www.utasker.com/kinetis/BLAZE_K22.html" target="test_blank"&gt;http://www.utasker.com/kinetis/BLAZE_K22.html&lt;/A&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;- &lt;A href="http://www.utasker.com/kinetis/tinyK22.html" target="test_blank"&gt;http://www.utasker.com/kinetis/tinyK22.html&lt;/A&gt;&lt;/EM&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 29 Apr 2019 21:12:32 GMT</pubDate>
    <dc:creator>mjbcswitzerland</dc:creator>
    <dc:date>2019-04-29T21:12:32Z</dc:date>
    <item>
      <title>I2C stop condition problem</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/I2C-stop-condition-problem/m-p/895600#M52851</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Recently i've been trying to implement non-blocking I2C transfers on my FRDM-k22f but i'm struggling to&amp;nbsp;make proper transfers.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As example i'm trying to send slave adress, register address and 2 data bytes but at the end i end up with 5 bytes instead of 4. I double check and i write to data register only 4 times so it seems analyzer sees random states on the bus as a byte?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I checked how much interrupts i get and there is 1 caused by &lt;STRONG&gt;STARTF&lt;/STRONG&gt;, 4 caused by &lt;STRONG&gt;TCF&lt;/STRONG&gt; and one by &lt;STRONG&gt;STOPF&amp;nbsp;&lt;/STRONG&gt;which seems to correct using this way of thinking:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. startf - slaveaddress&lt;BR /&gt;2. regaddress&lt;BR /&gt;3.&amp;nbsp;data&lt;BR /&gt;4. data&lt;BR /&gt;5. no data to send - generate stop condition&lt;BR /&gt;6. stopf interrupt&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now the problem starts because even i got interrupt by stopf i cannot get correct stop condition on the bus?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;At 5th interrupt i use my I2C_stop function to generate stop condition:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;void I2C_stop(I2C_Type *base)&lt;BR /&gt;{&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;base-&amp;gt;C1 &amp;amp;= ~(I2C_C1_MST_MASK|I2C_C1_TX_MASK|I2C_C1_TXAK_MASK);&lt;BR /&gt;}&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;That's how it looks on analyzer:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="snip.PNG"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/70734i8FB5599842C1853E/image-size/large?v=v2&amp;amp;px=999" role="button" title="snip.PNG" alt="snip.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any ideas what might be wrong? I followed block schematic from k22f manual to properly handle interrupts but it's still not enough to get it going.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 29 Apr 2019 19:54:00 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/I2C-stop-condition-problem/m-p/895600#M52851</guid>
      <dc:creator>errorek123</dc:creator>
      <dc:date>2019-04-29T19:54:00Z</dc:date>
    </item>
    <item>
      <title>Re: I2C stop condition problem</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/I2C-stop-condition-problem/m-p/895601#M52852</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Brian&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Take a look at appendix A of &lt;A href="http://www.utasker.com/docs/uTasker/uTasker_I2C.pdf" target="test_blank"&gt;http://www.utasker.com/docs/uTasker/uTasker_I2C.pdf&lt;/A&gt; to see the I2C interrupts and states (use the non-buffered reference for the K22).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also try &lt;A href="https://github.com/uTasker/uTasker-Kinetis" target="test_blank"&gt;https://github.com/uTasker/uTasker-Kinetis&lt;/A&gt; since it includes I2C simulation which also aids in tracing the operation, interrupts and identifying what may not yet be correct.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Did you write the I2C_stop() function or is it from a library? Resetting the TX bit is possibly a mistake.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Mark&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;EM&gt;Complete Kinetis solutions for professionals, training and support: &lt;A href="http://www.utasker.com/kinetis.html" target="test_blank"&gt;http://www.utasker.com/kinetis.html&lt;/A&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;Kinetis K22:&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;- &lt;A href="http://www.utasker.com/kinetis/FRDM-K22F.html" target="test_blank"&gt;http://www.utasker.com/kinetis/FRDM-K22F.html&lt;/A&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;- &lt;A href="http://www.utasker.com/kinetis/TWR-K22F120M.html" target="test_blank"&gt;http://www.utasker.com/kinetis/TWR-K22F120M.html&lt;/A&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;- &lt;A href="http://www.utasker.com/kinetis/BLAZE_K22.html" target="test_blank"&gt;http://www.utasker.com/kinetis/BLAZE_K22.html&lt;/A&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;- &lt;A href="http://www.utasker.com/kinetis/tinyK22.html" target="test_blank"&gt;http://www.utasker.com/kinetis/tinyK22.html&lt;/A&gt;&lt;/EM&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 29 Apr 2019 21:12:32 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/I2C-stop-condition-problem/m-p/895601#M52852</guid>
      <dc:creator>mjbcswitzerland</dc:creator>
      <dc:date>2019-04-29T21:12:32Z</dc:date>
    </item>
    <item>
      <title>Re: I2C stop condition problem</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/I2C-stop-condition-problem/m-p/895602#M52853</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Problem is that i clock is generated 5 times even i write to Data register only 4 times, no read operation and afaik only write/read operations to data registers actually generate clock? I will try to make it without start and stop interrupts as in single buffered from your pdf&amp;nbsp;and let you know if that helped.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I2C stop is my own but i tried with and without resetting TX bit, result is almost the same, value of extra byte at the end is just different.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 30 Apr 2019 06:20:01 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/I2C-stop-condition-problem/m-p/895602#M52853</guid>
      <dc:creator>errorek123</dc:creator>
      <dc:date>2019-04-30T06:20:01Z</dc:date>
    </item>
    <item>
      <title>Re: I2C stop condition problem</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/I2C-stop-condition-problem/m-p/895603#M52854</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Brian Smith,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; From your description, I think your problem still in the software side.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; I highly recommend you refer to the official SDK code, which can be downloaded from this link:&lt;/P&gt;&lt;P&gt;&lt;A class="link-titled" href="https://mcuxpresso.nxp.com/en/welcome" title="https://mcuxpresso.nxp.com/en/welcome"&gt;Welcome | MCUXpresso SDK Builder&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; If you want to generate 4 times clock, you can just send 4 times in the code.&lt;/P&gt;&lt;P&gt;&amp;nbsp; You can check the official I2C code at first, if the official code also have problem in your side.&lt;/P&gt;&lt;P&gt;&amp;nbsp; Just let me know.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Have a great day,&lt;BR /&gt;Kerry&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-------------------------------------------------------------------------------&lt;BR /&gt;Note:&lt;BR /&gt;- If this post answers your question, please click the "Mark Correct" button. Thank you!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- We are following threads for 7 weeks after the last post, later replies are ignored&lt;BR /&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;BR /&gt;-------------------------------------------------------------------------------&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 30 Apr 2019 07:32:36 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/I2C-stop-condition-problem/m-p/895603#M52854</guid>
      <dc:creator>kerryzhou</dc:creator>
      <dc:date>2019-04-30T07:32:36Z</dc:date>
    </item>
  </channel>
</rss>

