Engineers Garage

  • Electronic Projects & Tutorials
    • Electronic Projects
      • Arduino Projects
      • AVR
      • Raspberry pi
      • ESP8266
      • BeagleBone
      • 8051 Microcontroller
      • ARM
      • PIC Microcontroller
      • STM32
    • Tutorials
      • Audio Electronics
      • Battery Management
      • Brainwave
      • Electric Vehicles
      • EMI/EMC/RFI
      • Hardware Filters
      • IoT tutorials
      • Power Tutorials
      • Python
      • Sensors
      • USB
      • VHDL
    • Circuit Design
    • Project Videos
    • Components
  • Articles
    • Tech Articles
    • Insight
    • Invention Stories
    • How to
    • What Is
  • News
    • Electronic Product News
    • Business News
    • Company/Start-up News
    • DIY Reviews
    • Guest Post
  • Forums
    • EDABoard.com
    • Electro-Tech-Online
    • EG Forum Archive
  • DigiKey Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • Learn
    • eBooks/Tech Tips
    • Design Guides
    • Learning Center
    • Tech Toolboxes
    • Webinars & Digital Events
  • Resources
    • Digital Issues
    • EE Training Days
    • LEAP Awards
    • Podcasts
    • Webinars / Digital Events
    • White Papers
    • Engineering Diversity & Inclusion
    • DesignFast
  • Guest Post Guidelines
  • Advertise
  • Subscribe

JTAG Debugging With LPC1768- (Part 3/21)

By Prabakaran P.M December 19, 2021

The process of resolving bugs or defects that interferes with the proper working of a computer software or an operating system is known as Debugging. This write-up deals with the setup and use of a JTAG Debugger with ARM Cortex M3 Microcontroller. For setting up the Environment for the development of ARM cortex M3 refer this article.

The LPC 1768 is ARM Cortex- M3 based Microcontrollers for embedded application features in low power consumption and a high level of integration. The ARM Cortex M3 is designed in a such way to enhance debug features and a higher level of system integration. It clocks at a CPU frequency of 100 MHz, and incorporates a 3-stage pipeline and uses a Harvard architecture with separate local instruction and data buses for third bus peripherals. The ARM Cortex- M3 CPU have an internal pre-fetch unit to support speculative branching. The peripheral components include 512KB of flash memory, 64kb of data memory, Ethernet MAC, USB OTG, 4 UART’s, 8-channel general purpose DMA controller, 2 SSP Controllers, 10-bit DAC, Quadrature encoder interface, SPI interface, 3 I2C bus interface, 2 input plus 2 outputs I2S bus interface, 4 general purpose timers, ultra-low power Real-Time Clock (RTC) with separate battery supply, and up to 70 general purpose I/O pins, 6-output general purpose PWM. The LPC1768/66/65/64 are pin-compatible with the 100-pin LPC236x ARM7-based Microcontroller series.


The following components are used in this tutorial:

  1. Debugger – Your choice

  2. Controller/Board – LPC1768/Explore Cortex M3

  3. IDE/Compiler – Keil

As it is well known, JTAG can be used for programming and debugging the controller. The main use of JTAG is a case where you need to work on a huge list of code. It can be used to add step and break points throughout the code. The image below shows the pin diagram of Explore ARM Cortex M3 (LPC1768). It has a ARM 20 pin JTAG connector.

Connecting the Hardware:

Pin diagram of Explore ARM Cortex M3 LPC1768

Fig. 1: Pin Diagram Of Explore ARM Cortex M3 LPC1768

It has to be noted that connecting the debugger to the board will not power it up. An external power adapter needs to be connected to the board. Once the hardware has been setup, we can move on the software part.

Selecting the Debugger

  • Click on the Projects tab and then on “Options for Target” (ATL + F7)

  • Click on the “Debug” tab

  • The default selection is “Simulator”. Change the selection to “Your Debugger name”.

  • Click on “OK” to proceed

Selecting the Debugger

Fig. 2: Selecting The Debugger

Debug Options for NXP LPC1768:

Now, select the Debug tab. On the right pane of the current window, you will find a radio button called “Use”. From the drop down list, select the name of the debugger that you are using.

Debug Options for NXP LPC1768

Fig. 3: Debug Options For NXP LPC1768

Utilities Option for the NXP LPC1768:

Click on the “Utilities” tab and you will see a window as shown below.

Utilities Option for the NXP LPC1768

Fig. 4: Utilities Option For The NXP LPC1768

