<?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>LPC MicrocontrollersのトピックRe: Recovery from I2C Arbitration Error</title>
    <link>https://community.nxp.com/t5/LPC-Microcontrollers/Recovery-from-I2C-Arbitration-Error-FreeRTOS/m-p/1069203#M41237</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Padraig,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Most of the times arbitration lost is caused by a timing issue. The recommended workaround for this is to reset the I2C bus to avoid you reset the MCU.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You can try executing &lt;STRONG&gt;I2C_MasterDeinit&lt;/STRONG&gt; and initialize the module again once you detect arbitration error.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;Felipe&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-------------------------------------------------------------------------------&lt;/P&gt;&lt;P&gt;Note:&lt;/P&gt;&lt;P&gt;- If this post answers your question, please click the "Mark Correct" button. Thank you!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- We are following threads for 7 weeks after the last post, later replies are ignored.&lt;/P&gt;&lt;P&gt;Please open a new thread and refer to the closed one, if you have a related question at a later point in time.&lt;/P&gt;&lt;P&gt;------------------------------------------------------------------------------&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 10 Jun 2020 22:34:56 GMT</pubDate>
    <dc:creator>FelipeGarcia</dc:creator>
    <dc:date>2020-06-10T22:34:56Z</dc:date>
    <item>
      <title>Recovery from I2C Arbitration Error (FreeRTOS)</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/Recovery-from-I2C-Arbitration-Error-FreeRTOS/m-p/1069202#M41236</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm using the I2C interface on a LPC54608 as master device to read an&amp;nbsp;I2C slave device (LM75B temperature sensor). I find that occasionally the I2C peripheral is detecting an arbitration error. The error itself is a worry, but a bigger concern is the fact that the SDK code cannot recover from this error.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My application code is running on FreeRTOS and I'm using the example RTOS code provided in the SDK. The low-level I2C driver code is version 2.0.6 (fsl_i2C). I can debug the code and I see that the arbitration bit is set, detected by the code, and cleared, but the peripheral seems to immediately go back to a pending state, and any subsequent attempts to acces the I2C interface will fail because the SDK code is written to wait until the peripheral is available, and it seems that it will never become available after this sequence.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;A reset of the processor clears the error state and I2C communications to the device will then work again for a period of time. So I'm wondering if anyone can suggest the best was to recover this I2C peripheral device after an I2C arbitration error?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Padraig&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 08 Jun 2020 10:53:10 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/Recovery-from-I2C-Arbitration-Error-FreeRTOS/m-p/1069202#M41236</guid>
      <dc:creator>padraig_fogarty</dc:creator>
      <dc:date>2020-06-08T10:53:10Z</dc:date>
    </item>
    <item>
      <title>Re: Recovery from I2C Arbitration Error</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/Recovery-from-I2C-Arbitration-Error-FreeRTOS/m-p/1069203#M41237</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Padraig,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Most of the times arbitration lost is caused by a timing issue. The recommended workaround for this is to reset the I2C bus to avoid you reset the MCU.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You can try executing &lt;STRONG&gt;I2C_MasterDeinit&lt;/STRONG&gt; and initialize the module again once you detect arbitration error.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;Felipe&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-------------------------------------------------------------------------------&lt;/P&gt;&lt;P&gt;Note:&lt;/P&gt;&lt;P&gt;- If this post answers your question, please click the "Mark Correct" button. Thank you!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- We are following threads for 7 weeks after the last post, later replies are ignored.&lt;/P&gt;&lt;P&gt;Please open a new thread and refer to the closed one, if you have a related question at a later point in time.&lt;/P&gt;&lt;P&gt;------------------------------------------------------------------------------&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Jun 2020 22:34:56 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/Recovery-from-I2C-Arbitration-Error-FreeRTOS/m-p/1069203#M41237</guid>
      <dc:creator>FelipeGarcia</dc:creator>
      <dc:date>2020-06-10T22:34:56Z</dc:date>
    </item>
    <item>
      <title>Re: Recovery from I2C Arbitration Error</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/Recovery-from-I2C-Arbitration-Error-FreeRTOS/m-p/1069204#M41238</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Felipe,&lt;/P&gt;&lt;P&gt;Thank you for the suggestion, I can certainly try this.&lt;/P&gt;&lt;P&gt;I have tried similar approaches, but since I am running FreeRTOS there is other code e.g. the transfer state machine which must also be reset and re-initialised; and the I2C_RTOS_Deinit() function is no use since it destroys the RTOS mutex and semaphore.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Anyway, I take it from the your response that the SDK code does not have any implemented and tested mechanism to recover from this error.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards,&lt;/P&gt;&lt;P&gt;Padraig&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Jun 2020 09:59:19 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/Recovery-from-I2C-Arbitration-Error-FreeRTOS/m-p/1069204#M41238</guid>
      <dc:creator>padraig_fogarty</dc:creator>
      <dc:date>2020-06-11T09:59:19Z</dc:date>
    </item>
    <item>
      <title>Re: Recovery from I2C Arbitration Error (FreeRTOS)</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/Recovery-from-I2C-Arbitration-Error-FreeRTOS/m-p/1069205#M41239</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;In addition to the I2C abritation problem, the NXP SDK function I2C_RTOS_Transfer() has a few bugs, for which I have added details and suggested solutions as below.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;status_t I2C_RTOS_Transfer(i2c_rtos_handle_t *handle, i2c_master_transfer_t *transfer)&lt;BR /&gt;{&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; status_t status;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* Lock resource mutex */&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (xSemaphoreTake(handle-&amp;gt;mutex, portMAX_DELAY) != pdTRUE)&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return kStatus_I2C_Busy;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; status = I2C_MasterTransferNonBlocking(handle-&amp;gt;base, &amp;amp;handle-&amp;gt;drv_handle, transfer);&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (status != kStatus_Success)&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; xSemaphoreGive(handle-&amp;gt;mutex);&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return status;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* Wait for transfer to finish */&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; (void)xSemaphoreTake(handle-&amp;gt;semaphore, &lt;SPAN style="color: #ff6600;"&gt;&lt;STRONG&gt;portMAX_DELAY&lt;/STRONG&gt;&lt;/SPAN&gt;);&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: #ff6600; "&gt;BUG 1&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #003366;"&gt;Using the standard SDK code, the xSemaphoreTake delay will never expire after an I2C error occurs, so any task calling this will obviously hang forever!&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* Unlock resource mutex */&lt;BR /&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="color: #800080;"&gt;xSemaphoreGive(handle-&amp;gt;mutex);&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* Return status captured by callback function */&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; return &lt;SPAN style="color: #800080;"&gt;&lt;STRONG&gt;handle-&amp;gt;async_status&lt;/STRONG&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #800080;"&gt;&lt;STRONG&gt;BUG 2&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #003366;"&gt;The async_status is read after the mutex has been released, if another I2C transfer is pending for the same interface the returned status will be invalid. May seem unlikely but it does happen!!&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;-----------------------------------------------------------&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: #0000ff; "&gt;BUG 1 Suggested solution (limited testing but so far this has recovered from the arbitration error)&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000;"&gt;Use a fixed time delay when waiting for the semaphore, and &lt;STRONG&gt;if&lt;/STRONG&gt; a timeout occurs (due to arbitration or other error) then: &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; 1) Clear I2C status flags using I2C_MasterClearStatusFlags() &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;2) Reset the problem I2C interface using RESET_PeripheralReset()&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; 3) Init the interface using I2C_MasterInit()&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; 4) Reset the RTOS transfer state-machine &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;handle-&amp;gt;drv_handle.state = (uint8_t)kIdleState;&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff;"&gt;-----------------------------------------------------------&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: #0000ff; "&gt;BUG 2 Suggested solution&amp;nbsp;(as per fsl_spi_freertos.c, SPI_RTOS_Transfer())&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="color: #339966;"&gt;/* Retrieve status before releasing mutex */&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="color: #0000ff;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="color: #000000;"&gt;status = handle-&amp;gt;async_status;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Jun 2020 11:52:34 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/Recovery-from-I2C-Arbitration-Error-FreeRTOS/m-p/1069205#M41239</guid>
      <dc:creator>padraig_fogarty</dc:creator>
      <dc:date>2020-06-11T11:52:34Z</dc:date>
    </item>
    <item>
      <title>Re: Recovery from I2C Arbitration Error (FreeRTOS)</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/Recovery-from-I2C-Arbitration-Error-FreeRTOS/m-p/1069206#M41240</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for providing this feedback. I will send this information to the SDK team internally.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;Felipe&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 12 Jun 2020 14:45:14 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/Recovery-from-I2C-Arbitration-Error-FreeRTOS/m-p/1069206#M41240</guid>
      <dc:creator>FelipeGarcia</dc:creator>
      <dc:date>2020-06-12T14:45:14Z</dc:date>
    </item>
    <item>
      <title>Re: Recovery from I2C Arbitration Error (FreeRTOS)</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/Recovery-from-I2C-Arbitration-Error-FreeRTOS/m-p/1460754#M48829</link>
      <description>&lt;P&gt;We are using the i.MX RT1176 and have the same problem with the latest SDK. Is NXP going to fix this issue? How can we recover from an i2c communication error? We use FreeRTOS too, just like Pardraig.&lt;/P&gt;&lt;P&gt;Kind regards,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;John&lt;/P&gt;</description>
      <pubDate>Thu, 19 May 2022 09:10:24 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/Recovery-from-I2C-Arbitration-Error-FreeRTOS/m-p/1460754#M48829</guid>
      <dc:creator>John76</dc:creator>
      <dc:date>2022-05-19T09:10:24Z</dc:date>
    </item>
  </channel>
</rss>

