<?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 Re: JTAG / SWD Documentation in LPC Microcontrollers</title>
    <link>https://community.nxp.com/t5/LPC-Microcontrollers/JTAG-SWD-Documentation/m-p/552227#M14352</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by lpcxpresso-support on Mon Dec 01 23:25:11 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;HR /&gt;&lt;SPAN style="color: #0000ff;"&gt;&lt;STRONG&gt;Quote: v0ynich&lt;/STRONG&gt;&lt;BR /&gt;Thank you for your reply&lt;BR /&gt;&lt;BR /&gt;By "providing a stack" you mean set an address in the Stack Pointer to the upper part of the RAM which is not being used for anything else, right?&lt;BR /&gt;&lt;BR /&gt;Regarding VTOR: No, I didn't initialized that register. I will take a look.&lt;BR /&gt;&lt;BR /&gt;I also noticed that by reading the DFSR register I'm getting 0x00000001 which means (I think) an Alignment Fault in a read instruction. Does this mean that I'm trying to read something that it is not word aligned? How am I supposed to clear this fault? By writing 0 to DFSR?&lt;BR /&gt;&lt;BR /&gt;Many thanks&lt;/SPAN&gt;&lt;HR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Provided you write the stack pointer with an address which allows for adequate driver stack space, you should be good. The importance of the VTOR setting is to vector into your own handlers should an exception occur. Ideally, you want no exceptions while the flash driver is operating.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The purpose of the DFSR is to record the reason a debug event occurred. You need to write a 1 to the DFSR bit position you want to clear. If you read a 1 from the DFSR register, it means a debug halt event occurred (likely C_HALT).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Here's a reference to a useful ARM document if you don't already have it.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;ARM®v7-M Architecture Reference Manual ARM DDI 0403D-3 (ID011210)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Regards,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;LPCXpresso Support.&lt;/SPAN&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 15 Jun 2016 18:36:48 GMT</pubDate>
    <dc:creator>lpcware</dc:creator>
    <dc:date>2016-06-15T18:36:48Z</dc:date>
    <item>
      <title>JTAG / SWD Documentation</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/JTAG-SWD-Documentation/m-p/552204#M14329</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by v0ynich on Thu Nov 13 11:50:17 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Hello,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm looking for documentation regarding JTAG or SWD for programming an LPC4337. I wish to program this device using another microcontroller. In my case, USART0 and USART3 are not available for IAP. If you could send me in the right direction I would appreciate. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thank you&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 18:36:34 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/JTAG-SWD-Documentation/m-p/552204#M14329</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T18:36:34Z</dc:date>
    </item>
    <item>
      <title>Re: JTAG / SWD Documentation</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/JTAG-SWD-Documentation/m-p/552205#M14330</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by mysepp on Thu Nov 13 13:25:23 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;I don't know if there is something ready to use, it is no easy task.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Have a look here for more detailed information (go down the tree on left side):&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Google for "ddi0314h" (complete link is not accepted by spam filter, sorry)&lt;/SPAN&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 18:36:35 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/JTAG-SWD-Documentation/m-p/552205#M14330</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T18:36:35Z</dc:date>
    </item>
    <item>
      <title>Re: JTAG / SWD Documentation</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/JTAG-SWD-Documentation/m-p/552206#M14331</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by v0ynich on Thu Nov 13 15:00:31 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Thank you!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;That's a start point. However I'm still struggling to find the commands for flash segment erasing, programming, reading, etc..&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;As far as I understand, this "Coresight" is the module responsible for handling the JTAG and SWD functions, right?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 18:36:36 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/JTAG-SWD-Documentation/m-p/552206#M14331</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T18:36:36Z</dc:date>
    </item>
    <item>
      <title>Re: JTAG / SWD Documentation</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/JTAG-SWD-Documentation/m-p/552207#M14332</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by lpcxpresso-support on Thu Nov 13 15:48:23 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;The only way to program internal flash&amp;nbsp; is through the IAP. There is nothing available through the Debug interface. So, to do this, you are going to need to download an application that then runs to program the flash. This is exactly how a debugger programs flash.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If you really want to go ahead with this, and it is not recommended and is a lot of work, you could start by looking at ARMs CMSIS-DAP. I understand that you can also get an implementation from ARM via mbed and the HDK. &lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 18:36:36 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/JTAG-SWD-Documentation/m-p/552207#M14332</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T18:36:36Z</dc:date>
    </item>
    <item>
      <title>Re: JTAG / SWD Documentation</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/JTAG-SWD-Documentation/m-p/552208#M14333</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by v0ynich on Fri Nov 14 03:15:32 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;HR /&gt;&lt;SPAN style="color: #0000ff;"&gt;&lt;STRONG&gt;Quote: lpcxpresso-support&lt;/STRONG&gt;&lt;BR /&gt;So, to do this, you are going to need to download an application that then runs to program the flash. This is exactly how a debugger programs flash.&lt;/SPAN&gt;&lt;HR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Ok, perhaps I'm confused with the nomenclature. How does the debugger downloads the application ? In other words, what I'm trying to achieve is to mimic the flashing function of the debugger. I have the pins that I use to program the LPC4337 with the debugger also connected to another micro controller. This micro controller should be able to re-program the LPC4337 with new firmware.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thank you&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 18:36:37 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/JTAG-SWD-Documentation/m-p/552208#M14333</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T18:36:37Z</dc:date>
    </item>
    <item>
      <title>Re: JTAG / SWD Documentation</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/JTAG-SWD-Documentation/m-p/552209#M14334</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by lpcxpresso-support on Fri Nov 14 03:48:29 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;It downloads via SWD or JTAG.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Assuming that you really do want to try to download a program into flash via SWD or JTAG, then you are basically going to have to implement most of the functionality of a debugger (gain control of the CPU, download data into RAM, setup the registers, start executing the program). Then you are going to need to communicate with that program to send it data and tell it to program the flash with the data that you send it.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Or, you might want to rethink what you are trying to do here...&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 18:36:38 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/JTAG-SWD-Documentation/m-p/552209#M14334</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T18:36:38Z</dc:date>
    </item>
    <item>
      <title>Re: JTAG / SWD Documentation</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/JTAG-SWD-Documentation/m-p/552210#M14335</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by R2D2 on Fri Nov 14 03:48:38 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;HR /&gt;&lt;SPAN style="color: #0000ff;"&gt;&lt;STRONG&gt;Quote: v0ynich&lt;/STRONG&gt;&lt;BR /&gt;How does the debugger downloads the application ?&lt;/SPAN&gt;&lt;HR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&lt;A class="jive-link-external-small" href="https://community.nxp.com/external-link.jspa?url=http%3A%2F%2Fwww.lpcware.com%2Fcontent%2Fblog%2Fintroduction-cortex-serial-wire-debugging-part-one" rel="nofollow" target="_blank"&gt;http://www.lpcware.com/content/blog/introduction-cortex-serial-wire-debugging-part-one&lt;/A&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 18:36:38 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/JTAG-SWD-Documentation/m-p/552210#M14335</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T18:36:38Z</dc:date>
    </item>
    <item>
      <title>Re: JTAG / SWD Documentation</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/JTAG-SWD-Documentation/m-p/552211#M14336</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by v0ynich on Wed Nov 19 03:49:59 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Hello,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I understand that it is not an easy task. Could you please forward me to some documentation ragarding this?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thank you&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 18:36:39 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/JTAG-SWD-Documentation/m-p/552211#M14336</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T18:36:39Z</dc:date>
    </item>
    <item>
      <title>Re: JTAG / SWD Documentation</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/JTAG-SWD-Documentation/m-p/552212#M14337</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by lpcxpresso-support on Wed Nov 19 04:54:08 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;The place to start is to read the ARM 'Coresight' documentation for the Cortex-M4. This is provided by ARM on their website. And, as mentioned previously, (subject to license) you may be able to use the mbed HDK.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 18:36:39 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/JTAG-SWD-Documentation/m-p/552212#M14337</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T18:36:39Z</dc:date>
    </item>
    <item>
      <title>Re: JTAG / SWD Documentation</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/JTAG-SWD-Documentation/m-p/552213#M14338</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by v0ynich on Mon Nov 24 05:05:43 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Thank you for the info. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;At this moment I'm not being able to find which register I should access (using TAR and DRW) to erase the flash in the LPC4337.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thank you&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 18:36:40 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/JTAG-SWD-Documentation/m-p/552213#M14338</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T18:36:40Z</dc:date>
    </item>
    <item>
      <title>Re: JTAG / SWD Documentation</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/JTAG-SWD-Documentation/m-p/552214#M14339</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by bavarian on Mon Nov 24 05:55:04 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;I think this requires some clarification:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;[list]&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; [*]&amp;nbsp; The internal flash is not connected in any way to the JTAG or SWD debug logic&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; [*]&amp;nbsp; The debug logic itself also has no hardwired functionality to do operations on the flash&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;[/list]&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;As already pointed out:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;[list]&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; [*]&amp;nbsp; The only way to program the flash is to use the code which resides in the ROM of the LPC4300. &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; [*]&amp;nbsp; The bootloader also uses this flash programming API to program the data it gets from one of the boot interfaces, for example from UART or USB.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; [*]&amp;nbsp; If you connect with JTAG, then you can use this interface to download an executable code to the ARM, which is then running this code, in order to stream some data over the JTAG channel and provide it to the flash programming API.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; [*]&amp;nbsp; So whatever you do, you always let the Cortex-M4 do the job, whatever type of interface you use for getting the data in.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;[/list]&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The hints to look into the specs from ARM are totally right, it's the only way to start. Then you could also look into this thread:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://http://www.lpcware.com/content/forum/lpc1857-jtag-host-not-slave"&gt;http://www.lpcware.com/content/forum/lpc1857-jtag-host-not-slave&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Regards,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;NXP Support Team.&amp;nbsp; &lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 18:36:40 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/JTAG-SWD-Documentation/m-p/552214#M14339</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T18:36:40Z</dc:date>
    </item>
    <item>
      <title>Re: JTAG / SWD Documentation</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/JTAG-SWD-Documentation/m-p/552215#M14340</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by v0ynich on Mon Nov 24 06:27:53 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Thank you for the clarification. This kind of detailed information is really appreciated.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;HR /&gt;&lt;SPAN style="color: #0000ff;"&gt;&lt;STRONG&gt;Quote: &lt;/STRONG&gt;&lt;BR /&gt;The debug logic itself also has no hardwired functionality to do operations on the flash&lt;/SPAN&gt;&lt;HR /&gt;&lt;BR /&gt;&lt;SPAN&gt;But it can read/write to RAM, right?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Then let's assume that I want to use this approach:&lt;/SPAN&gt;&lt;BR /&gt;&lt;HR /&gt;&lt;SPAN style="color: #0000ff;"&gt;&lt;STRONG&gt;Quote: &lt;/STRONG&gt;&lt;BR /&gt;If you connect with JTAG, then you can use this interface to download an executable code to the ARM, which is then running this code, in order to stream some data over the JTAG channel and provide it to the flash programming API.&lt;/SPAN&gt;&lt;HR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Please check if this is what I need to do:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;1- "Allocate" RAM space for the iap_cmd and iap_res arrays&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;2- Write on R0 and R1 the addresses of iap_cmd and iap_res arrays&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;3- Call IAP with ERASE_SECTOR command&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;4- Check erasing progress (wait for return)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;5- "Allocate" and write to RAM segments of the code that I want to flash&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;6- Call IAP with COPY_RAM_TO_FLASH command&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;7- Check flashing progress (wait for return)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thank you&lt;/SPAN&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 18:36:41 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/JTAG-SWD-Documentation/m-p/552215#M14340</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T18:36:41Z</dc:date>
    </item>
    <item>
      <title>Re: JTAG / SWD Documentation</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/JTAG-SWD-Documentation/m-p/552216#M14341</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by lpcxpresso-support on Mon Nov 24 07:25:49 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Yes, you can read and write to RAM.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This sequence *may* work but it depends on how you are going to trap the return from the IAP routine(s). You are going to need a stack setup (and therefore the SP) and push a return address so that the IAP can return to something. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;You may find it easier to download a small piece of ram-based code that actually makes the IAP calls for you. It can spin in a while(1) loop on completion enabling you to either set (and handle) a breakpoint on the return, or you could repeatedly read the PC to see if it returned to your while loop. This also has the advantage that you can debug the code (using a conventional debugger) before attempting to debug your JTAG/SWD code.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 18:36:42 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/JTAG-SWD-Documentation/m-p/552216#M14341</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T18:36:42Z</dc:date>
    </item>
    <item>
      <title>Re: JTAG / SWD Documentation</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/JTAG-SWD-Documentation/m-p/552217#M14342</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by v0ynich on Thu Nov 27 16:48:12 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Hello!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thank you for your support!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;New update:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;At this moment and after initialized the SW-DP I'm able to read and write the RAM without any issue. All replies are the expected ones.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;However I'm facing some problem when I try to read or write the DHCSR register to halt the core. The target answers "FAULT". By checking the CTRL/STAT register the Overrun flag is set after the read or write of DHCSR. I couldn't find any explanation in the literature for this behaviour. &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm reading the DHCSR register as if it was normal RAM at address 0xE000EDF0. Do I need to take any special measure before this?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The command sequence:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;-&amp;gt; Set reset state&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;-&amp;gt; JTAG to SWD sequence&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;-&amp;gt; Set reset state&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;-&amp;gt; Read IDCODE&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;-&amp;gt; Write CTRL/STAT with CTRLSTAT_CDBGPWRUPREQ and CTRLSTAT_CSYSPWRUPREQ&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;-&amp;gt; Read CTRL/STAT&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;-&amp;gt; Write SELECT with bank pointing to IDR&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;-&amp;gt; Read IDR&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;-&amp;gt; Write SELECT with bank that points to CSW, TAR and DRW&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;-&amp;gt; Write CSW with 0x02 (32bits)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;-&amp;gt; Write to RAM&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;-&amp;gt; Read to RAM&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;-&amp;gt; Read DHCSR ---&amp;gt; FAULT&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Any tips?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thank you&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 18:36:42 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/JTAG-SWD-Documentation/m-p/552217#M14342</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T18:36:42Z</dc:date>
    </item>
    <item>
      <title>Re: JTAG / SWD Documentation</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/JTAG-SWD-Documentation/m-p/552218#M14343</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by MikeSimmonds on Thu Nov 27 21:37:47 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Did you read the blog linked in post 5? It and the next three are very informative.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD bgcolor="#cacaca"&gt; &lt;PRE&gt;Initializing SWD.

