+ - 0:00:00
Notes for current slide

Press 'p' to enter presentation mode. Or even better:

  1. press 'c' to clone the page
  2. press 'p' to enter presentation mode
  3. used cloned view for beam, share screen in zoom.
Notes for next slide

Debugging

13-03-2023

Fab Academy 2023

by: Henk & Nicolas

1 / 56

Press 'p' to enter presentation mode. Or even better:

  1. press 'c' to clone the page
  2. press 'p' to enter presentation mode
  3. used cloned view for beam, share screen in zoom.

1-Attitude
2-General principles
3-Multimeter
4-Logical analyzers
5-Oscilloscope
6-How to debug almost anything kit
7-Flashing your board
8- Microcontroller debugging
9-Serial (or any) "Hello world!"
10-USB and computer detection
11 -Radio Communications
2 / 56

Attitude & General principles

Slides by Fran & Duaa

3 / 56

ERROR

4 / 56

Don't jump to conclusions

  • Approach the problem objectively
  • Everyone (everything) is a suspect!
5 / 56

Write

  • what is happening
  • what is the environment
  • what are you doing
  • what are the results
6 / 56

Read

Don't forget to undrestand what you just read!

7 / 56

Don't Panic

8 / 56

Narrowing down the problem

  • Reproduce the problem
  • Always first do visual check

    • traces
    • solder
    • components
  • Keep in mind that the problem might not be visible without a microscope

Everything looks good but...

Image by Jonathan Blok - Waag

9 / 56

10 / 56

It's not working

Concentrate only on the relevant parts. Isolate the problem.

11 / 56

The microcontroller is not receiving voltage / the wrong voltage

Big chance the problem is located here.

12 / 56

Can't program the microcontroller

Big chance the problem is located here.

13 / 56

Programmed, unable to program other microcontrollers

Big chance the problem is located here.

14 / 56

Multimeter

  • "Continuous" phenomenons
  • Continuity check (+diodes orientation) : symbol
  • Voltage/Power check : parallel measurement
  • Resistance / current / ...
15 / 56

Continuity

  • Test power supply to power pins continuity
  • Check fuses, diodes orientations, ...
  • Check short-circuits
  • Check traces

16 / 56

Voltage

  • Parallel measurement => check your cables!
  • ! absolute maximum ratings (may burn your component)
  • Power supply impedence / max power, badly selected
  • GND/VCC loop

17 / 56

Power supply

  • Nothing : open circuit, short circuit, line break, blown fuse, ...
  • Voltage too low : power supply impedence, badly selected, ...
  • Voltage too high : above max. ratings, dead zener/reg., ...
  • GND/VCC loop
18 / 56

How to check current, resistor, capacitor, ...

  • Learn more about you mulimeter capabilites!
  • Circuit modify compononents behaviours! (resistance, cap,... in circuit)
  • Current : serie
  • Resistor : parallel
  • capacitor : parallel (+ polarity)

19 / 56

MultiMeter

20 / 56

Voltage Drop

21 / 56

Logical analyzer

  • Variable digital signals
  • Communications [UART, I²C, SPI, 1-Wire, ...]
  • PWM
  • Clock
  • ...
22 / 56

Logical analyzers

  • High sampling rates (> 100MHz - 500 MHz)
  • Only "logical levels" (0 : <0.6V - 1 : > 1.2V => usually not CMOS logic!)
  • Multiple channels (8-16...)
  • "Unexpensive" (compared to oscilloscopes)
  • Allows you to read complex protocols easily

Saleae, Pulseview with Cypress CY7C68013A, ...

23 / 56

Logic Analayzer

24 / 56

LA104 + DS213

26 / 56

Oscilloscope

  • "Variable / random" phenomena
  • Variable signals (analog, communications, blink, sound, ...)
27 / 56

Oscilloscope (main functions)

  • "Real" voltage levels, high sampling rate (> 10MHz - 1GHz)
  • Dynamic view
  • Triggers/Time/Level
  • Lots of analysis capabilities inside (play with menus : capture/ analyse / freq-time / intervals / Peak-peak / frequency / ...)
  • Few channels (~1-4)
  • Expensive tool. Poor human alternative : sound card mic/line input [< 44.1kS/sec]

28 / 56
29 / 56
30 / 56
31 / 56
32 / 56
33 / 56

Pinecile / TS80P

34 / 56

DPS3005 Bench Power Supply

35 / 56

DPS3005 Bench Power Supply

36 / 56

Flashing your board

And what can go wrong

37 / 56

EDBG for flashing ARM (1)

  • Connect a CMSIS-DAP SWD adapter
  • 10-pin 1.27mm connectors are convenient, but triple check the orientation
  • If VCC pin is unused, power your target device separately
  • Make sure the programmer is on 3.3V if programming SAMD
