<?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: SPI Interrupt SDK Example does not work in a C++ project</title>
    <link>https://community.nxp.com/t5/LPC-Microcontrollers/SPI-Interrupt-SDK-Example-does-not-work-in-a-C-project/m-p/1256380#M44522</link>
    <description>&lt;P&gt;I found my code error.&amp;nbsp; I added a *.cpp file to the project that contained a second definition for SPI9 in an IRQ handler I had written for a different project.&amp;nbsp; Because it was named FLEXCOMM9_IRQHandler(), I didn’t recognize that it had effectively redefined SPI9 which I had been defined in the SPI_MasterInit() function I had intended for use in the masterCallback().&amp;nbsp; So instead of calling the latter function main called FLEXCOMM9_IRQHandler() instead.&amp;nbsp;&lt;/P&gt;&lt;P&gt;It took me a long time to find this problem because FLEXCOMM9_IRQHandler redefined SPI9 in a file that I wrote in the past. &amp;nbsp;What troubleshooting process could I have implemented that would have allowed me to see that SPI9 defined in main was pointing to the wrong handler?&amp;nbsp; I didn’t see a difference when I compared the vector tables between my working C project and my failed C++ project.&lt;/P&gt;</description>
    <pubDate>Fri, 02 Apr 2021 18:48:44 GMT</pubDate>
    <dc:creator>jmueckl</dc:creator>
    <dc:date>2021-04-02T18:48:44Z</dc:date>
    <item>
      <title>SPI Interrupt SDK Example does not work in a C++ project</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/SPI-Interrupt-SDK-Example-does-not-work-in-a-C-project/m-p/1251694#M44426</link>
      <description>&lt;P&gt;The code in the attached file is nearly identical to that of an SDK example LPC54018_spi_int_b2b_master_transfer. &amp;nbsp;When I run this code in a new C project, it runs without error.&amp;nbsp; But when I run the identical code in a new C++ project, it gets hung up waiting for flag masterFinished to become true, and never gets into function masterCallback.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Notice the ‘extern C’ surrounds the prototype of masterCallback in order to prevent mangling.&amp;nbsp; I also verified that the functions SPI_MasterTransferCreateHandle, SPI_MasterTransferNonBlocking and SPI_MasterTransferHandleIRQ used in this program are all C extern’d in fsl_spi.h.&amp;nbsp; What else would hang up the calling of masterCallback?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 25 Mar 2021 02:18:34 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/SPI-Interrupt-SDK-Example-does-not-work-in-a-C-project/m-p/1251694#M44426</guid>
      <dc:creator>jmueckl</dc:creator>
      <dc:date>2021-03-25T02:18:34Z</dc:date>
    </item>
    <item>
      <title>Re: SPI Interrupt SDK Example does not work in a C++ project</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/SPI-Interrupt-SDK-Example-does-not-work-in-a-C-project/m-p/1253076#M44452</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/180784"&gt;@jmueckl&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;In the following &lt;A href="https://isocpp.org/wiki/faq/mixing-c-and-cpp" target="_self"&gt;link&lt;/A&gt; are some guidelines to mix C and C++. I will suggest taking a look.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;/P&gt;
&lt;P&gt;Alexis Andalon&lt;/P&gt;</description>
      <pubDate>Fri, 26 Mar 2021 23:57:57 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/SPI-Interrupt-SDK-Example-does-not-work-in-a-C-project/m-p/1253076#M44452</guid>
      <dc:creator>Alexis_A</dc:creator>
      <dc:date>2021-03-26T23:57:57Z</dc:date>
    </item>
    <item>
      <title>Re: SPI Interrupt SDK Example does not work in a C++ project</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/SPI-Interrupt-SDK-Example-does-not-work-in-a-C-project/m-p/1253170#M44454</link>
      <description>&lt;P&gt;Thank you for that document, Alexis_A.&amp;nbsp; I made some changes based on it, mainly format changes, but that didn't resolve the issue.&amp;nbsp; I've resolved this problem in another MCUXpresso project successfully using the extern C construct, but this time that was not enough.&amp;nbsp; There is only one function that is involved in this case, so it should be simple.&amp;nbsp; The only thing I can imagine is an SDK bug.&amp;nbsp; No?&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 28 Mar 2021 09:08:51 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/SPI-Interrupt-SDK-Example-does-not-work-in-a-C-project/m-p/1253170#M44454</guid>
      <dc:creator>jmueckl</dc:creator>
      <dc:date>2021-03-28T09:08:51Z</dc:date>
    </item>
    <item>
      <title>Re: SPI Interrupt SDK Example does not work in a C++ project</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/SPI-Interrupt-SDK-Example-does-not-work-in-a-C-project/m-p/1253815#M44469</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/180784"&gt;@jmueckl&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;Since this is only present when you integrate this in the C++ code, I don't think this is an SDK bug. I will suggest checking if the configuration is done correctly after the initialization (check the registers in the peripherals view) comparing it with the C SDK example.&lt;/P&gt;
