<?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中的主题 Re: KL46Z I2C problems</title>
    <link>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/KL46Z-I2C-problems/m-p/609250#M6307</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Exactly at which line are you getting hard fault?&lt;/P&gt;&lt;P&gt;Are you enabling all necessary clocks. You need to enable each port clocks for the I2C pins, in addition to I2C clock.&lt;/P&gt;&lt;P&gt;In KSDK 2.0, if Port E has the I2C pins:&lt;/P&gt;&lt;P&gt;&lt;EM&gt;CLOCK_EnableClock(kCLOCK_PortE);&lt;/EM&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 29 Mar 2017 17:38:39 GMT</pubDate>
    <dc:creator>visakhanc</dc:creator>
    <dc:date>2017-03-29T17:38:39Z</dc:date>
    <item>
      <title>KL46Z I2C problems</title>
      <link>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/KL46Z-I2C-problems/m-p/609249#M6306</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am currently&amp;nbsp;working on writing a very basic I2C communication library for KL46Z who is capable of sending start, stop signals and sending to or receiving from a slave device . My environment is similar to KSDK. I am trying to use the I2C1 on port E pin 1 and pin 0 on the development board. But after initializing the corresponding port and pins, and ungating the clock, I could not write to the I2C1 registers. For example, to activate the I2C module on I2C1, the bit 7 of register I2C1_C1 must be set to 1. So my code is simply:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;void I2C_activate(I2C_Type *base){&lt;BR /&gt; base-&amp;gt;C1 |= 1U&amp;lt;&amp;lt;7;&lt;BR /&gt;}&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Using it afterwards is something like:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I2C_activate(I2C1);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Normally, this function would simply set the 7th bit of I2C1_C1 register. But instead, I get a hard fault...&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Can somebody please tell me if I am doing right? Did I forget something before writing in the register?&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thank you in advance!&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 22 Mar 2017 09:42:37 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/KL46Z-I2C-problems/m-p/609249#M6306</guid>
      <dc:creator>wenboqi</dc:creator>
      <dc:date>2017-03-22T09:42:37Z</dc:date>
    </item>
    <item>
      <title>Re: KL46Z I2C problems</title>
      <link>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/KL46Z-I2C-problems/m-p/609250#M6307</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Exactly at which line are you getting hard fault?&lt;/P&gt;&lt;P&gt;Are you enabling all necessary clocks. You need to enable each port clocks for the I2C pins, in addition to I2C clock.&lt;/P&gt;&lt;P&gt;In KSDK 2.0, if Port E has the I2C pins:&lt;/P&gt;&lt;P&gt;&lt;EM&gt;CLOCK_EnableClock(kCLOCK_PortE);&lt;/EM&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 29 Mar 2017 17:38:39 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/KL46Z-I2C-problems/m-p/609250#M6307</guid>
      <dc:creator>visakhanc</dc:creator>
      <dc:date>2017-03-29T17:38:39Z</dc:date>
    </item>
    <item>
      <title>Re: KL46Z I2C problems</title>
      <link>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/KL46Z-I2C-problems/m-p/609251#M6308</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Visakhan,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you for your comment! And yes it was due to a clock that I did not enable. I added CLOCK_EnableClock(kCLOCK_I2C) and the hard fault was gone! Thanks again for your help!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Wenbo&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 30 Mar 2017 07:09:53 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/KL46Z-I2C-problems/m-p/609251#M6308</guid>
      <dc:creator>wenboqi</dc:creator>
      <dc:date>2017-03-30T07:09:53Z</dc:date>
    </item>
  </channel>
</rss>

