<?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 Timing Collisions in Kinetis Microcontrollers</title>
    <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/I2C-Timing-Collisions/m-p/1470098#M63263</link>
    <description>&lt;P&gt;2.2k sounds good (in many cases only 4.7k are used and are usually good too).&lt;/P&gt;&lt;P&gt;I'm wondering if you are doing anything special in your I2C transmit/receive operations (maybe changing the I2C hardware somehow). I would make sure and check if plenty of stack/memory is allocated for each task, just to get a possible memory/stack overflow out of the equation. Just a rough guess.&lt;/P&gt;</description>
    <pubDate>Tue, 07 Jun 2022 16:08:18 GMT</pubDate>
    <dc:creator>ErichStyger</dc:creator>
    <dc:date>2022-06-07T16:08:18Z</dc:date>
    <item>
      <title>I2C Timing Collisions</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/I2C-Timing-Collisions/m-p/1470015#M63260</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I'm running FreeRTOS and I have two independent threads (of the same priority) running I2C communications for two separate I2C buses on a K64 family microcontroller. Each thread polls a device and then sleeps for 1000 ms.&amp;nbsp;&lt;/P&gt;&lt;P&gt;When the two threads are started via the &lt;FONT face="courier new,courier"&gt;vTaskStartScheduler()&lt;/FONT&gt; call, they run near concurrently, and after a few minutes one of the I2C busses is hung. I grabbed a&amp;nbsp; couple scope captures and show that the clock signal seems to be corrupted. See "&lt;FONT face="courier new,courier"&gt;communication_failed_1.png&lt;/FONT&gt;" and "&lt;FONT face="courier new,courier"&gt;communication_failed_2.png&lt;/FONT&gt;"&lt;/P&gt;&lt;P&gt;However I staggered the threads such that one had an initial delay so that the two threads ran near sequentially, and there never was an issue with the communication. See "&lt;FONT face="courier new,courier"&gt;staggered_thread_start.png&lt;/FONT&gt;".&lt;/P&gt;&lt;P&gt;Has anyone observed something like this? Is there a configuration required to allow communication on two independent I2C busses to run concurrently?&lt;/P&gt;</description>
      <pubDate>Tue, 07 Jun 2022 13:12:46 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/I2C-Timing-Collisions/m-p/1470015#M63260</guid>
      <dc:creator>eric_escobar</dc:creator>
      <dc:date>2022-06-07T13:12:46Z</dc:date>
    </item>
    <item>
      <title>Re: I2C Timing Collisions</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/I2C-Timing-Collisions/m-p/1470021#M63261</link>
      <description>&lt;P&gt;Are your pull-ups strong enough? At least some signals show some kind of cross-talk (not sure from the pictures).&lt;/P&gt;&lt;P&gt;I would check if using stronger (external, of course) pull-ups will help.&lt;/P&gt;</description>
      <pubDate>Tue, 07 Jun 2022 13:23:49 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/I2C-Timing-Collisions/m-p/1470021#M63261</guid>
      <dc:creator>ErichStyger</dc:creator>
      <dc:date>2022-06-07T13:23:49Z</dc:date>
    </item>
    <item>
      <title>Re: I2C Timing Collisions</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/I2C-Timing-Collisions/m-p/1470041#M63262</link>
      <description>&lt;P&gt;Hi Erich,&lt;/P&gt;&lt;P&gt;Thanks for the response. I do believe they are strong enough, the I2C lines are pulled up to 3.3V via 2.2k resistors.&lt;/P&gt;&lt;P&gt;I agree, it looks like some cross talk, however I was attributing that to coupling with the scope probes.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 07 Jun 2022 13:52:18 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/I2C-Timing-Collisions/m-p/1470041#M63262</guid>
      <dc:creator>eric_escobar</dc:creator>
      <dc:date>2022-06-07T13:52:18Z</dc:date>
    </item>
    <item>
      <title>Re: I2C Timing Collisions</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/I2C-Timing-Collisions/m-p/1470098#M63263</link>
      <description>&lt;P&gt;2.2k sounds good (in many cases only 4.7k are used and are usually good too).&lt;/P&gt;&lt;P&gt;I'm wondering if you are doing anything special in your I2C transmit/receive operations (maybe changing the I2C hardware somehow). I would make sure and check if plenty of stack/memory is allocated for each task, just to get a possible memory/stack overflow out of the equation. Just a rough guess.&lt;/P&gt;</description>
      <pubDate>Tue, 07 Jun 2022 16:08:18 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/I2C-Timing-Collisions/m-p/1470098#M63263</guid>
      <dc:creator>ErichStyger</dc:creator>
      <dc:date>2022-06-07T16:08:18Z</dc:date>
    </item>
    <item>
      <title>Re: I2C Timing Collisions</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/I2C-Timing-Collisions/m-p/1470133#M63267</link>
      <description>&lt;P&gt;"&lt;SPAN&gt;maybe changing the I2C hardware somehow"&lt;BR /&gt;&lt;BR /&gt;A lot of Freescale/NXP example code uses |= (OR) rather than = (Assignment) for "Write 1 to clear".&lt;BR /&gt;At best this wastes space and time, at worse it clears unexpected bits.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 07 Jun 2022 17:42:46 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/I2C-Timing-Collisions/m-p/1470133#M63267</guid>
      <dc:creator>bobpaddock</dc:creator>
      <dc:date>2022-06-07T17:42:46Z</dc:date>
    </item>
    <item>
      <title>Re: I2C Timing Collisions</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/I2C-Timing-Collisions/m-p/1470159#M63268</link>
      <description>&lt;P&gt;Hi Erich,&lt;/P&gt;&lt;P&gt;I doubled checked, and each task is only using 25-30% of its allocated stack, so I don't think its a memory/stack overflow.&lt;/P&gt;&lt;P&gt;The I2C buses are configured in the auto generated board.c/peripherals.c files.&lt;/P&gt;&lt;P&gt;As for the transmit receive operations, I'm using the &lt;FONT face="courier new,courier"&gt;I2C_RTOS_Transfer()&lt;/FONT&gt; API. I set up the transfer structure and then call the API function. The microcontroller is continuously polling various status parameters from the slave devices. I have the following code snippet repeated for the ~20 status parameters, then the task sleeps for 1 second and then polls again.&lt;/P&gt;&lt;P&gt;The communication does work for a few seconds then after a few minutes one of the two buses hangs.&lt;/P&gt;&lt;LI-CODE lang="c"&gt;// Make sure bus is not in use