&lt;P&gt;Also, have you tried looking with an oscilloscope or logic analyzer to check if there's any activity in the bus?&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;/P&gt;
&lt;P&gt;Alexis Andalon&lt;/P&gt;</description>
      <pubDate>Mon, 29 Mar 2021 22:59:24 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/SPI-Interrupt-SDK-Example-does-not-work-in-a-C-project/m-p/1253815#M44469</guid>
      <dc:creator>Alexis_A</dc:creator>
      <dc:date>2021-03-29T22:59:24Z</dc:date>
    </item>
    <item>
      <title>Re: SPI Interrupt SDK Example does not work in a C++ project</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/SPI-Interrupt-SDK-Example-does-not-work-in-a-C-project/m-p/1254681#M44480</link>
      <description>&lt;P&gt;When I step through the code and analyze the addresses, data and registers resulting from each function call, I see no difference between the C and the C++ project implementations. However, when I put a breakpoint in the function SPI_MasterTransferHandleIRQ(), which is in fsl_spi.c, the function is only called in the C implementation, and not called in the C++ implementation.&lt;/P&gt;&lt;P&gt;The Clock and MOSI signals look as I expect on an oscilloscope for the C project.&amp;nbsp; But in the case of C++ project, only the clock signal wiggles 8 times, and nothing happens after that. &amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 31 Mar 2021 04:58:41 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/SPI-Interrupt-SDK-Example-does-not-work-in-a-C-project/m-p/1254681#M44480</guid>
      <dc:creator>jmueckl</dc:creator>
      <dc:date>2021-03-31T04:58:41Z</dc:date>
    </item>
    <item>
      <title>Re: SPI Interrupt SDK Example does not work in a C++ project</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/SPI-Interrupt-SDK-Example-does-not-work-in-a-C-project/m-p/1255044#M44487</link>
      <description>&lt;P&gt;Have you checked the vector table in both implementations in the startup file (.c for C and .cpp for C++).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can you export and post the whole (C++) project, including any dependencies so I can try and build it here.&lt;/P&gt;</description>
      <pubDate>Wed, 31 Mar 2021 15:22:41 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/SPI-Interrupt-SDK-Example-does-not-work-in-a-C-project/m-p/1255044#M44487</guid>
      <dc:creator>converse</dc:creator>
      <dc:date>2021-03-31T15:22:41Z</dc:date>
    </item>
    <item>
      <title>Re: SPI Interrupt SDK Example does not work in a C++ project</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/SPI-Interrupt-SDK-Example-does-not-work-in-a-C-project/m-p/1255475#M44489</link>
      <description>&lt;P&gt;The vector tables in the startup.cpp and startup.c files for the two projects are the same.&lt;/P&gt;&lt;P&gt;I have attached a zipped up version of my CPP project after it was exported to an xml file.&amp;nbsp; Thank you for looking at this.&lt;/P&gt;</description>
      <pubDate>Thu, 01 Apr 2021 04:06:18 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/SPI-Interrupt-SDK-Example-does-not-work-in-a-C-project/m-p/1255475#M44489</guid>
      <dc:creator>jmueckl</dc:creator>
      <dc:date>2021-04-01T04:06:18Z</dc:date>
    </item>
    <item>
      <title>Re: SPI Interrupt SDK Example does not work in a C++ project</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/SPI-Interrupt-SDK-Example-does-not-work-in-a-C-project/m-p/1255906#M44506</link>
      <description>&lt;P&gt;Sorry, but that does not help at all. To be able to help, I need a complete, buildable project, with all dependencies... You can create such a package from the Quickstart panel:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screenshot 2021-04-01 at 16.34.02.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/141209i72E5EC57865CED91/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Screenshot 2021-04-01 at 16.34.02.png" alt="Screenshot 2021-04-01 at 16.34.02.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;</description>
      <pubDate>Thu, 01 Apr 2021 15:35:18 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/SPI-Interrupt-SDK-Example-does-not-work-in-a-C-project/m-p/1255906#M44506</guid>
      <dc:creator>converse</dc:creator>
      <dc:date>2021-04-01T15:35:18Z</dc:date>
    </item>
    <item>
      <title>Re: SPI Interrupt SDK Example does not work in a C++ project</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/SPI-Interrupt-SDK-Example-does-not-work-in-a-C-project/m-p/1255932#M44507</link>
      <description>&lt;P&gt;Sorry about that.&amp;nbsp; I have attached the project as you have indicated.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 01 Apr 2021 17:27:18 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/SPI-Interrupt-SDK-Example-does-not-work-in-a-C-project/m-p/1255932#M44507</guid>
      <dc:creator>jmueckl</dc:creator>
      <dc:date>2021-04-01T17:27:18Z</dc:date>
    </item>
    <item>
      <title>Re: SPI Interrupt SDK Example does not work in a C++ project</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/SPI-Interrupt-SDK-Example-does-not-work-in-a-C-project/m-p/1256380#M44522</link>
      <description>&lt;P&gt;I found my code error.&amp;nbsp; I added a *.cpp file to the project that contained a second definition for SPI9 in an IRQ handler I had written for a different project.&amp;nbsp; Because it was named FLEXCOMM9_IRQHandler(), I didn’t recognize that it had effectively redefined SPI9 which I had been defined in the SPI_MasterInit() function I had intended for use in the masterCallback().&amp;nbsp; So instead of calling the latter function main called FLEXCOMM9_IRQHandler() instead.&amp;nbsp;&lt;/P&gt;&lt;P&gt;It took me a long time to find this problem because FLEXCOMM9_IRQHandler redefined SPI9 in a file that I wrote in the past. &amp;nbsp;What troubleshooting process could I have implemented that would have allowed me to see that SPI9 defined in main was pointing to the wrong handler?&amp;nbsp; I didn’t see a difference when I compared the vector tables between my working C project and my failed C++ project.&lt;/P&gt;</description>
      <pubDate>Fri, 02 Apr 2021 18:48:44 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/SPI-Interrupt-SDK-Example-does-not-work-in-a-C-project/m-p/1256380#M44522</guid>
      <dc:creator>jmueckl</dc:creator>
      <dc:date>2021-04-02T18:48:44Z</dc:date>
    </item>
  </channel>
</rss>