Select the same debugger which you choose in the previous window. The “Settings” button in this window will show the same options as that from the Debug window. It is highly recommended that the Debug and Utilities options are configured before proceeding to the “Settings”.

Debug/Utilities Settings using the NXP LPC1768:

Click on the “Settings” key and confirm the Debug tab to obtain the window as shown below.

Debug/Utilities Settings using the NXP LPC1768

Fig. 5: Debug/Utilities Settings Using The NXP LPC1768

Notes:

  • The settings under the “Debug” and “Utilities” tabs need to be configured before confirming the settings.

  • The link and target should be present to see these options.

  • The option “Stop after Bootloader” should be chosen.

Flash Download Options for the NXP LPC1768:

Under the “Flash Download” tab, confirm the options as shown below. If desired, select the checkbox “Reset and Run”.

Flash Download Options for the NXP LPC1768

Fig. 6: Flash Download Options For The NXP LPC1768

If the space under “Programming Algorithm” is blank, select “ADD” and then select a name from the list displayed below.

Debug programs:

Invoke the debugger

  1. Click on the Magnifying glass in the toolbar.

Debug on/off icon

  1. If the “EVALUATION” mode of MDK is being used, the message shown below will appear. Click on “OK”.

Evaluation Mode Dialouge Box

Fig. 7: Evaluation Mode Dialouge Box

Message with Evaluation MDK

3.The Debugger will then perform the following steps:

.Erase the Flash

.Download the code

.Reset the microcontroller and run to either the address Reset_Handler or “main” depending upon options which were set in the configuration. A possible window log will be as shown below:

Command log on invoking the debugger

Fig. 8: Command Log On Invoking The Debugger

Command log on invoking the debugger

4.Next, the debugging screen will appear.

Debugger run options

Fig. 10: Debugger Run Options

Debugger run options

There are 7 run options:

  1. Reset microcontroller

  2. Run the microcontroller normally

  3. Stop debugging

  4. Single step one instruction at a time

  5. Skip over functions

  6. Skip out of functions

  7. Run to cursor

A typical debugging session may consist of the following steps:

  1. Enter Debug mode – the debugger will run to the address Reset_Handler (or “main” if selected in configuration)

  2. Click on the cursor at a line of source code to start the investigation

  3. Click on the 7th option to run the program to the cursor. All the register changes will be highlighted.

  4. Click on the Centre icon in order to single step the code as required.

  5. If single stepping enters into a loop, use the 6th key to step out of that function.

  6. If further investigation is not required, use the second key to run at full speed.

  7. To halt, use the 3rd key.

  8. To restart the entire sequence, use the first key

  9. To exit the debug session, select the magnifying glass which is present on the main toolbar.

Breakpoints

Fig. 11: Breakpoint Icons

There are 4 breakpoint icons:

  1. Place a breakpoint at the current cursor position. This will be shown as a red dot.

  2. A running program will stop at the breakpoint

  3. If the breakpoint is in a loop restarting the program, it will halt at the breakpoint on the next pass.

  4. Toggle: Disable/Re-enable a breakpoint at the cursor. Disabled breakpoints will be represented as an open circle.

  5. Disable all breakpoints: they will be represented as open circles. These may be individually re-enabled.

  6. Kill all breakpoints: all the breakpoint positions will be removed.

Watch Window

A number of windows can be enabled or disabled using the icons on the toolbar.

Fig. 12: Options For Debugger On Windows

Windows display options for the debugger

The windows that can be enabled or disabled are:

  1. Comman window. (Shown by default)

  2. Disassembly window. (Shown by default)

  3. Symbol window (Hidden by default)

  4. Register window (Shown by default)

  5. Call Stack Window (Shown by default)

  6. Watch windows(Hidden by default)

  7. Memory Windows (Shown by default)

Notes:

  • When Call stack, Memory and Watch are enabled, they will appear on the bottom right hand pane.

  • When selected, the symbol window will appear as shown below:

Symbols Window

Fig. 13: Symbols Window

You may also like:


  • Getting started with the ARM Cortex M3 (LPC1768)- (Part 1/21)

  • What are the top tools for developing embedded software?

  • What is a Robot Operating System (ROS)?

  • What is Lightweight Internet Protocol (LwIP)?

  • What is an SoC?

  • What is MicroPython?

Circuit Diagrams

JTAG-Debugging-With-LPC1768


Filed Under: ARM, Tutorials

 

Next Article

← Previous Article
Next Article →

