<?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>Kinetis Software Development Kit中的主题 Can't get I2C_DRV_MasterSendData() to work</title>
    <link>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/Can-t-get-I2C-DRV-MasterSendData-to-work/m-p/468539#M3707</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm using a K02 with SDK 1.3.0.&amp;nbsp; I'm trying to do some basic I2C communication as the Master on bare metal using I2C_DRV_MasterSendData().&amp;nbsp; I have a breakpoint set in the Master IRQ handler to catch if an ACK wasn't received.&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If I step into the API call and run to the point where it calls I2C_DRV_SendAddress(), I can see that the slave address is set correctly.&amp;nbsp; If I try to step into or over this call to send the address, it breaks in the Master IRQ handler saying an ACK wasn't received.&amp;nbsp; My scope shows that some random byte went out on the bus.&amp;nbsp; If I delete the breakpoint in the IRQ handler, I can step into the call and again, see that the slave address is correct.&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I thought maybe the debugger was messing things up so I just let it run past these two lines in my code:&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ret = I2C_DRV_MasterSendData(I2C_IDX, &amp;amp;I2C_MasterConfig0, NULL, 0, &amp;amp;i2c_data[0], 1);&lt;/P&gt;&lt;P&gt;while (I2C_DRV_MasterGetSendStatus(I2C_IDX, &amp;amp;bytes) == kStatus_I2C_Busy);&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But that doesn't work either.&amp;nbsp; This seems like a pretty simple implementation of I2C communication but I can't get it to work.&amp;nbsp; &lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any ideas on what to check?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 06 Jan 2016 15:45:08 GMT</pubDate>
    <dc:creator>mikewilliams</dc:creator>
    <dc:date>2016-01-06T15:45:08Z</dc:date>
    <item>
      <title>Can't get I2C_DRV_MasterSendData() to work</title>
      <link>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/Can-t-get-I2C-DRV-MasterSendData-to-work/m-p/468539#M3707</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm using a K02 with SDK 1.3.0.&amp;nbsp; I'm trying to do some basic I2C communication as the Master on bare metal using I2C_DRV_MasterSendData().&amp;nbsp; I have a breakpoint set in the Master IRQ handler to catch if an ACK wasn't received.&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If I step into the API call and run to the point where it calls I2C_DRV_SendAddress(), I can see that the slave address is set correctly.&amp;nbsp; If I try to step into or over this call to send the address, it breaks in the Master IRQ handler saying an ACK wasn't received.&amp;nbsp; My scope shows that some random byte went out on the bus.&amp;nbsp; If I delete the breakpoint in the IRQ handler, I can step into the call and again, see that the slave address is correct.&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I thought maybe the debugger was messing things up so I just let it run past these two lines in my code:&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ret = I2C_DRV_MasterSendData(I2C_IDX, &amp;amp;I2C_MasterConfig0, NULL, 0, &amp;amp;i2c_data[0], 1);&lt;/P&gt;&lt;P&gt;while (I2C_DRV_MasterGetSendStatus(I2C_IDX, &amp;amp;bytes) == kStatus_I2C_Busy);&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But that doesn't work either.&amp;nbsp; This seems like a pretty simple implementation of I2C communication but I can't get it to work.&amp;nbsp; &lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any ideas on what to check?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 06 Jan 2016 15:45:08 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/Can-t-get-I2C-DRV-MasterSendData-to-work/m-p/468539#M3707</guid>
      <dc:creator>mikewilliams</dc:creator>
      <dc:date>2016-01-06T15:45:08Z</dc:date>
    </item>
    <item>
      <title>Re: Can't get I2C_DRV_MasterSendData() to work</title>
      <link>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/Can-t-get-I2C-DRV-MasterSendData-to-work/m-p/468540#M3708</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Mike,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Looks like you are using I2C non-block mode in your application, so I recommend you referring to the demo in "C:\Freescale\KSDK_1.3.0\examples\frdmk64f\driver_examples\i2c\i2c_non_blocking" for details. The usage of I2C_DRV_MasterSendData() should be like the following:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="pastedImage_17.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/52185i6275EB5FB5FAD37D/image-size/large?v=v2&amp;amp;px=999" role="button" title="pastedImage_17.png" alt="pastedImage_17.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Hope that helps,&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Have a great day,&lt;BR /&gt;Kan&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;NXP Technical Support&lt;BR /&gt;-----------------------------------------------------------------------------------------------------------------------&lt;BR /&gt;Note: If this post answers your question, please click the Correct Answer button. Thank you!&lt;BR /&gt;-----------------------------------------------------------------------------------------------------------------------&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 Jan 2016 08:20:09 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/Can-t-get-I2C-DRV-MasterSendData-to-work/m-p/468540#M3708</guid>
      <dc:creator>Kan_Li</dc:creator>
      <dc:date>2016-01-07T08:20:09Z</dc:date>
    </item>
    <item>
      <title>Re: Can't get I2C_DRV_MasterSendData() to work</title>
      <link>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/Can-t-get-I2C-DRV-MasterSendData-to-work/m-p/468541#M3709</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hey Kan, thanks for the reply.&amp;nbsp; The example code you listed is what I used in my code.&amp;nbsp; It just doesn't work.&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If I just run past while loop waiting on the status, it doesn’t work.&amp;nbsp; I see 0x7f on the scope, or some other random data.&amp;nbsp; If I step into the API call and run down into I2C_DRV_SendAddress() and stop &lt;STRONG&gt;after&lt;/STRONG&gt; the call to I2C_HAL_WriteByte() that sends out the slave address and &lt;STRONG&gt;stop before&lt;/STRONG&gt; the call to I2C_DRV_MasterWait(), I see the correct slave address on the scope.&amp;nbsp; If I run &lt;STRONG&gt;past&lt;/STRONG&gt; the call to I2C_DRV_MasterWait(), I see the 0x7f on the scope instead of the correct slave address.&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Calibri','sans-serif';"&gt;My guess is that it has something to do with the I2C_DRV_MasterWait() but I don’t know what it could be.&amp;nbsp; I set up everything using PE for a bare metal board.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 Jan 2016 15:13:06 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/Can-t-get-I2C-DRV-MasterSendData-to-work/m-p/468541#M3709</guid>
      <dc:creator>mikewilliams</dc:creator>
      <dc:date>2016-01-07T15:13:06Z</dc:date>
    </item>
  </channel>
</rss>

