<?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: Re: No proper I2C clock. Is my baudrate calculation correcT? in Kinetis Microcontrollers</title>
    <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/No-proper-I2C-clock-Is-my-baudrate-calculation-correcT/m-p/315989#M13863</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Clive&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My mistake, your part has pseudo-open-drain pins when you set them to I2C mode.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What board do you have? I have attached a binary for the accelerometer on the FRDM-KL02Z - it uses the same pins as you have configured and reads the accelerometer continuously (back-to-back I2C reads for ever - on the UART command line interface via the Virtual COM at 115k Baud go to the I2C menu and activate the print-out of values with "acc_on"), whereby you can then use the debugger to dump the registers to work out any differences to yours.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can get source&amp;nbsp; code at &lt;A href="http://www.utasker.com/forum/index.php?topic=1721.0" title="http://www.utasker.com/forum/index.php?topic=1721.0"&gt;http://www.utasker.com/forum/index.php?topic=1721.0&lt;/A&gt;&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;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 09 Jun 2014 14:52:12 GMT</pubDate>
    <dc:creator>mjbcswitzerland</dc:creator>
    <dc:date>2014-06-09T14:52:12Z</dc:date>
    <item>
      <title>No proper I2C clock. Is my baudrate calculation correcT?</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/No-proper-I2C-clock-Is-my-baudrate-calculation-correcT/m-p/315985#M13859</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm trying to get some I2C ISR code working on my KL02Z device. I'm getting complete garbage with no reliable start sequence&amp;nbsp; clock. I am getting a bit bogged down.&lt;/P&gt;&lt;P&gt;Is there anyone who can verify my I2C init and baud rate calculation? Am I doing something stupid here?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #7f0055; font-size: 10pt;"&gt;&lt;STRONG&gt;void&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt; &lt;STRONG&gt;i2c_master_init&lt;/STRONG&gt;(&lt;/SPAN&gt;&lt;STRONG style=": ; color: #7f0055; font-size: 10pt;"&gt;void&lt;/STRONG&gt;&lt;SPAN style="font-size: 10pt;"&gt;)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt; {&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3f7f5f; font-size: 10pt;"&gt;// disable IRQ I2C0 vector is 24&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3f7f5f; font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; NVIC_ICER = 1 &amp;lt;&amp;lt; (8%32);&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;&amp;nbsp; SIM_SCGC4 |= SIM_SCGC4_I2C0_MASK;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #3f7f5f; font-size: 10pt;"&gt;// enable IIC0 clock&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;&amp;nbsp; SIM_SCGC5 |= SIM_SCGC5_PORTA_MASK; &lt;/SPAN&gt;&lt;SPAN style="color: #3f7f5f; font-size: 10pt;"&gt;// enable PORTA clock&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; PORTA_PCR3 |= PORT_PCR_MUX(2);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; PORTA_PCR4 |= PORT_PCR_MUX(2);&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3f7f5f; font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #3f7f5f; font-size: 10pt;"&gt;/* Configure Divider Register - about 375K baud rate with 24MHZ bus clock */&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3f7f5f; font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt; &lt;/SPAN&gt;I2C0_F |= (I2C_F_MULT(1) | I2C_F_ICR(9));&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;&amp;nbsp; I2C0_C1 |= (I2C_C1_IICEN_MASK |&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #3f7f5f; font-size: 10pt;"&gt;// enable IIC&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;&amp;nbsp; I2C_C1_IICIE_MASK |&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #3f7f5f; font-size: 10pt;"&gt;// interrupt enable&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;&amp;nbsp; I2C_C1_TX_MASK);&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #3f7f5f; font-size: 10pt;"&gt;// enable TX mode&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3f7f5f; font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #3f7f5f; font-size: 10pt;"&gt;// enable_irq(8);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; NVIC_ICPR |= 1 &amp;lt;&amp;lt; (8%32);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; NVIC_ISER |= 1 &amp;lt;&amp;lt; (8%32);&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If I perform a write with a address then I start off with something like............&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I2C0_S |= I2C_S_IICIF_MASK; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;NVIC_ICER = 1 &amp;lt;&amp;lt; (8%32);&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt; I2C0_C1 |= I2C_C1_TX_MASK; &lt;/SPAN&gt;&lt;SPAN style="color: #3f7f5f; font-size: 10pt;"&gt;// write direction&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt; I2C0_C1 |= I2C_C1_MST_MASK; &lt;/SPAN&gt;&lt;SPAN style="color: #3f7f5f; font-size: 10pt;"&gt;// Generate START SIGNAL&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;I2C0_D = ((addr &amp;lt;&amp;lt; 1) | WRITE); &lt;/SPAN&gt;&lt;SPAN style="color: #3f7f5f; font-size: 10pt;"&gt;// Write 7-bit Slave Address + WRITE bit&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;STRONG style=": ; color: #7f0055; font-size: 10pt;"&gt;while&lt;/STRONG&gt;&lt;SPAN style="font-size: 10pt;"&gt; (0 == (I2C0_S &amp;amp; I2C_S_IICIF_MASK))&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt; { };&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #3f7f5f; font-size: 10pt;"&gt;// wait for address transferred&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #3f7f5f; font-size: 10pt;"&gt;//enable_irq(8);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3f7f5f; font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3f7f5f; font-size: 10pt;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 09 Jun 2014 09:25:28 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/No-proper-I2C-clock-Is-my-baudrate-calculation-correcT/m-p/315985#M13859</guid>
      <dc:creator>clivepalmer</dc:creator>
      <dc:date>2014-06-09T09:25:28Z</dc:date>
    </item>
    <item>
      <title>Re: No proper I2C clock. Is my baudrate calculation correcT?</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/No-proper-I2C-clock-Is-my-baudrate-calculation-correcT/m-p/315986#M13860</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sorry I should have added that I have some 4K7 pull ups on my slave device.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 09 Jun 2014 09:27:28 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/No-proper-I2C-clock-Is-my-baudrate-calculation-correcT/m-p/315986#M13860</guid>
      <dc:creator>clivepalmer</dc:creator>
      <dc:date>2014-06-09T09:27:28Z</dc:date>
    </item>
    <item>
      <title>Re: No proper I2C clock. Is my baudrate calculation correcT?</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/No-proper-I2C-clock-Is-my-baudrate-calculation-correcT/m-p/315987#M13861</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Clive&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;A change that you need to make is to enable the ports used to be open-drain. Presently they are configured as push-pull so can't work as I2C.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I also advise the following to be tolerant to I2C bus lock-up: &lt;A href="https://community.nxp.com/thread/322977"&gt;I2C device dead-lock recovery&lt;/A&gt;&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;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 09 Jun 2014 11:54:16 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/No-proper-I2C-clock-Is-my-baudrate-calculation-correcT/m-p/315987#M13861</guid>
      <dc:creator>mjbcswitzerland</dc:creator>
      <dc:date>2014-06-09T11:54:16Z</dc:date>
    </item>
    <item>
      <title>Re: No proper I2C clock. Is my baudrate calculation correcT?</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/No-proper-I2C-clock-Is-my-baudrate-calculation-correcT/m-p/315988#M13862</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Mark. How do I do that, only the KL02 has no open drain control registers to do this?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 09 Jun 2014 12:21:57 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/No-proper-I2C-clock-Is-my-baudrate-calculation-correcT/m-p/315988#M13862</guid>
      <dc:creator>clivepalmer</dc:creator>
      <dc:date>2014-06-09T12:21:57Z</dc:date>
    </item>
    <item>
      <title>Re: Re: No proper I2C clock. Is my baudrate calculation correcT?</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/No-proper-I2C-clock-Is-my-baudrate-calculation-correcT/m-p/315989#M13863</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Clive&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My mistake, your part has pseudo-open-drain pins when you set them to I2C mode.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What board do you have? I have attached a binary for the accelerometer on the FRDM-KL02Z - it uses the same pins as you have configured and reads the accelerometer continuously (back-to-back I2C reads for ever - on the UART command line interface via the Virtual COM at 115k Baud go to the I2C menu and activate the print-out of values with "acc_on"), whereby you can then use the debugger to dump the registers to work out any differences to yours.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can get source&amp;nbsp; code at &lt;A href="http://www.utasker.com/forum/index.php?topic=1721.0" title="http://www.utasker.com/forum/index.php?topic=1721.0"&gt;http://www.utasker.com/forum/index.php?topic=1721.0&lt;/A&gt;&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;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 09 Jun 2014 14:52:12 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/No-proper-I2C-clock-Is-my-baudrate-calculation-correcT/m-p/315989#M13863</guid>
      <dc:creator>mjbcswitzerland</dc:creator>
      <dc:date>2014-06-09T14:52:12Z</dc:date>
    </item>
    <item>
      <title>Re: No proper I2C clock. Is my baudrate calculation correcT?</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/No-proper-I2C-clock-Is-my-baudrate-calculation-correcT/m-p/315990#M13864</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have a FRDM-KL02Z. I have no working debugger with Eclipse yet (I gave up trying to get the openSDA debugger working with Eclipse). I have tried some known code and I still cannot get the I2C to clock out a slave address. I get a valid start condition, but the start condition is never followed by the address being clocked out. I'm hitting my ISR without any issue. At the moment I'm completely out of ideas.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 Jun 2014 07:28:01 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/No-proper-I2C-clock-Is-my-baudrate-calculation-correcT/m-p/315990#M13864</guid>
      <dc:creator>clivepalmer</dc:creator>
      <dc:date>2014-06-10T07:28:01Z</dc:date>
    </item>
    <item>
      <title>Re: No proper I2C clock. Is my baudrate calculation correcT?</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/No-proper-I2C-clock-Is-my-baudrate-calculation-correcT/m-p/315991#M13865</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Clive&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Are you not using CodeWarrior? If you are having debugging issues try also CooCox CoIDE or IAR Quickstart (much simpler to work with than CW).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you attach your binary file I could load it to my board and possibily tell you what is going wrong - you would need to show the Tx routine (C source code) and tell me which address it starts at (in the map file). Essentially, apart for the I2C port mapping, there is no difference between operation on KL02 in comparison to a K70 or any other KL/K device.&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;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 Jun 2014 13:27:48 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/No-proper-I2C-clock-Is-my-baudrate-calculation-correcT/m-p/315991#M13865</guid>
      <dc:creator>mjbcswitzerland</dc:creator>
      <dc:date>2014-06-10T13:27:48Z</dc:date>
    </item>
    <item>
      <title>Re: No proper I2C clock. Is my baudrate calculation correcT?</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/No-proper-I2C-clock-Is-my-baudrate-calculation-correcT/m-p/315992#M13866</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Mark,&lt;/P&gt;&lt;P&gt;I got the issue sorted. It turned out to be faulty hardware and not code.&lt;/P&gt;&lt;P&gt;I'm using Eclipse and GCC because its free. Trouble with the free tools is you have to jump through hoops to get it all to work.&lt;/P&gt;&lt;P&gt;Thanks for taking the time to reply to my plight.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Jun 2014 12:10:17 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/No-proper-I2C-clock-Is-my-baudrate-calculation-correcT/m-p/315992#M13866</guid>
      <dc:creator>clivepalmer</dc:creator>
      <dc:date>2014-06-11T12:10:17Z</dc:date>
    </item>
    <item>
      <title>Re: No proper I2C clock. Is my baudrate calculation correcT?</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/No-proper-I2C-clock-Is-my-baudrate-calculation-correcT/m-p/315993#M13867</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Clive&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;OK. Good to hear that the issue is solved.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Note that CooCox CoIDE and KDS are also free.&lt;/P&gt;&lt;P&gt;The IAR Kickstart works up to 32k and CW10.x up to 128k so are also effectively free for A KL02 ;-)&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;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Jun 2014 13:17:47 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/No-proper-I2C-clock-Is-my-baudrate-calculation-correcT/m-p/315993#M13867</guid>
      <dc:creator>mjbcswitzerland</dc:creator>
      <dc:date>2014-06-11T13:17:47Z</dc:date>
    </item>
  </channel>
</rss>

