Author Topic: Debugger Power Control application  (Read 2394 times)

0 Members and 5 Guests are viewing this topic.

Offline visenriTopic starter

  • Contributor
  • Posts: 32
  • Country: es
Debugger Power Control application
« on: June 03, 2026, 02:08:26 am »
I've just finished a little application for controlling the power supply voltage of Atmel / Microchip debugging tools.

It is very simple, but I find it very convenient, I just missed the power control I had with Pickit2 & Pickit3 in the newer debuggers.

Please post here if it works or not with your debugger (Indicate OS, python version and in case of errors, paste here the contents of the output log).

Let me also know any problems, or possible improvements.

It should work with:

  • PKOB nano (nEDBG) - on-board debugger on Curiosity Nano
  • MPLAB PICkit 4 In-Circuit Debugger (when in 'AVR mode')
  • MPLAB Snap In-Circuit Debugger (when in 'AVR mode')
  • Atmel-ICE
  • Power Debugger
  • EDBG - on-board debugger on Xplained Pro/Ultra
  • mEDBG - on-board debugger on Xplained Mini/Nano
  • JTAGICE3 (firmware version 3.0 or newer)



See more details and download it at github:
https://github.com/visenri/DebugPwrControl
« Last Edit: June 03, 2026, 02:13:18 am by visenri »
 
The following users thanked this post: Dazed_N_Confused

Offline visenriTopic starter

  • Contributor
  • Posts: 32
  • Country: es
Re: Debugger Power Control
« Reply #1 on: June 03, 2026, 02:11:39 am »
@Dave Jones
Feel free to test it and comment / rant about it in a video!!.
 

Offline Renate

  • Super Contributor
  • ***
  • Posts: 1818
  • Country: de
    • Renate's Android Page
Re: Debugger Power Control application
« Reply #2 on: June 03, 2026, 03:32:39 am »
That's very interesting and it's helpful to be able to cycle the power sometimes.
I have an Atmel ICE programmer and that doesn't supply power at all, only senses it.

I learned some new AVR "housekeeping" commands from the file https://github.com/microchip-pic-avr-tools/pyedbglib/blob/main/pyedbglib/protocols/housekeepingprotocol.py
Do you know what the difference between HOUSEKEEPING_ANALOG_VTREF and HOUSEKEEPING_ANALOG_VTG_BUF is?
I've always just relied on the CMSIS DAP_Info command to get info strings.

I have a separate tiny USB power supply that plots.
It's helpful to watch devices boot up.
With control from a generic USB foot pedal I can cycle things quickly.

 

Offline visenriTopic starter

  • Contributor
  • Posts: 32
  • Country: es
Re: Debugger Power Control application
« Reply #3 on: June 03, 2026, 11:49:23 pm »
Do you know what the difference between HOUSEKEEPING_ANALOG_VTREF and HOUSEKEEPING_ANALOG_VTG_BUF is?
If you have a look at:
https://github.com/microchip-pic-avr-tools/pymcuprog/blob/main/pymcuprog/utils.py

You can notice that from the available analog voltages:
Code: [Select]
    HOUSEKEEPING_ANALOG_VTREF = 0x00  # Target voltage reference value
    HOUSEKEEPING_ANALOG_VTG_BUF = 0x01  # Bufferred target voltage reference
    HOUSEKEEPING_ANALOG_VUSB = 0x02  # USB voltage

It only uses:
Code: [Select]
HOUSEKEEPING_ANALOG_VTREF
HOUSEKEEPING_ANALOG_VUSB
In:
Code: [Select]
read_target_voltage(housekeeper)
read_usb_voltage(housekeeper)

Whose meaning is obvious, but no mention to the mysterious "Bufferred target voltage".

I digged a little bit in the source code of avr-dude, and the same problem there:
https://github.com/avrdudes/avrdude/blob/main/src/jtag3_private.h

Code: [Select]
#define PARM3_VTARGET           0x00 // Section 1, generic scope, 2 bytes, in millivolts
#define PARM3_VBUF              0x01 // Section 1, generic scope, 2 bytes, bufferred target voltage reference
#define PARM3_VUSB              0x02 // Section 1, generic scope, 2 bytes, USB voltage

Similar descriptions, but PARM3_VBUF is not used in any file in the whole source code.
 

Offline visenriTopic starter

  • Contributor
  • Posts: 32
  • Country: es
Re: Debugger Power Control application
« Reply #4 on: June 03, 2026, 11:52:45 pm »
I have an Atmel ICE programmer and that doesn't supply power at all, only senses it.
Please, let me know if my program detects your programmer and can at least read the voltages.
To trigger a read, just press the OFF button, even if it fails, it should read the available voltages and show the programmer tool info.
 

Offline Renate

  • Super Contributor
  • ***
  • Posts: 1818
  • Country: de
    • Renate's Android Page
Re: Debugger Power Control application
« Reply #5 on: June 04, 2026, 03:14:07 am »
Fun with Python. |O
Code: [Select]
Traceback (most recent call last):
  File "E:\PyPwr\debuggerpwrcontrol.pyw", line 11, in <module>
    import tkinter as tk