Questions related to this article?
👉Ask and discuss on EDAboard.com and Electro-Tech-Online.com forums.



Tell Us What You Think!! Cancel reply

You must be logged in to post a comment.

EE TECH TOOLBOX

“ee
Tech Toolbox: Internet of Things
Explore practical strategies for minimizing attack surfaces, managing memory efficiently, and securing firmware. Download now to ensure your IoT implementations remain secure, efficient, and future-ready.

EE Learning Center

EE Learning Center
“engineers
EXPAND YOUR KNOWLEDGE AND STAY CONNECTED
Get the latest info on technologies, tools and strategies for EE professionals.

HAVE A QUESTION?

Have a technical question about an article or other engineering questions? Check out our engineering forums EDABoard.com and Electro-Tech-Online.com where you can get those questions asked and answered by your peers!


RSS EDABOARD.com Discussions

  • Reducing "shoot-through" in offline Full Bridge SMPS?
  • High Side current sensing
  • How to simulate power electronics converter in PSpice?
  • Voltage mode pushpull is a nonsense SMPS?
  • Layout IRN reduction in Comparator

RSS Electro-Tech-Online.com Discussions

  • Back to the old BASIC days
  • Parts required for a personal project
  • PIC KIT 3 not able to program dsPIC
  • Failure of polypropylene motor-run capacitors
  • Siemens large industrial PLC parts

Featured – RPi Python Programming (27 Part)

  • RPi Python Programming 21: The SIM900A AT commands
  • RPi Python Programming 22: Calls & SMS using a SIM900A GSM-GPRS modem
  • RPi Python Programming 23: Interfacing a NEO-6MV2 GPS module with Raspberry Pi
  • RPi Python Programming 24: I2C explained
  • RPi Python Programming 25 – Synchronous serial communication in Raspberry Pi using I2C protocol
  • RPi Python Programming 26 – Interfacing ADXL345 accelerometer sensor with Raspberry Pi

Recent Articles

  • What is AWS IoT Core and when should you use it?
  • AC-DC power supply extends voltage range to 800 V DC
  • Infineon’s inductive sensor integrates coil system driver, signal conditioning circuits and DSP
  • Arm Cortex-M23 MCU delivers 87.5 µA/MHz active mode
  • STMicroelectronics releases automotive amplifiers with in-play open-load detection

EE ENGINEERING TRAINING DAYS

engineering

Submit a Guest Post

submit a guest post
Engineers Garage
  • Analog IC TIps
  • Connector Tips
  • Battery Power Tips
  • DesignFast
  • EDABoard Forums
  • EE World Online
  • Electro-Tech-Online Forums
  • EV Engineering
  • Microcontroller Tips
  • Power Electronic Tips
  • Sensor Tips
  • Test and Measurement Tips
  • 5G Technology World
  • Subscribe to our newsletter
  • About Us
  • Contact Us
  • Advertise

Copyright © 2025 WTWH Media LLC. All Rights Reserved. The material on this site may not be reproduced, distributed, transmitted, cached or otherwise used, except with the prior written permission of WTWH Media
Privacy Policy

Search Engineers Garage

  • Electronic Projects & Tutorials
    • Electronic Projects
      • Arduino Projects
      • AVR
      • Raspberry pi
      • ESP8266
      • BeagleBone
      • 8051 Microcontroller
      • ARM
      • PIC Microcontroller
      • STM32
    • Tutorials
      • Audio Electronics
      • Battery Management
      • Brainwave
      • Electric Vehicles
      • EMI/EMC/RFI
      • Hardware Filters
      • IoT tutorials
      • Power Tutorials
      • Python
      • Sensors
      • USB
      • VHDL
    • Circuit Design
    • Project Videos
    • Components
  • Articles
    • Tech Articles
    • Insight
    • Invention Stories
    • How to
    • What Is
  • News
    • Electronic Product News
    • Business News
    • Company/Start-up News
    • DIY Reviews
    • Guest Post
  • Forums
    • EDABoard.com
    • Electro-Tech-Online
    • EG Forum Archive
  • DigiKey Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • Learn
    • eBooks/Tech Tips
    • Design Guides
    • Learning Center
    • Tech Toolboxes
    • Webinars & Digital Events
  • Resources
    • Digital Issues
    • EE Training Days
    • LEAP Awards
    • Podcasts
    • Webinars / Digital Events
    • White Papers
    • Engineering Diversity & Inclusion
    • DesignFast
  • Guest Post Guidelines
  • Advertise
  • Subscribe