Pic Mcu/Dspic Dsc - On-Chip Debugging - Microchip Technology MPLAB ICD 5 User Manual

In-circuit debugger
Table of Contents

Advertisement

However, when single-stepping this function through the OCD, this code will always give 0xAA in
the PIN register since the I/O is running at full speed even when the core is stopped during the
single-stepping.
Single Stepping and Timing
Certain registers need to be read or written within a given number of cycles after enabling a
control signal. Since the I/O clock and peripherals continue to run at full speed in Stopped mode,
single-stepping through such code will not meet the timing requirements. Between two single steps,
the I/O clock may have run millions of cycles. To successfully read or write registers with such timing
requirements, the whole read or write sequence should be performed as an atomic operation
running the device at full speed. This can be done by using a macro or a function call to execute the
code or use the run-to-cursor function in the debugging environment.
Accessing 16-Bit Registers
The Microchip AVR peripherals typically contain several 16-bit registers that can be accessed via the
8-bit data bus (e.g., TCNTn of a 16-bit timer). The 16-bit register must be byte accessed using two
read or write operations. Breaking in the middle of 16-bit access or single-stepping through this
situation may result in erroneous values.
Restricted I/O Register Access
Certain registers cannot be read without affecting their content. Such registers include those which
contain flags which are cleared by reading, or buffered data registers (e.g., UDR). The software
front-end will prevent reading these registers when in Stopped mode to preserve the intended
non-intrusive nature of OCD debugging. Also, some registers cannot safely be written without side-
effects occurring. These registers are read-only. For example:
• Flag registers, where a flag is cleared by writing 1 to any bit. These registers are read-only.
• UDR and SPDR registers cannot be read without affecting the state of the module. These registers
are not accessible.
4.3.2
PIC32M MCU - On-Chip Debugging
PIC32M MCU devices support two types of debugging: (1) In-Circuit Serial Programming
debugging using the PGECx and PGEDx pins or (2) 4-wire MIPS
The MIPS32 M4K Processor core provides for an Enhanced JTAG (EJTAG) interface for use in the
software debug of application and kernel code. In addition to the standard JTAG instructions, special
instructions defined in the EJTAG specification define which registers are selected and how they are
used. For details on this interface, see your device data sheet.
In addition, there are program and complex data breakpoints. See your device data sheet for details
on debug features for your specific PIC32M device.
4.4

PIC MCU/dsPIC DSC - On-Chip Debugging

An on-chip debug module is a system allowing a developer to monitor and control the execution
on a device from an external development platform, usually through a device known as a debugger
or debug adapter. With an OCD system, the application can be executed while exact electrical and
timing characteristics in the target system (as opposed to a simulator). The system is able to stop
execution conditionally or manually and inspect program flow and memory.
For PIC microcontrollers (MCUs) or dsPIC digital signal controllers (DSC), some device resources may
need to be reserved for debug.
4.4.1
Basic Debug Features
MPLAB
®
ICD 5 In-Circuit Debugger has the following basic debug features.
4.4.1.1 Start and Stop Emulation
To debug an application in MPLAB X IDE, you must create a project containing your source code so
that the code may be built, programmed into your device, and executed as specified below:
User Guide
©
2023 Microchip Technology Inc. and its subsidiaries
®
Enhanced JTAG.
Operation
(ICSP
) and
DS-50003529B -
39

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the MPLAB ICD 5 and is the answer not in the manual?

Table of Contents