The SWD protocol allows full control of an LPC microcontroller. Because of this, it is critical that the port be insensitive to noise under a wide range of design conditions. To make the SWD port insensitive to noise, an unlock or connection sequence must be executed before the port can be used. The unlock sequence consists of several different steps.

SWD Unlock Sequence Steps

step numberdescription
1The Host needs to switch the target from JTAG to SWD mode by clocking 0xE79E onto SWDCLK/SWDIO
2SWD connection sequence- clock out more than 50 binary 1s
3Must read the Debug Port IDCODE register (address 0)
4Turn on Debug Port by settings bits 28 and 30 at DP address 4
5Write AP select (debug port address 8) to 0xF0 (to prep for AP read of 0xFC)
6Unlock Access Port by reading AP ID register (AP address 0xFC)&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;From your description (code not shown), you may have missed steps 5 and 6.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;There are actually 4 parts to this blog, the 4th, &lt;/SPAN&gt;&lt;A href="http://http://www.lpcware.com/content/blog/introduction-cortex-serial-wire-debugging-part-four" rel="nofollow noopener noreferrer" target="_blank"&gt;here&lt;/A&gt;&lt;SPAN&gt;, has code for an LPC1100 'adapter'&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;that you could take code sequences from.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;HTH, Mike&lt;/SPAN&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 18:36:43 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/JTAG-SWD-Documentation/m-p/552218#M14343</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T18:36:43Z</dc:date>
    </item>
    <item>
      <title>Re: JTAG / SWD Documentation</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/JTAG-SWD-Documentation/m-p/552219#M14344</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by v0ynich on Fri Nov 28 05:47:00 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Hello,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Yes, I'm aware of those blog entries. I'm actually doing the&amp;nbsp; steps 5 and 6 which are (in my description):&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;-&amp;gt; Write SELECT with bank pointing to IDR&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;-&amp;gt; Read IDR&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Any attempt of write/read to the ARM private bus (0xE000 0000 to 0xE010 0000) where the DHCSR and other registers are results in FAULT.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Any write or read to the SRAM memory segment works perfectly.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;=(&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;EDIT: Maybe something to do with the Memory Protection Unit (MPU) ?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;EDIT2: Maybe this helps to ring a bell&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;here goes the description of read attempts in several memory segments&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;32kb local SRAM...................(0x1000 0000 - 0x1000 7FFF) -&amp;gt; OK&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Reserved...............................(0x1000 8000 - 0x1007 FFFF) -&amp;gt; FAULT&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;32+8kb SRAM.......................(0x1008 0000 - 0x1008 9FFF) -&amp;gt; OK&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;64kb ROM.............................(0x1040 0000 - 0x1040 FFFF) -&amp;gt; OK&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Flash Bank A.........................(0x1A00 0000 - 0x1A03 FFFF) -&amp;gt; OK&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Flash Bank B.........................(0x1B00 0000 - 0x1A07 FFFF) -&amp;gt; OK&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;4x16kb AHB SRAM...............(0x2000 0000 - 0x2000 FFFF) -&amp;gt; OK&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;16kb EEPROM......................(0x2004 0000 - 0x2004 3FFF) -&amp;gt; OK&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;AHB Peripherals....................(0x4000 0000 - 0x4001 1FFF) -&amp;gt; OK&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Clocking/Reset Peripherals...(0x4005 0000 - 0x4005 FFFF) -&amp;gt; OK&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;APB Peripherals #0...............(0x4008 0000 - 0x4008 FFFF) -&amp;gt; OK&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;High-speed GPIO..................(0x400F 4000 - 0x400F 7FFF) -&amp;gt; OK&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;ARM Private Bus...................(0xE000 0000 - 0xE000 0FFF) -&amp;gt; OK&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;ARM Private Bus...................(0xE000 1000 - 0xE009 FFFF) -&amp;gt; FAULT&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This last one, is what I want to read/write in order to halt and run the processor and change the program counter.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thank you&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 18:36:43 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/JTAG-SWD-Documentation/m-p/552219#M14344</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T18:36:43Z</dc:date>
    </item>
    <item>
      <title>Re: JTAG / SWD Documentation</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/JTAG-SWD-Documentation/m-p/552220#M14345</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by lpcxpresso-support on Fri Nov 28 18:26:56 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I understand you've got low-level access to SW-DP, but you didn't make it clear what that is. Are you using CMSIS-DAP, or something else? To save time and trouble, our recommendation is to use an existing probe firmware (like CMSIS-DAP). I'd also recommend you not use overrun detection (if indeed it's enabled). We don't believe it's used by CMSIS-DAP. You can determine the success/fail status of the transaction when you read out the 3 bits of ACK. More information on this is found in the ARM documentation.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;To halt the part requires you write a DBGKEY value in addition to the C_HALT and C_DEBUGEN bits. If you combine these, the halt "word" you write to DHCSR (0xE000EDF0) is 0xA05F0003. Has this been done?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Regards,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;LPCXpresso Support&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 18:36:44 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/JTAG-SWD-Documentation/m-p/552220#M14345</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T18:36:44Z</dc:date>
    </item>
    <item>
      <title>Re: JTAG / SWD Documentation</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/JTAG-SWD-Documentation/m-p/552221#M14346</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by MikeSimmonds on Mon Dec 01 08:04:23 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;V0ynich, did you resolve your issue with the debug registers?&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;If you did, can you share the 'trick' or 'step' required for access?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Regards, Mike&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 18:36:45 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/JTAG-SWD-Documentation/m-p/552221#M14346</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T18:36:45Z</dc:date>
    </item>
    <item>
      <title>Re: JTAG / SWD Documentation</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/JTAG-SWD-Documentation/m-p/552222#M14347</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by v0ynich on Mon Dec 01 08:41:16 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Hello,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Yes, I solved it. I needed to set the DBSTATUS, MASTERTYPE and HPROT bits also in the CSW register to be able to access the addresses that were giving me the error. No idea which one made the trick.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;lpcxpresso-support: The FAULT and OK "responses" in my last post were the 3-bit ACK. Yes, I'm using a customized CMSIS-DAP&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;At this moment I'm able to run, halt and reset the CPU. A flashloader was loaded to RAM and the program counter set to 0x100002F9 (which is the ResetISR -&amp;gt; entry point according to the .map file) However, I'm facing two problems:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;- I'm only able to change the state of the program counter when the CPU is running. If I do it with the CPU halted it has no effect. The previous value remains.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;- The program counter stays still (@ 0x100002F9 ResetISR). I have ensured that the CPU is not halted and it is not in sleep mode. The interrupt requests are disabled. If a read the CYCCNT register I can notice that it is being incremented.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Ideas?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thank you&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 18:36:45 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/JTAG-SWD-Documentation/m-p/552222#M14347</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T18:36:45Z</dc:date>
    </item>
    <item>
      <title>Re: JTAG / SWD Documentation</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/JTAG-SWD-Documentation/m-p/552223#M14348</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by lpcxpresso-support on Mon Dec 01 11:44:54 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;ResetISR implementations usually require a stack. Have you provided one? Also, is the VTOR register initialized to your RAM vector table address?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;LPCXpresso Support&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 18:36:46 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/JTAG-SWD-Documentation/m-p/552223#M14348</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T18:36:46Z</dc:date>
    </item>
  </channel>
</rss>