i2cStatus = I2C_MasterGetStatusFlags(busId);
while (kI2C_BusBusyFlag &amp;amp; i2cStatus)
{
    i2cStatus = I2C_MasterGetStatusFlags(busId);
}
// Set up Transfer Structure
masterXfer.direction = kI2C_Read;
masterXfer.subaddress = 0x8B;
masterXfer.data = (uint8_t*)&amp;amp;status;
masterXfer.dataSize = 2;
// Initiate Transfer
I2C_RTOS_Transfer(i2cX_RtosHandle, &amp;amp;masterXfer);&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 07 Jun 2022 19:39:32 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/I2C-Timing-Collisions/m-p/1470159#M63268</guid>
      <dc:creator>eric_escobar</dc:creator>
      <dc:date>2022-06-07T19:39:32Z</dc:date>
    </item>
    <item>
      <title>Re: I2C Timing Collisions</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/I2C-Timing-Collisions/m-p/1470668#M63274</link>
      <description>&lt;P&gt;I think I cannot comment much. Have mostly used a single I2C bus with multiple tasks, and using a mutex to implement the serialization. I have a few applications using two different I2C on Kinetis, accessed each by multiple tasks, and guarded with mutex too, and never faced such a problem.&lt;/P&gt;&lt;P&gt;But I have not used that &lt;FONT face="courier new,courier"&gt;I2C_RTOS_Transfer()&lt;/FONT&gt; API: I always used a direct API guarded with that above mutex. Not sure if this helps.&lt;/P&gt;</description>
      <pubDate>Wed, 08 Jun 2022 13:01:12 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/I2C-Timing-Collisions/m-p/1470668#M63274</guid>
      <dc:creator>ErichStyger</dc:creator>
      <dc:date>2022-06-08T13:01:12Z</dc:date>
    </item>
  </channel>
</rss>

