<?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 SWO Trace setup for LPC13xx in LPCXpresso IDE FAQs</title>
    <link>https://community.nxp.com/t5/LPCXpresso-IDE-FAQs/SWO-Trace-setup-for-LPC13xx/m-p/474173#M121</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;LPC13xx&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 MCU pinmuxing, so that the SWO signal is accesible on the 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&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;On LPC13xx parts, the SWO signal is accessible via pin P0_9&amp;nbsp; of the MCU. Thus you will need to check the schematic for you board to ensure that SWO is connected to the debug connector.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;H2&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 current startup code generated by the new project wizards for LPC13xx parts in LPCXpresso IDE v7.7 (and earlier) does not yet contain code to optionally turn on the trace clock. This is intended for a future LPCXpresso IDE release. In the meantime, you can use the code below for doing this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;H2&gt;&lt;SPAN style="color: #eb7a3d;"&gt;SWO pinmux configuration&lt;/SPAN&gt;&lt;/H2&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;On LPC13xx parts, the SWO signal is accessible via pin P0_9&amp;nbsp; of the MCU&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thus the pinmux settings for your project need to ensure that this pin is configured to use the SWO function. In particular this means that this pin is no longer available for use as the MOSI0 for the SSP0 peripheral. Example code to do this is given below.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Note that the default LPCOpen codebase for LPC1343 and LPC1347 setup P0_9 as MOSI0 in &lt;STRONG&gt;board_sysinit.c&lt;/STRONG&gt; of their board ibrary project.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;H2&gt;&lt;SPAN style="color: #eb7a3d;"&gt;Example setup code for LPC1315/16/46/47 parts&lt;/SPAN&gt;&lt;/H2&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Adding the following code to your main() function, after the call to Board_Init() if using LPCOpen, should allow SWO trace to function:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;volatile unsigned int *TRACECLKDIV = (unsigned int *) 0x400480AC;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;volatile unsigned int *IOCON_PIO_0_9 = (unsigned int *) 0x40044024;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;// Write 1 to TRACECLKDIV&amp;nbsp; – Trace divider&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;*TRACECLKDIV = 1;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;// Write 0x93 to I/O configuration for pin PIO0_9 to select ARM_TRACE_SWV&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;*IOCON_PIO_0_9 = 0x93;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;H2&gt;&lt;SPAN style="color: #eb7a3d;"&gt;Example setup code for LPC1311/13/42/43 parts&lt;/SPAN&gt;&lt;/H2&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Adding the following code to your main() function, after the call to Board_Init() if using LPCOpen, should allow SWO trace to function:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;volatile unsigned int *TRACECLKDIV = (unsigned int *) 0x400480AC;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;volatile unsigned int *IOCON_PIO_0_9 = (unsigned int *) 0x40044064;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;// Write 1 to TRACECLKDIV&amp;nbsp; – Trace divider&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;*TRACECLKDIV = 1;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;// Write 0x93 to I/O configuration for pin PIO0_9 to select ARM_TRACE_SWV&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;*IOCON_PIO_0_9 = 0x93;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;H1&gt;For more information:&lt;/H1&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;P&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"&gt;Overview of Trace support in LPCXpresso IDE&lt;/A&gt;&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P style="min-height: 8pt; padding: 0px; min- padding: 0px;"&gt;&lt;SPAN style="font-family: monospace, serif;"&gt; &lt;/SPAN&gt; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 31 Mar 2016 23:21:15 GMT</pubDate>
    <dc:creator>lpcware-support</dc:creator>
    <dc:date>2016-03-31T23:21:15Z</dc:date>
    <item>
      <title>SWO Trace setup for LPC13xx</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE-FAQs/SWO-Trace-setup-for-LPC13xx/m-p/474173#M121</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;LPC13xx&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 MCU pinmuxing, so that the SWO signal is accesible on the 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&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;On LPC13xx parts, the SWO signal is accessible via pin P0_9&amp;nbsp; of the MCU. Thus you will need to check the schematic for you board to ensure that SWO is connected to the debug connector.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;H2&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 current startup code generated by the new project wizards for LPC13xx parts in LPCXpresso IDE v7.7 (and earlier) does not yet contain code to optionally turn on the trace clock. This is intended for a future LPCXpresso IDE release. In the meantime, you can use the code below for doing this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;H2&gt;&lt;SPAN style="color: #eb7a3d;"&gt;SWO pinmux configuration&lt;/SPAN&gt;&lt;/H2&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;On LPC13xx parts, the SWO signal is accessible via pin P0_9&amp;nbsp; of the MCU&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thus the pinmux settings for your project need to ensure that this pin is configured to use the SWO function. In particular this means that this pin is no longer available for use as the MOSI0 for the SSP0 peripheral. Example code to do this is given below.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Note that the default LPCOpen codebase for LPC1343 and LPC1347 setup P0_9 as MOSI0 in &lt;STRONG&gt;board_sysinit.c&lt;/STRONG&gt; of their board ibrary project.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;H2&gt;&lt;SPAN style="color: #eb7a3d;"&gt;Example setup code for LPC1315/16/46/47 parts&lt;/SPAN&gt;&lt;/H2&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Adding the following code to your main() function, after the call to Board_Init() if using LPCOpen, should allow SWO trace to function:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;volatile unsigned int *TRACECLKDIV = (unsigned int *) 0x400480AC;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;volatile unsigned int *IOCON_PIO_0_9 = (unsigned int *) 0x40044024;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;// Write 1 to TRACECLKDIV&amp;nbsp; – Trace divider&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;*TRACECLKDIV = 1;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;// Write 0x93 to I/O configuration for pin PIO0_9 to select ARM_TRACE_SWV&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;*IOCON_PIO_0_9 = 0x93;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;H2&gt;&lt;SPAN style="color: #eb7a3d;"&gt;Example setup code for LPC1311/13/42/43 parts&lt;/SPAN&gt;&lt;/H2&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Adding the following code to your main() function, after the call to Board_Init() if using LPCOpen, should allow SWO trace to function:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;volatile unsigned int *TRACECLKDIV = (unsigned int *) 0x400480AC;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;volatile unsigned int *IOCON_PIO_0_9 = (unsigned int *) 0x40044064;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;// Write 1 to TRACECLKDIV&amp;nbsp; – Trace divider&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;*TRACECLKDIV = 1;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;// Write 0x93 to I/O configuration for pin PIO0_9 to select ARM_TRACE_SWV&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;*IOCON_PIO_0_9 = 0x93;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;H1&gt;For more information:&lt;/H1&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;P&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"&gt;Overview of Trace support in LPCXpresso IDE&lt;/A&gt;&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P style="min-height: 8pt; padding: 0px; min- padding: 0px;"&gt;&lt;SPAN style="font-family: monospace, serif;"&gt; &lt;/SPAN&gt; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 31 Mar 2016 23:21:15 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE-FAQs/SWO-Trace-setup-for-LPC13xx/m-p/474173#M121</guid>
      <dc:creator>lpcware-support</dc:creator>
      <dc:date>2016-03-31T23:21:15Z</dc:date>
    </item>
  </channel>
</rss>

