<?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: LPC865 SDK 2.16 I2C DMA driver problem</title>
    <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC865-SDK-2-16-I2C-DMA-driver-problem/m-p/2014116#M57415</link>
    <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/244578"&gt;@SALapilli&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks for your sharing.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The IRQ handler &lt;CODE&gt;s_i2cMasterIsr&lt;/CODE&gt; is assigned differently depending on the function used.&lt;/P&gt;
&lt;P&gt;For I2C without DMA, the &lt;CODE&gt;I2C_MasterTransferCreateHandle()&lt;/CODE&gt; function is used:&lt;/P&gt;
&lt;DIV class="tongyi-design-highlighter global-dark-theme"&gt;
&lt;DIV&gt;
&lt;PRE&gt;&lt;CODE&gt;&lt;SPAN&gt;/* Save master interrupt handler. */&lt;/SPAN&gt;
s_i2cMasterIsr = I2C_MasterTransferHandleIRQ;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;P&gt;For I2C with DMA, the &lt;CODE&gt;I2C_MasterTransferCreateHandle&lt;FONT color="#FF0000"&gt;DMA&lt;/FONT&gt;()&lt;/CODE&gt; function is used instead.&lt;/P&gt;
&lt;P&gt;Therefore, different APIs are called based on whether DMA is utilized or not.&lt;/P&gt;
&lt;HR /&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;BR&lt;/P&gt;
&lt;P&gt;Alice&lt;/P&gt;</description>
    <pubDate>Mon, 16 Dec 2024 05:36:57 GMT</pubDate>
    <dc:creator>Alice_Yang</dc:creator>
    <dc:date>2024-12-16T05:36:57Z</dc:date>
    <item>
      <title>LPC865 SDK 2.16 I2C DMA driver problem</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC865-SDK-2-16-I2C-DMA-driver-problem/m-p/2013567#M57404</link>
      <description>&lt;DIV&gt;&lt;DIV class=""&gt;&lt;SPAN&gt;In the LPC865 SDK, when using DMA mode in the I2C driver, the driver &lt;/SPAN&gt;fsl_i2c_dma.h&lt;SPAN&gt; defines the variable &lt;/SPAN&gt;static i2c_isr_t s_i2cMasterIsr;&lt;SPAN&gt; and correctly initializes it to point to &lt;/SPAN&gt;I2C_MasterTransferDMAHandleIRQ&lt;SPAN&gt;. However, the ISR routine &lt;/SPAN&gt;I2C_TransferCommonIRQHandler&lt;SPAN&gt; (which uses &lt;/SPAN&gt;s_i2cMasterIsr&lt;SPAN&gt;) is found in the module &lt;/SPAN&gt;fsl_i2c.c&lt;SPAN&gt; which also has a static variable &lt;/SPAN&gt;s_i2cMasterIsr&lt;SPAN&gt; declared but not initialized because DMA mode is being used, resulting in a Hard Fault with a NULL pointer. I believe the &lt;/SPAN&gt;s_i2cMasterIsr&lt;SPAN&gt; variable should not be static, or a better solution would be to have a setter for the &lt;/SPAN&gt;s_i2cMasterIsr&lt;SPAN&gt; variable in the &lt;/SPAN&gt;fsl_i2c.c&lt;SPAN&gt; module that is called from &lt;/SPAN&gt;fsl_i2c_dma.c&lt;SPAN&gt; to correctly instantiate the ISR.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Fri, 13 Dec 2024 11:17:51 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC865-SDK-2-16-I2C-DMA-driver-problem/m-p/2013567#M57404</guid>
      <dc:creator>SALapilli</dc:creator>
      <dc:date>2024-12-13T11:17:51Z</dc:date>
    </item>
    <item>
      <title>Re: LPC865 SDK 2.16 I2C DMA driver problem</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC865-SDK-2-16-I2C-DMA-driver-problem/m-p/2014116#M57415</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/244578"&gt;@SALapilli&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks for your sharing.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The IRQ handler &lt;CODE&gt;s_i2cMasterIsr&lt;/CODE&gt; is assigned differently depending on the function used.&lt;/P&gt;