38 / 56

EDBG for flashing ARM (2)

  • List programmers
edbg -b -l
  • Erase first (!) and load program
edbg -ebpv -t <processor> -f <program.bin>
  • flags:

    • -b: verbose (optional)
    • -e: erase
    • -p: program
    • -v: verify (optional)
    • -t: target type (e.g. samd11)
  • Common problems

    • Programmer not listed: check USB
    • Invalid response: check JTAG connection
39 / 56

UPDI for Flashing AVR (1)

  • All you need is a serial adapter
  • RX and TX connected together with a 4.7k resistor or diode
    (any res. between 1.5k and 10k will work)
  • VCC is optional but ensures both chips talk at the same logic level
  • Programming is initiated with a break (LOW level for a long duration)
40 / 56

UPDI for Flashing AVR (2)

  • pymcuprog.py
pymcuprog -d <processor> -t uart -u <port> -v info erase
pymcuprog -d <processor> -t uart -u <port> -v info write -f <program.hex>
  • Arduino IDE

    • install megaTinyCore (ATtiny 1-series) or DxCore (AVR DA/DB)
    • use "serial UPDI with 4.7k resistor or diode SLOW (57600 bauds)" programmer
    • select correct serial port and click upload
  • Common problems

    • wrong serial settings: adapter needs 2 Stop bits and Even parity
    • "incorrect echo": are RX and TX connected together?
    • "UPDI initialisation failed": have you tried turning it off and on again?
    • have you changed UPDI pin function? (will require HV programmer!)
41 / 56

In-circuit / On-Chip debugging

Advanced debugging

42 / 56

Atmel ICE

  • Atmel-ICE
  • Allows you to pause execution (breakpoints / run-to-cursor)
  • Watch variables and registers
  • Tightly integrated within Atmel Studio
43 / 56

OpenOCD+GDB for debugging SAMD

apt get install openocd
  • Create openocd.cfg:
source [find interface/cmsis-dap.cfg]
set CHIPNAME at91samd11c14
source [find target/at91samdXX.cfg]
  • Connect SWD programmer and launch: openocd
  • Connect to opencd with gdb:
arm-none-eabi-gdb -iex "target extended-remote localhost:3333"
44 / 56

Debugging SAM-Based Arduino® Boards:

https://docs.arduino.cc/tutorials/mkr-wifi-1010/atmel-ice

45 / 56

esptool

  • Espressif chips ROM Bootloader Utility
- Port problem
- Wrong chip
·
46 / 56
47 / 56

Serial (or any) "Hello world!"

Sending internal info through communication line

48 / 56

Serial (or any) "Hello world!"

  • Show any external signal on code execution (eg : LED blinking)
  • Send register value or "hello world" message through communication lines (eg : serial/UART)
  • Very simple to implement but requires functional microcontroller
  • Allows you to follow execution steps

Example:

#define DEBUG_MODE 1
...
#if DEBUG_MODE
Serial.print("DEBUG -- MyVal value = ");
Serial.println(MyVal, DEC);
#endif
49 / 56

USB

Check your USB device can be found by the OS

50 / 56

USB

$ lsusb
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 003: ID 046d:c05a Logitech, Inc. M90/M100 Optical Mouse
Bus 001 Device 004: ID 413c:2011 Dell Computer Corp. Multimedia Pro Keyboard
$ lsusb
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 003: ID 046d:c05a Logitech, Inc. M90/M100 Optical Mouse
Bus 001 Device 004: ID 413c:2011 Dell Computer Corp. Multimedia Pro Keyboard
Bus 001 Device 029: ID 6666:6666 Prototype product Vendor ID

If nothing :

  • Check you load proper bootloader!
  • Check lines, voltages ("5V" power BUT 3.3V communication D-/D+), zener orientations, ...

If declared but doesn't work :

  • Check USB devices permissions
  • Check firmware (inject a tried-and-tested)
51 / 56

USB

$ dmesg -w
52 / 56

Radio Communications

How to see what you can't even touch?

53 / 56

Radio communications

54 / 56

Radio communications

55 / 56

Happy Debugging

56 / 56

1-Attitude
2-General principles
3-Multimeter
4-Logical analyzers
5-Oscilloscope
6-How to debug almost anything kit
7-Flashing your board
8- Microcontroller debugging
9-Serial (or any) "Hello world!"
10-USB and computer detection
11 -Radio Communications
2 / 56
Paused

Help

Keyboard shortcuts

, , Pg Up, k Go to previous slide
, , Pg Dn, Space, j Go to next slide
Home Go to first slide
End Go to last slide
Number + Return Go to specific slide
b / m / f Toggle blackout / mirrored / fullscreen mode
c Clone slideshow
p Toggle presenter mode
t Restart the presentation timer
?, h Toggle this help
Esc Back to slideshow