<?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: MKE1xF I2C FIFO Error Flag in Kinetis Microcontrollers</title>
    <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/MKE1xF-I2C-FIFO-Error-Flag/m-p/909924#M53330</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Greetings,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;error is resolved.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As it seems it's not related to the MCU HW, rather it's the issue with the way the commands are placed in the code. That being said, it also has to do with the many interrupts running in the background and the position of the next state in the I2C state machine. Check the original code, above and then correct version below.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What was done, was that the next state was refreshed before feeding the data to the TX FIFO. As it turns out, I2C ISR was faster upon arrival than the chance to update the next state variable.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="language-c line-numbers"&gt;&lt;CODE&gt;&lt;SPAN class="token function"&gt;StartMaster&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;   &lt;SPAN class="comment token"&gt;// called once from task manager, every 1 ms&lt;/SPAN&gt;
&lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;
      &lt;SPAN class="keyword token"&gt;if&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;IDLE &lt;SPAN class="operator token"&gt;==&lt;/SPAN&gt; i2cDriver&lt;SPAN class="operator token"&gt;-&amp;gt;&lt;/SPAN&gt;State&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
      &lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;
         i2cDriver&lt;SPAN class="operator token"&gt;-&amp;gt;&lt;/SPAN&gt;State &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; COMMAND&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;   &lt;SPAN class="comment token"&gt;// change state first, then load TX FIFO&lt;/SPAN&gt;
         &lt;SPAN class="token function"&gt;m_I2C_send_addres&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
      &lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt;
&lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt;

&lt;SPAN class="token function"&gt;LcdISR&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;   &lt;SPAN class="comment token"&gt;// called on ACK or any other I2C interrupt, 80 times in a row&lt;/SPAN&gt;
&lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;
  &lt;SPAN class="token function"&gt;CheckErrorFlags&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;   &lt;SPAN class="comment token"&gt;// here is where flag type can be checked: NACK, ARBLOST, FIFOERR&lt;/SPAN&gt;
   &lt;SPAN class="keyword token"&gt;switch&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;i2cDriver&lt;SPAN class="operator token"&gt;-&amp;gt;&lt;/SPAN&gt;State&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
   &lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;
      &lt;SPAN class="keyword token"&gt;case&lt;/SPAN&gt; COMMAND&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
         i2cDriver&lt;SPAN class="operator token"&gt;-&amp;gt;&lt;/SPAN&gt;State &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; DATA&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
         &lt;SPAN class="token function"&gt;m_I2C_send_data&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;command&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
         
      &lt;SPAN class="keyword token"&gt;case&lt;/SPAN&gt; DATA&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
         i2cDriver&lt;SPAN class="operator token"&gt;-&amp;gt;&lt;/SPAN&gt;State &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; STOP&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
         &lt;SPAN class="token function"&gt;m_I2C_send_data&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;data&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;

      &lt;SPAN class="keyword token"&gt;case&lt;/SPAN&gt; STOP&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
         &lt;SPAN class="token function"&gt;m_I2C_STOP&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
         i2cDriver&lt;SPAN class="operator token"&gt;-&amp;gt;&lt;/SPAN&gt;State &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; IDLE&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
      &lt;SPAN class="keyword token"&gt;default&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
         &lt;SPAN class="token function"&gt;m_I2C_STOP&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
         i2cDriver&lt;SPAN class="operator token"&gt;-&amp;gt;&lt;/SPAN&gt;State &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; ERROR&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
   &lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt;
&lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt;‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 02 Dec 2019 17:19:07 GMT</pubDate>
    <dc:creator>mariogolubic</dc:creator>
    <dc:date>2019-12-02T17:19:07Z</dc:date>
    <item>
      <title>MKE1xF I2C FIFO Error Flag</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/MKE1xF-I2C-FIFO-Error-Flag/m-p/909919#M53325</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm trying to resolve this issue for some time now but no luck. I'll state the short form of the firmware workflow.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Behind the simple task-scheduler (lowest ISR priority) there is a constantly running SPWM generator (48kHz) and a ADC (48kHz) (2ch PDB driven). Both are using (high priority) ISR's to set/read parameters.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I2C is connected to a 4x20 character LCD. I2C is clocked at 400kHz. I2C is also used as a non-blocking process with a state machine in ISR to service the ADDRESS-COMMAND-DATA sequence. Address and Command bytes never change.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Every 1ms there is a function call to send a char to a LCD. When to counter runs to 80, whole thing starts again. To start a transfer there is a dedicated function StartMaster(...); that prepares the data to be sent in a software TX buffer. Software TX buffer later fills the I2C periphery hardware Tx buffer.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;After a call of the function (I2C bus must be IDLE first), ADDRESS is sent to the LCD. On ACK, ISR send the COMMAND, and on second ACK, ISR sends the DATA byte. STOP is generated after the last ACK.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sometimes, very irregularly and hard to connect with other functions, the I2C driver detects &lt;STRONG&gt;FIFO Error Flag&lt;/STRONG&gt;. This then blocks the LCD and whole thing freezes until reset.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;I would appreciate very much if some one knows the conditions in which this flag is raised (or suggest the workaround).&lt;/STRONG&gt; Datasheet is very narrow in describing this phenomena: &lt;EM&gt;Detects an attempt to send or receive data without first generating a (repeated) START condition&lt;/EM&gt;. (Kinetis KE1xF Sub-Family Reference Manual, Rev. 3, 06/2017, Page 1250)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If any additional information's are necessary please do ask. I can even present some code segments if needed.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Mario&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 11 Oct 2019 16:19:32 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/MKE1xF-I2C-FIFO-Error-Flag/m-p/909919#M53325</guid>
      <dc:creator>mariogolubic</dc:creator>
      <dc:date>2019-10-11T16:19:32Z</dc:date>
    </item>
    <item>
      <title>Re: MKE1xF I2C FIFO Error Flag</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/MKE1xF-I2C-FIFO-Error-Flag/m-p/909920#M53326</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Mario,&lt;/P&gt;&lt;P&gt;I have a couple of questions that can help me better understand the behavior you are experiencing.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; background-color: #ffffff;"&gt;Sometimes, very irregularly and hard to connect with other functions, the I2C driver detects&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;STRONG style="color: #51626f; background-color: #ffffff; border: 0px; font-weight: bold;"&gt;FIFO Error Flag&lt;/STRONG&gt;&lt;SPAN style="color: #51626f; background-color: #ffffff;"&gt;.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;When you say sometimes, is this during the execution of the 80 times yuo are expecting this to go through. Does it always happen after a certain number? Or you can do this process several times before the LCD freezes?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Are you basing your application on an example? If so can you please provie the IDE Name and Version and SDK version as well.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best Regards,&lt;/P&gt;&lt;P&gt;Sabina&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 14 Oct 2019 20:39:48 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/MKE1xF-I2C-FIFO-Error-Flag/m-p/909920#M53326</guid>
      <dc:creator>Sabina_Bruce</dc:creator>
      <dc:date>2019-10-14T20:39:48Z</dc:date>
    </item>
    <item>
      <title>Re: MKE1xF I2C FIFO Error Flag</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/MKE1xF-I2C-FIFO-Error-Flag/m-p/909921#M53327</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Sabina,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thank You for taking interest in this topic. I'll answer the questions as best as I can, so if anything is left &lt;SPAN data-dobid="hdw"&gt;ambiguous&lt;/SPAN&gt; feel free to comment. (Your questions are marked so they can be visually different)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;EM&gt;When you say sometimes, is this during the execution of the 80 times you are expecting this to go through.&lt;/EM&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;The FIFO error occurs only while sending this data stream (80 messages) to the LCD.&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;EM&gt;Does it always happen after a certain number?&lt;/EM&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;I did try to find out this by inspecting the I2C lines with a scope and also capturing error in the debug mode. I didn't found a number of messages send prior to the freeze to be a constant. Sometimes, everything works for a number of minutes, 10-12-15-40min and then it suddenly falls apart. Also, regarding the message number, nothing happens on the same count. Sometimes it breaks after 40 successful messages send, sometime after 60 and so on. I know that if there was something regular, I could point myself to the issue and inspect it more deeply, but sadly it isn't. That's why I am asking of the conditions when the FEF is asserted. Maybe this mechanism could put some light on the issue.&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;EM&gt;Or you can do this process several times before the LCD freezes?&lt;/EM&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;I think I answered this question above.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also changing the priority of interrupts didn't help. I've even put the I2C ISR on priority 0 but no luck.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;I2C engine (simplified)&lt;/STRONG&gt;&lt;/P&gt;&lt;PRE class="language-c line-numbers"&gt;&lt;CODE&gt;&lt;SPAN class="token function"&gt;StartMaster&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;   &lt;SPAN class="comment token"&gt;// called once from task manager, every 1 ms&lt;/SPAN&gt;
&lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;
      &lt;SPAN class="keyword token"&gt;if&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;IDLE &lt;SPAN class="operator token"&gt;==&lt;/SPAN&gt; i2cDriver&lt;SPAN class="operator token"&gt;-&amp;gt;&lt;/SPAN&gt;State&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
      &lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;
         i2cDriver&lt;SPAN class="operator token"&gt;-&amp;gt;&lt;/SPAN&gt;State &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; ADDRESS&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
         &lt;SPAN class="token function"&gt;m_I2C_send_addres&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
         i2cDriver&lt;SPAN class="operator token"&gt;-&amp;gt;&lt;/SPAN&gt;State &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; COMMAND&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
      &lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt;
&lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt;

&lt;SPAN class="token function"&gt;LcdISR&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;   &lt;SPAN class="comment token"&gt;// called on ACK or any other I2C interrupt, 80 times in a row&lt;/SPAN&gt;
&lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;
  &lt;SPAN class="token function"&gt;CheckErrorFlags&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;   &lt;SPAN class="comment token"&gt;// here is where flag type can be checked: NACK, ARBLOST, FIFOERR&lt;/SPAN&gt;
   &lt;SPAN class="keyword token"&gt;switch&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;i2cDriver&lt;SPAN class="operator token"&gt;-&amp;gt;&lt;/SPAN&gt;State&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
   &lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;
      &lt;SPAN class="keyword token"&gt;case&lt;/SPAN&gt; COMMAND&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
         &lt;SPAN class="token function"&gt;m_I2C_send_data&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;command&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
         i2cDriver&lt;SPAN class="operator token"&gt;-&amp;gt;&lt;/SPAN&gt;State &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; DATA&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
      &lt;SPAN class="keyword token"&gt;case&lt;/SPAN&gt; DATA&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
         &lt;SPAN class="token function"&gt;m_I2C_send_data&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;data&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
         i2cDriver&lt;SPAN class="operator token"&gt;-&amp;gt;&lt;/SPAN&gt;State &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; STOP&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
      &lt;SPAN class="keyword token"&gt;case&lt;/SPAN&gt; STOP&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
         &lt;SPAN class="token function"&gt;m_I2C_STOP&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
         i2cDriver&lt;SPAN class="operator token"&gt;-&amp;gt;&lt;/SPAN&gt;State &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; IDLE&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
      &lt;SPAN class="keyword token"&gt;default&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
         &lt;SPAN class="token function"&gt;m_I2C_STOP&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
         i2cDriver&lt;SPAN class="operator token"&gt;-&amp;gt;&lt;/SPAN&gt;State &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; ERROR&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
   &lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt;
&lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt;‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 18 Oct 2019 08:19:55 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/MKE1xF-I2C-FIFO-Error-Flag/m-p/909921#M53327</guid>
      <dc:creator>mariogolubic</dc:creator>
      <dc:date>2019-10-18T08:19:55Z</dc:date>
    </item>
    <item>
      <title>Re: MKE1xF I2C FIFO Error Flag</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/MKE1xF-I2C-FIFO-Error-Flag/m-p/909922#M53328</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Mario,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you for the detailed information. The FEF flag is enabled, when clock stretching is disabled. It is possible that you are having clock synchronization issues when the data is being sent through. Generally this is not necessary as the master determines the speed and the slave follows, but it is possible that the slave may be taking longer to process the information at certain points and therefore causing it to stop transmitting data randomly.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Assuming that the hardware is setup correctly and prior to making any changes, Could you check if the following bits are also set along with the FEF.&lt;/P&gt;&lt;P&gt;TXFE&lt;/P&gt;&lt;P&gt;RXUFE&lt;/P&gt;&lt;P&gt;TXOF&lt;/P&gt;&lt;P&gt;RXUF&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Let me know the results of this, so I can continue the support.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best Regards,&lt;/P&gt;&lt;P&gt;Sabina&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 22 Oct 2019 20:09:53 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/MKE1xF-I2C-FIFO-Error-Flag/m-p/909922#M53328</guid>
      <dc:creator>Sabina_Bruce</dc:creator>
      <dc:date>2019-10-22T20:09:53Z</dc:date>
    </item>
    <item>
      <title>Re: MKE1xF I2C FIFO Error Flag</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/MKE1xF-I2C-FIFO-Error-Flag/m-p/909923#M53329</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Sabina,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've attached full I2C0 memory dump on event. I'm not sure but except FEF, no other register exist from Your list. :smileysad:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="I2C0_dump.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/93220i34EA5C2CFF3EDDB0/image-size/large?v=v2&amp;amp;px=999" role="button" title="I2C0_dump.png" alt="I2C0_dump.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'll be on Your disposal for further questions.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kind regards,&lt;/P&gt;&lt;P&gt;Mario&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Oct 2019 13:30:51 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/MKE1xF-I2C-FIFO-Error-Flag/m-p/909923#M53329</guid>
      <dc:creator>mariogolubic</dc:creator>
      <dc:date>2019-10-23T13:30:51Z</dc:date>
    </item>
    <item>
      <title>Re: MKE1xF I2C FIFO Error Flag</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/MKE1xF-I2C-FIFO-Error-Flag/m-p/909924#M53330</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Greetings,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;error is resolved.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As it seems it's not related to the MCU HW, rather it's the issue with the way the commands are placed in the code. That being said, it also has to do with the many interrupts running in the background and the position of the next state in the I2C state machine. Check the original code, above and then correct version below.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What was done, was that the next state was refreshed before feeding the data to the TX FIFO. As it turns out, I2C ISR was faster upon arrival than the chance to update the next state variable.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="language-c line-numbers"&gt;&lt;CODE&gt;&lt;SPAN class="token function"&gt;StartMaster&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;   &lt;SPAN class="comment token"&gt;// called once from task manager, every 1 ms&lt;/SPAN&gt;
&lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;
      &lt;SPAN class="keyword token"&gt;if&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;IDLE &lt;SPAN class="operator token"&gt;==&lt;/SPAN&gt; i2cDriver&lt;SPAN class="operator token"&gt;-&amp;gt;&lt;/SPAN&gt;State&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
      &lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;
         i2cDriver&lt;SPAN class="operator token"&gt;-&amp;gt;&lt;/SPAN&gt;State &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; COMMAND&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;   &lt;SPAN class="comment token"&gt;// change state first, then load TX FIFO&lt;/SPAN&gt;
         &lt;SPAN class="token function"&gt;m_I2C_send_addres&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
      &lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt;
&lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt;

&lt;SPAN class="token function"&gt;LcdISR&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;   &lt;SPAN class="comment token"&gt;// called on ACK or any other I2C interrupt, 80 times in a row&lt;/SPAN&gt;
&lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;
  &lt;SPAN class="token function"&gt;CheckErrorFlags&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;   &lt;SPAN class="comment token"&gt;// here is where flag type can be checked: NACK, ARBLOST, FIFOERR&lt;/SPAN&gt;
   &lt;SPAN class="keyword token"&gt;switch&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;i2cDriver&lt;SPAN class="operator token"&gt;-&amp;gt;&lt;/SPAN&gt;State&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
   &lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;
      &lt;SPAN class="keyword token"&gt;case&lt;/SPAN&gt; COMMAND&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
         i2cDriver&lt;SPAN class="operator token"&gt;-&amp;gt;&lt;/SPAN&gt;State &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; DATA&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
         &lt;SPAN class="token function"&gt;m_I2C_send_data&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;command&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
         
      &lt;SPAN class="keyword token"&gt;case&lt;/SPAN&gt; DATA&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
         i2cDriver&lt;SPAN class="operator token"&gt;-&amp;gt;&lt;/SPAN&gt;State &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; STOP&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
         &lt;SPAN class="token function"&gt;m_I2C_send_data&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;data&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;

      &lt;SPAN class="keyword token"&gt;case&lt;/SPAN&gt; STOP&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
         &lt;SPAN class="token function"&gt;m_I2C_STOP&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
         i2cDriver&lt;SPAN class="operator token"&gt;-&amp;gt;&lt;/SPAN&gt;State &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; IDLE&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
      &lt;SPAN class="keyword token"&gt;default&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
         &lt;SPAN class="token function"&gt;m_I2C_STOP&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
         i2cDriver&lt;SPAN class="operator token"&gt;-&amp;gt;&lt;/SPAN&gt;State &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; ERROR&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
   &lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt;
&lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt;‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 02 Dec 2019 17:19:07 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/MKE1xF-I2C-FIFO-Error-Flag/m-p/909924#M53330</guid>
      <dc:creator>mariogolubic</dc:creator>
      <dc:date>2019-12-02T17:19:07Z</dc:date>
    </item>
  </channel>
</rss>