ModuleNotFoundError: No module named 'tkinter'
Code: [Select]
C:\>pip install tkinter
ERROR: Could not find a version that satisfies the requirement tkinter (from versions: none)
ERROR: No matching distribution found for tkinter
Sorry, fighting with Python installs is my least favorite hobby.

This is my own (non-Python) utility:
Code: [Select]
C:\>atmelice stm32f411
524288 flash, 131072 ram
Atmel-ICE CMSIS-DAP J42700012345 V1.0 3.324V
DPIDR: 2ba01477
CPUID: 10006431
I've also found that the Atmel ICE sometimes (5%?) reads zero on the first poll of voltage.
I always do two queries.
 

Offline visenriTopic starter

  • Contributor
  • Posts: 32
  • Country: es
Re: Debugger Power Control application
« Reply #6 on: July 12, 2026, 10:33:21 pm »
I have released a new version with more features.
Now you can download binary versions, no more need to fight with Python libraries.
https://github.com/visenri/DebugPwrControl/releases
  • Added 2.5V preset voltage.
  • Added reset functionality.
  • Added keyboard and mouse shortcuts to modify voltage (Shift+Wheel, Right+Wheel, Shift+Up/Down keys).
  • Application remembers settings and window size.
  • Added light - dark visual styles.
  • Optimized compact mode, some controls change size / font when window size is reduced.
  • Added application icon.
  • Tested under linux.

Fun with Python. |O
Code: [Select]
Traceback (most recent call last):
  File "E:\PyPwr\debuggerpwrcontrol.pyw", line 11, in <module>
    import tkinter as tk
ModuleNotFoundError: No module named 'tkinter'
Code: [Select]
C:\>pip install tkinter
ERROR: Could not find a version that satisfies the requirement tkinter (from versions: none)
ERROR: No matching distribution found for tkinter
Sorry, fighting with Python installs is my least favorite hobby.

If you can, try it and tell me if it works now.
« Last Edit: July 12, 2026, 10:39:33 pm by visenri »
 

Offline westfw

  • Super Contributor
  • ***
  • Posts: 4668
  • Country: us
Re: Debugger Power Control application
« Reply #7 on: July 13, 2026, 07:57:22 pm »
Quote
I have an Atmel ICE programmer and that doesn't supply power at all, only senses it.
I thought that a LOT of the programmers listed as "supported" do not provide power?  eg:   
  • Quote
    Note:  The MPLAB Snap In-Circuit Debugger is powered through its Micro-B USB connector. The target board must be powered from its own power supply.
   
 

Offline visenriTopic starter

  • Contributor
  • Posts: 32
  • Country: es
Re: Debugger Power Control application
« Reply #8 on: July 14, 2026, 01:04:47 am »
Quote
I have an Atmel ICE programmer and that doesn't supply power at all, only senses it.
I thought that a LOT of the programmers listed as "supported" do not provide power?  eg:   
  • Quote
    Note:  The MPLAB Snap In-Circuit Debugger is powered through its Micro-B USB connector. The target board must be powered from its own power supply.


You are very right, I just copied the list of programmers from pymcuprog.

After checking the documentation it seems that only these programmers support controlling the target voltage:
  • PKOB nano (nEDBG) - on-board debugger on Curiosity Nano
  • MPLAB PICkit 4 In-Circuit Debugger (when in 'AVR mode')
  • Power Debugger

The rest will only use the target voltage connection for logic level conversion.
  • MPLAB Snap In-Circuit Debugger (when in 'AVR mode')
  • Atmel-ICE
  • EDBG - on-board debugger on Xplained Pro/Ultra
  • mEDBG - on-board debugger on Xplained Mini/Nano
  • JTAGICE3

With the new version, they should work, albeit with very limited functionality: reset and read target voltage (not very useful |O).
« Last Edit: July 14, 2026, 01:07:41 am by visenri »
 

Offline Renate

  • Super Contributor
  • ***
  • Posts: 1818
  • Country: de
    • Renate's Android Page
Re: Debugger Power Control application
« Reply #9 on: July 14, 2026, 03:33:54 am »
I don't know which of those support DGI (Data Gateway Interface) which is a 2nd USB interface on some programmers (like Atmel ICE).
I've used it a lot with AVR8 stuff. It gives you a way to send debug text over the same 6 pin ISP (programming interface).
It saves you from connecting up a separate UART to get debug text.
DGI also has its own command for target reset.

See: https://ww1.microchip.com/downloads/aemDocuments/documents/data-visualizer/40001905B.pdf

On the SAMD21 you can't similarly reuse the SWD interface due to unfortunate multiplexing decisions without bit-banging.
All SERCOM Data/Clock is normally Pad 0/1 or 2/3.
They parked SWDIO/SWCLK on Pad 3/2.
Yes, there are register options to swap things, but nothing gives the correct combination for SPI, UART or I²C.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf

 

- - -
-->