<?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>LPCXpresso IDE FAQs中的主题 SWO Trace setup for LPC15xx</title>
    <link>https://community.nxp.com/t5/LPCXpresso-IDE-FAQs/SWO-Trace-setup-for-LPC15xx/m-p/474154#M120</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;To carry out SWO Trace on&lt;STRONG&gt; LPC15xx&lt;/STRONG&gt;, it is necessary to:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Ensure that your board has SWO pinned out to the debug connector&lt;/LI&gt;&lt;LI&gt;Turn on the trace clock within the MCU, as this is not enabled by default&lt;/LI&gt;&lt;LI&gt;Configure the switch matrix, so that the SWO signal is accesible on an appropriate pin of the MCU&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This should typically be done within each of your application projects (or library projects that your projects link against).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;H2 id="toc-hId-1708424383"&gt;&lt;SPAN style="color: #eb7a3d;"&gt;SWO pin and debug connector&lt;/SPAN&gt;&lt;/H2&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The first revisions of the LPCXpresso1549 board did not provide for connecting the SWO pin on the debug connector.&amp;nbsp; You will need a revision C (or later) of this board to carry out SWO trace.&lt;/P&gt;&lt;P&gt;To identify which revision of board you have, look in the top right of the back of the board which should be marked:&lt;/P&gt;&lt;PRE&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;LPCXpresso1549 &lt;/SPAN&gt;
