<?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 receive problem with KL25Z in Kinetis Microcontrollers</title>
    <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/I2C-receive-problem-with-KL25Z/m-p/239043#M5702</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you for your help!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Formerly i've figured out the lack of restart condition in the silicon erata sheet.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I met a strange thing about the MMA8452Q inertia sensor:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The datasheet of the sensor says that the "Who I am" field is factory programmed at 0x2A value.&lt;/P&gt;&lt;P&gt;I decided to use the onboard USB to serial converter, to debug the received value.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Result: The value as "Who I am" sent back as 0x1A data.&lt;/P&gt;&lt;P&gt;After this I was curious about the other register's default values, and I find out that the other values&lt;/P&gt;&lt;P&gt;are read correctly, only the "Who I am" identification data were incorrect.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks to this documentation problem, I spent 2 days without success, and I have modified my code multiple times&lt;/P&gt;&lt;P&gt;because I thought the problem is with me...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 04 Aug 2013 12:51:23 GMT</pubDate>
    <dc:creator>rothkarl</dc:creator>
    <dc:date>2013-08-04T12:51:23Z</dc:date>
    <item>
      <title>I2C receive problem with KL25Z</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/I2C-receive-problem-with-KL25Z/m-p/239041#M5700</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear Freescale Community!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've successfully set up a toolchain to program the KL25Z dev board, and I need some kind of help using I2C!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'am trying to access the onboard inertia sensor, I can address it correctly, I receive ACK on my commands, but when I want to receive data, I cannot get the proper data back.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Example: I want to read out the "Who I am" register, the chip accepts my request, but I cannot get back the 0x2A result, as I should. Here is my code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I2C0_F |= I2C_F_MULT(0); //erata says MULT with different value of 0 blocks RESTART condition&lt;/P&gt;&lt;P&gt;&amp;nbsp; I2C0_F |= I2C_F_ICR(63); //~317 kbaud&lt;/P&gt;&lt;P&gt;&amp;nbsp; I2C0_C1 |= I2C_C1_IICEN_MASK;//enable I2C module&lt;/P&gt;&lt;P&gt;&amp;nbsp; I2C0_C1 |= I2C_C1_TX_MASK;//set up for transmit&lt;/P&gt;&lt;P&gt;&amp;nbsp; I2C0_C1 |= I2C_C1_MST_MASK;//I2C START action&lt;/P&gt;&lt;P&gt;&amp;nbsp; for(delay=0;delay&amp;lt;10000;delay++);&lt;/P&gt;&lt;P&gt;&amp;nbsp; i2c_send_byte(0x3a);//ACK=ok, i tested it&lt;/P&gt;&lt;P&gt;&amp;nbsp; i2c_send_byte(0x0d);//ACK=ok, i tested it&lt;/P&gt;&lt;P&gt;&amp;nbsp; I2C0_C1 |= I2C_C1_RSTA_MASK;//restart&lt;/P&gt;&lt;P&gt;&amp;nbsp; i2c_send_byte(0x3b); //ACK=ok, i tested it&lt;/P&gt;&lt;P&gt;&amp;nbsp; I2C0_C1 &amp;amp;= ~I2C_C1_TX_MASK; //enable i2c receive&lt;/P&gt;&lt;P&gt;&amp;nbsp; if(I2C0_D); //trigger receive in I2C bus, Here Iam just reading the data register. If i miss this step I cannot receive anything&lt;/P&gt;&lt;P&gt;&amp;nbsp; while(1){&lt;/P&gt;&lt;P&gt;&amp;nbsp; if((I2C0_S &amp;amp; I2C_S_TCF_MASK) != I2C_S_TCF_MASK) break;}&lt;/P&gt;&lt;P&gt;&amp;nbsp; while(1){ if((I2C0_S &amp;amp; I2C_S_TCF_MASK)) break;}&lt;/P&gt;&lt;P&gt;&amp;nbsp; for(delay=0;delay&amp;lt;10000;delay++); &lt;/P&gt;&lt;P&gt;&amp;nbsp; I2C0_C1 |= I2C_C1_TXAK_MASK; //generate no ack condition&lt;/P&gt;&lt;P&gt;&amp;nbsp; I2C0_C1 |= I2C_C1_TX_MASK; //enable transmission, by this the next read of data register will not trigger byte reception&lt;/P&gt;&lt;P&gt;&amp;nbsp; c=I2C0_D;&amp;nbsp; //after completion of reception I read out the data register &lt;/P&gt;&lt;P&gt;&amp;nbsp; if(c == 0x2a) GPIOB_PDOR &amp;amp;=~(1 &amp;lt;&amp;lt; 18); //I cannot get the proper result&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I hope you can breifly help me, how to receive data on i2c bus!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you in advance!&lt;/P&gt;&lt;P&gt;Roth K.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 04 Aug 2013 11:20:06 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/I2C-receive-problem-with-KL25Z/m-p/239041#M5700</guid>
      <dc:creator>rothkarl</dc:creator>
      <dc:date>2013-08-04T11:20:06Z</dc:date>
    </item>
    <item>
      <title>Re: I2C receive problem with KL25Z</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/I2C-receive-problem-with-KL25Z/m-p/239042#M5701</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Karl,&lt;/P&gt;&lt;P&gt;just a wild shot: there is an issue in the KL25Z around 'repeated start'. I was bumping into this one, and it could be your problem:&lt;/P&gt;&lt;P&gt;&lt;A href="http://mcuoneclipse.com/2012/12/05/kl25z-and-i2c-missing-repeated-start-condition/" title="http://mcuoneclipse.com/2012/12/05/kl25z-and-i2c-missing-repeated-start-condition/"&gt;KL25Z and I2C: Missing Repeated Start Condition | MCU on Eclipse&lt;/A&gt;&lt;/P&gt;&lt;P&gt;I recommend that you check your clock settings/dividers if this is your problem.&lt;/P&gt;&lt;P&gt;In any case, I recommend that you use a logic analyzer to check what is going on the bus.&lt;/P&gt;&lt;P&gt;If you have another FRDM-KL25Z, you could turn it into a low logic analzyer too (&lt;A href="http://mcuoneclipse.com/2013/02/03/turning-the-freedom-board-into-a-logic-analyzer/" title="http://mcuoneclipse.com/2013/02/03/turning-the-freedom-board-into-a-logic-analyzer/"&gt;Turning the Freedom Board into a Logic Analyzer | MCU on Eclipse&lt;/A&gt;).&lt;/P&gt;&lt;P&gt;Altough I'm using Processor Expert, this post with the sources on GitHub might be helpful:&lt;/P&gt;&lt;P&gt;&lt;A href="http://mcuoneclipse.com/2013/04/13/extended-driver-for-the-mma8451q-accelerometer/" title="http://mcuoneclipse.com/2013/04/13/extended-driver-for-the-mma8451q-accelerometer/"&gt;Extended Driver for the MMA8451Q Accelerometer | MCU on Eclipse&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I hope this helps.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 04 Aug 2013 11:39:13 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/I2C-receive-problem-with-KL25Z/m-p/239042#M5701</guid>
      <dc:creator>BlackNight</dc:creator>
      <dc:date>2013-08-04T11:39:13Z</dc:date>
    </item>
    <item>
      <title>Re: I2C receive problem with KL25Z</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/I2C-receive-problem-with-KL25Z/m-p/239043#M5702</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you for your help!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Formerly i've figured out the lack of restart condition in the silicon erata sheet.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I met a strange thing about the MMA8452Q inertia sensor:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The datasheet of the sensor says that the "Who I am" field is factory programmed at 0x2A value.&lt;/P&gt;&lt;P&gt;I decided to use the onboard USB to serial converter, to debug the received value.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Result: The value as "Who I am" sent back as 0x1A data.&lt;/P&gt;&lt;P&gt;After this I was curious about the other register's default values, and I find out that the other values&lt;/P&gt;&lt;P&gt;are read correctly, only the "Who I am" identification data were incorrect.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks to this documentation problem, I spent 2 days without success, and I have modified my code multiple times&lt;/P&gt;&lt;P&gt;because I thought the problem is with me...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 04 Aug 2013 12:51:23 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/I2C-receive-problem-with-KL25Z/m-p/239043#M5702</guid>
      <dc:creator>rothkarl</dc:creator>
      <dc:date>2013-08-04T12:51:23Z</dc:date>
    </item>
    <item>
      <title>Re: I2C receive problem with KL25Z</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/I2C-receive-problem-with-KL25Z/m-p/239044#M5703</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sorry, I made the mistake. When I downloaded the datasheet of the 8452 insted of 8451, thats why I wanted to read 0x2a instead of 0x1a.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The documentation correct, sorry!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 04 Aug 2013 13:37:20 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/I2C-receive-problem-with-KL25Z/m-p/239044#M5703</guid>
      <dc:creator>rothkarl</dc:creator>
      <dc:date>2013-08-04T13:37:20Z</dc:date>
    </item>
  </channel>
</rss>