&lt;P&gt;For I2C without DMA, the &lt;CODE&gt;I2C_MasterTransferCreateHandle()&lt;/CODE&gt; function is used:&lt;/P&gt;
&lt;DIV class="tongyi-design-highlighter global-dark-theme"&gt;
&lt;DIV&gt;
&lt;PRE&gt;&lt;CODE&gt;&lt;SPAN&gt;/* Save master interrupt handler. */&lt;/SPAN&gt;
s_i2cMasterIsr = I2C_MasterTransferHandleIRQ;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;P&gt;For I2C with DMA, the &lt;CODE&gt;I2C_MasterTransferCreateHandle&lt;FONT color="#FF0000"&gt;DMA&lt;/FONT&gt;()&lt;/CODE&gt; function is used instead.&lt;/P&gt;
&lt;P&gt;Therefore, different APIs are called based on whether DMA is utilized or not.&lt;/P&gt;
&lt;HR /&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;BR&lt;/P&gt;
&lt;P&gt;Alice&lt;/P&gt;</description>
      <pubDate>Mon, 16 Dec 2024 05:36:57 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC865-SDK-2-16-I2C-DMA-driver-problem/m-p/2014116#M57415</guid>
      <dc:creator>Alice_Yang</dc:creator>
      <dc:date>2024-12-16T05:36:57Z</dc:date>
    </item>
    <item>
      <title>Re: LPC865 SDK 2.16 I2C DMA driver problem</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC865-SDK-2-16-I2C-DMA-driver-problem/m-p/2016001#M57432</link>
      <description>Yes, I have done everything you explained. The problem is that the interrupt service routine "I2C0_DriverIRQHandler" is in the module "fsl_i2c.c" and uses a static pointer to the specific routine. When calling the routine "I2C_MasterTransferCreateHandleDMA", it alter the static pointer "s_i2cMasterIsr" within the module "fsl_i2c_dma.c", and therefore it does not alter the value of the pointer of the same name "s_i2cMasterIsr" present in the module "fsk_i2c.c", which is the one used by the IRQ.&lt;BR /&gt;I have defined the following routine within "fsl_i2c.c":&lt;BR /&gt;void Setteri2cMasterIsr(uint32_t instance,void * handle,i2c_isr_t pRut)&lt;BR /&gt;{&lt;BR /&gt;s_i2cHandle[instance] = handle;&lt;BR /&gt;s_i2cMasterIsr = pRut;&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;And I call it from the routine "I2C_MasterTransferCreateHandleDMA" in the module "fsl_i2c_dma.c"&lt;BR /&gt;&lt;BR /&gt;This solves the problem. Please fix the automatic code generator in the SDK to correctly modify the routine pointer so it is not left undefined and does not end in a HARD FAULT. To reproduce the SDK BUG, simply create a project with i2c DMA, which compiles perfectly but ends in a HARD FAULT when trying to run it.</description>
      <pubDate>Wed, 18 Dec 2024 11:19:13 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC865-SDK-2-16-I2C-DMA-driver-problem/m-p/2016001#M57432</guid>
      <dc:creator>SALapilli</dc:creator>
      <dc:date>2024-12-18T11:19:13Z</dc:date>
    </item>
    <item>
      <title>Re: LPC865 SDK 2.16 I2C DMA driver problem</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC865-SDK-2-16-I2C-DMA-driver-problem/m-p/2017812#M57445</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/244578"&gt;@SALapilli&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I really appreciate your sharing. We will analysis and reported it to SDK development team.&lt;/P&gt;
&lt;P&gt;Sorry for the inconvenient to you.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;BR&lt;/P&gt;
&lt;P&gt;Alice&lt;/P&gt;</description>
      <pubDate>Fri, 20 Dec 2024 10:13:29 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC865-SDK-2-16-I2C-DMA-driver-problem/m-p/2017812#M57445</guid>
      <dc:creator>Alice_Yang</dc:creator>
      <dc:date>2024-12-20T10:13:29Z</dc:date>
    </item>
  </channel>
</rss>

