Download presentation
Presentation is loading. Please wait.
Published byAbigayle Lambert Modified over 6 years ago
1
Microcontrollers, Basics Fundamentals of Digital Debugging
19 January 2012 Jonathan A. Titus
2
Digital Debugging Any discussion of debugging invariable mixes hardware and software. But do not let debug sessions degenerate into battles between hardware and software people.
3
Digital Debugging Prevent defects from the beginning
Create a best-practices document and programming style Use Deming’s error-prevention steps Develop tests and perform unit tests as you go Write code that tests for limits and errors
4
Digital Debugging Use W Edwards Deming’s error-prevention “loop”
Identify a defect Find the defect’s root cause Locate where the defect occurred Implement preventive practices Monitor the process to verify effectiveness
5
Digital Debugging Use a Pareto chart to classify and identify defects:
6
Digital Debugging References
1. "Automated Defect Prevention:Best Practices in Software Management," by Dorota Huizinga and Adam Kolawa, Wiley Interscience, ISBN:
7
Digital Debugging References
2. "Test-Driven Development for Embedded C," James W. Grenning, The Pragmatic Programmers, ISBN:
8
Digital Debugging Write code that tests for limits and errors...
9
Digital Debugging Avoid problems: Carefully define specifications for a project: What happens when someone types an incorrect value, say, $000 at an ATM machine? What happens when someone continues to key-in incorrect PINs? Can you handle a printer-out-of-paper condition? What happens when a communication comes through with an incorrect CRC value? How do you handle a divide-by-zero error?
10
Simple Hardware Debug Tools
An LED and a pushbutton: simple debug friends: Basic on-off test or debug indicator Flash patterns Start-stop code Not a recommended debugging technique! Pushbutton connected to pin for P1.3.
11
Debugger or Emulator? Debug/programming pods:
Direct connection with programming tools Program MCU flash memory Debugging capabilities (vary by MCU) Require 3 to 5 signals Provide a USB or serial connection to host PC JTAG signals, but not IEEE-1149 compliant Often built into dev-kit boards (USB)
12
Debug & Programming Pods
13
Debugging “Messages” Helpful to see your own debug information
Avoid C printf statements -- high code price Microchip PICKits can operate as a UART IAR Embedded Workbench has text window Some dev-kit boards have virtual serial port for simple text communications with host PC. Jon’s debug “secret weapon”
14
A Debug Secret Weapon... An inexpensive receipt printer for <$100
15
A Debug Secret Weapon... Standard logic levels for serial input to printer Only one pin needed (plus ground) No drivers or debug module needed Small amount of code needed for UART Use bit bashing instead of UART, if necessary Immediate record of debug messages and data Good for field testing Inexpensive--many on ebay (serial, NOT USB!) Jon’s: Ithaca Series 80PLUS
16
What do Good Debug Tools Do?
Trace execution of code Watch variables and registers Set breakpoints Step through and over code Quickly make changes to code via IDE and test again They have limits in real-time situations
17
Presentation of Debug Information
18
ARM Debugging... Wow!
19
ARM Reference "The Definitive Guide to the ARM Cortex-M3," by Joseph Yiu, Newnes, ISBN:
20
Debugging Hardware Logic Analyzer Oscilloscope Protocol Analyzer
Power-Analysis Hardware and Software
21
Logic Analyzers I
22
Logic Analyzers II
23
Logic Analyzers III
24
Logic Analyzers IV
25
Oscilloscopes I
26
Oscilloscopes II
27
Protocol Analyzers
28
Power Analysis I
29
Power Analysis II
30
Debug Challenges I Interrupts Direct-Memory Access
31
Debug Challenges II It’s not always YOUR fault!
Check for revised docs, errata sheets, forum comments, app notes... MCU sleep mode did not behave as expected. PWM output did not behave as expected. Shared USB and serial pins! Not documented.
32
Hed Text Bullets If Needed
33
Hed Text Bullets If Needed
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.