&lt;SPAN style="font-family: courier new,courier;"&gt;OM13056&amp;nbsp;&amp;nbsp; v2 &lt;STRONG&gt;Rev C&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;If you are using a different board, you will need to check the schematics to identify if SWO is connected to the debug connector.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;H2 id="toc-hId--843732578"&gt;&lt;SPAN style="color: #eb7a3d;"&gt;Enabling the trace clock&lt;/SPAN&gt;&lt;/H2&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The startup code generated by the new project wizards for LPC15xx in LPCXpresso IDE v7.7 (and later) contain code to optionally turn on the trace clock.&amp;nbsp; By default this code will be enabled by the new project wizard, but if not required can be removed by defining the compiler symbol &lt;STRONG&gt;DONT_ENABLE_SWVTRACECLK&lt;/STRONG&gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you are using different startup code (for instance, as provided in the projects in the LPCOpen v2.08c package for the LPCXpresso1549 board), then you can add the following code to your project to turn on the trace clock (for example right at the start of main() or in the startup file before the call to main() &lt;SPAN class="lia-unicode-emoji" title=":disappointed_face:"&gt;&lt;LI-EMOJI id="lia_disappointed-face" title=":disappointed_face:"&gt;&lt;/LI-EMOJI&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;volatile unsigned int *TRACECLKDIV = (unsigned int *) 0x400740D8; &lt;/STRONG&gt;
&lt;STRONG style="font-family: courier new,courier;"&gt;*TRACECLKDIV = 1;&lt;/STRONG&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Note :&lt;/STRONG&gt; later versions of the LPCOpen package for LPC15xx should contain appropriate trace clock setup code within the startup file.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;H2 id="toc-hId-899077757"&gt;&lt;SPAN style="color: #eb7a3d;"&gt;SWO switch matrix configuration&lt;/SPAN&gt;&lt;/H2&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The SWO signal from the Cortex CPU is not assigned to a fixed pin on the LPC15xx MCU. Thus it is necessary to correctly configure the switch matrix.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For example, if you are using LPCOpen v2.08c package for the LPCXpresso1549 board (and have a revision C or later board),&amp;nbsp; then you will need to modify board_sysinit.c in the lpc_board_nxp_lpcxpresso_1549 project to add SWO to the switch matrix setup thus:&lt;/P&gt;&lt;PRE&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;STATIC const SWM_GRP_T swmSetup[] = { &lt;/SPAN&gt;
&lt;SPAN style="font-family: courier new,courier;"&gt;/* USB related */ &lt;/SPAN&gt;
&lt;SPAN style="font-family: courier new,courier;"&gt;{(uint16_t) SWM_USB_VBUS_I, 1, 11}, /* PIO1_11-ISP_1-AIN_CTRL */ &lt;/SPAN&gt;
&lt;SPAN style="font-family: courier new,courier;"&gt;/* UART */ &lt;/SPAN&gt;
&lt;SPAN style="font-family: courier new,courier;"&gt;{(uint16_t) SWM_UART0_RXD_I, 0, 13}, /* PIO0_13-ISP_RX */ &lt;/SPAN&gt;
&lt;SPAN style="font-family: courier new,courier;"&gt;{(uint16_t) SWM_UART0_TXD_O, 0, 18}, /* PIO0_18-ISP_TX */ &lt;/SPAN&gt;
&lt;SPAN style="font-family: courier new,courier;"&gt;&lt;STRONG&gt;/* SWO signal */&amp;nbsp; &lt;/STRONG&gt;&lt;/SPAN&gt;
&lt;SPAN style="font-family: courier new,courier;"&gt;&lt;STRONG&gt;{(uint16_t) SWM_SWO_O, 1, 2}, /* PIO01_2-SWO */&amp;nbsp; &lt;/STRONG&gt;&lt;/SPAN&gt;
&lt;SPAN style="font-family: courier new,courier;"&gt;&lt;STRONG&gt;};&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Note :&lt;/STRONG&gt; later versions of the LPCOpen package for LPC15xx should contain appropriate SWO switch matrix setup code for the LPCXpresso1549 board in the board library.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;HR /&gt;&lt;P&gt;&lt;/P&gt;&lt;H1 id="toc-hId--1456565699"&gt;For more information:&lt;/H1&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;A _jive_internal="true" data-containerid="11529" data-containertype="14" data-objectid="389084" data-objecttype="1" href="https://community.nxp.com/thread/389084" rel="nofollow noopener noreferrer" target="_blank"&gt;Overview of Trace support in LPCXpresso IDE&lt;/A&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 31 Mar 2016 23:16:52 GMT</pubDate>
    <dc:creator>lpcware-support</dc:creator>
    <dc:date>2016-03-31T23:16:52Z</dc:date>
    <item>
      <title>SWO Trace setup for LPC15xx</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE-FAQs/SWO-Trace-setup-for-LPC15xx/m-p/474154#M120</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;To carry out SWO Trace on&lt;STRONG&gt; LPC15xx&lt;/STRONG&gt;, it is necessary to:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Ensure that your board has SWO pinned out to the debug connector&lt;/LI&gt;&lt;LI&gt;Turn on the trace clock within the MCU, as this is not enabled by default&lt;/LI&gt;&lt;LI&gt;Configure the switch matrix, so that the SWO signal is accesible on an appropriate pin of the MCU&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This should typically be done within each of your application projects (or library projects that your projects link against).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;H2 id="toc-hId-1708424383"&gt;&lt;SPAN style="color: #eb7a3d;"&gt;SWO pin and debug connector&lt;/SPAN&gt;&lt;/H2&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The first revisions of the LPCXpresso1549 board did not provide for connecting the SWO pin on the debug connector.&amp;nbsp; You will need a revision C (or later) of this board to carry out SWO trace.&lt;/P&gt;&lt;P&gt;To identify which revision of board you have, look in the top right of the back of the board which should be marked:&lt;/P&gt;&lt;PRE&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;LPCXpresso1549 &lt;/SPAN&gt;
&lt;SPAN style="font-family: courier new,courier;"&gt;OM13056&amp;nbsp;&amp;nbsp; v2 &lt;STRONG&gt;Rev C&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;If you are using a different board, you will need to check the schematics to identify if SWO is connected to the debug connector.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;H2 id="toc-hId--843732578"&gt;&lt;SPAN style="color: #eb7a3d;"&gt;Enabling the trace clock&lt;/SPAN&gt;&lt;/H2&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The startup code generated by the new project wizards for LPC15xx in LPCXpresso IDE v7.7 (and later) contain code to optionally turn on the trace clock.&amp;nbsp; By default this code will be enabled by the new project wizard, but if not required can be removed by defining the compiler symbol &lt;STRONG&gt;DONT_ENABLE_SWVTRACECLK&lt;/STRONG&gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you are using different startup code (for instance, as provided in the projects in the LPCOpen v2.08c package for the LPCXpresso1549 board), then you can add the following code to your project to turn on the trace clock (for example right at the start of main() or in the startup file before the call to main() &lt;SPAN class="lia-unicode-emoji" title=":disappointed_face:"&gt;&lt;LI-EMOJI id="lia_disappointed-face" title=":disappointed_face:"&gt;&lt;/LI-EMOJI&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;volatile unsigned int *TRACECLKDIV = (unsigned int *) 0x400740D8; &lt;/STRONG&gt;
&lt;STRONG style="font-family: courier new,courier;"&gt;*TRACECLKDIV = 1;&lt;/STRONG&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Note :&lt;/STRONG&gt; later versions of the LPCOpen package for LPC15xx should contain appropriate trace clock setup code within the startup file.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;H2 id="toc-hId-899077757"&gt;&lt;SPAN style="color: #eb7a3d;"&gt;SWO switch matrix configuration&lt;/SPAN&gt;&lt;/H2&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The SWO signal from the Cortex CPU is not assigned to a fixed pin on the LPC15xx MCU. Thus it is necessary to correctly configure the switch matrix.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For example, if you are using LPCOpen v2.08c package for the LPCXpresso1549 board (and have a revision C or later board),&amp;nbsp; then you will need to modify board_sysinit.c in the lpc_board_nxp_lpcxpresso_1549 project to add SWO to the switch matrix setup thus:&lt;/P&gt;&lt;PRE&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;STATIC const SWM_GRP_T swmSetup[] = { &lt;/SPAN&gt;
&lt;SPAN style="font-family: courier new,courier;"&gt;/* USB related */ &lt;/SPAN&gt;
&lt;SPAN style="font-family: courier new,courier;"&gt;{(uint16_t) SWM_USB_VBUS_I, 1, 11}, /* PIO1_11-ISP_1-AIN_CTRL */ &lt;/SPAN&gt;
&lt;SPAN style="font-family: courier new,courier;"&gt;/* UART */ &lt;/SPAN&gt;
&lt;SPAN style="font-family: courier new,courier;"&gt;{(uint16_t) SWM_UART0_RXD_I, 0, 13}, /* PIO0_13-ISP_RX */ &lt;/SPAN&gt;
&lt;SPAN style="font-family: courier new,courier;"&gt;{(uint16_t) SWM_UART0_TXD_O, 0, 18}, /* PIO0_18-ISP_TX */ &lt;/SPAN&gt;
&lt;SPAN style="font-family: courier new,courier;"&gt;&lt;STRONG&gt;/* SWO signal */&amp;nbsp; &lt;/STRONG&gt;&lt;/SPAN&gt;
&lt;SPAN style="font-family: courier new,courier;"&gt;&lt;STRONG&gt;{(uint16_t) SWM_SWO_O, 1, 2}, /* PIO01_2-SWO */&amp;nbsp; &lt;/STRONG&gt;&lt;/SPAN&gt;
&lt;SPAN style="font-family: courier new,courier;"&gt;&lt;STRONG&gt;};&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Note :&lt;/STRONG&gt; later versions of the LPCOpen package for LPC15xx should contain appropriate SWO switch matrix setup code for the LPCXpresso1549 board in the board library.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;HR /&gt;&lt;P&gt;&lt;/P&gt;&lt;H1 id="toc-hId--1456565699"&gt;For more information:&lt;/H1&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;A _jive_internal="true" data-containerid="11529" data-containertype="14" data-objectid="389084" data-objecttype="1" href="https://community.nxp.com/thread/389084" rel="nofollow noopener noreferrer" target="_blank"&gt;Overview of Trace support in LPCXpresso IDE&lt;/A&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 31 Mar 2016 23:16:52 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE-FAQs/SWO-Trace-setup-for-LPC15xx/m-p/474154#M120</guid>
      <dc:creator>lpcware-support</dc:creator>
      <dc:date>2016-03-31T23:16:52Z</dc:date>
    </item>
  </channel>
</rss>

