Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Xplained Pro should be able to support PDI mode #1143

Closed
mcuee opened this issue Oct 22, 2022 · 9 comments · Fixed by #1147
Closed

Xplained Pro should be able to support PDI mode #1143

mcuee opened this issue Oct 22, 2022 · 9 comments · Fixed by #1147
Labels
enhancement New feature or request

Comments

@mcuee
Copy link
Collaborator

mcuee commented Oct 22, 2022

Xplained Pro should be able to support PDI mode as per the documentation.

Reference: take note that the following document does not cover UPDI support.
https://ww1.microchip.com/downloads/en/DeviceDoc/Atmel-42096-Microcontrollers-Embedded-Debugger_User-Guide.pdf

Reference discussion:

Programmer Interface
AVRISP ISP
Xplained Pro JTAG & PDI & UPDI
@mcuee mcuee added the enhancement New feature or request label Oct 22, 2022
@mcuee
Copy link
Collaborator Author

mcuee commented Oct 22, 2022

We have already two entries for
https://github.com/avrdudes/avrdude/blob/main/src/avrdude.conf.in#L2034-L2058

#------------------------------------------------------------
# xplainedpro
#------------------------------------------------------------

programmer
    id                     = "xplainedpro";
    desc                   = "Atmel AVR XplainedPro in JTAG mode";
    type                   = "jtagice3";
    prog_modes             = PM_JTAG | PM_XMEGAJTAG | PM_AVR32JTAG;
    connection_type        = usb;
    usbpid                 = 0x2111;
;

#------------------------------------------------------------
# xplainedpro_updi
#------------------------------------------------------------

programmer
    id                     = "xplainedpro_updi";
    desc                   = "Atmel AVR XplainedPro in UPDI mode";
    type                   = "jtagice3_updi";
    prog_modes             = PM_UPDI;
    connection_type        = usb;
    usbpid                 = 0x2111;
    hvupdi_support         = 1;
;

I think we need to add one more entry for the PDI mode.

#------------------------------------------------------------
# xplainedpro_pdi
#------------------------------------------------------------

programmer
    id                     = "xplainedpro_pdi";
    desc                   = "Atmel AVR XplainedPro in PDI mode";
    type                   = "jtagice3_pdi";
    prog_modes             = PM_PDI;
    connection_type        = usb;
    usbpid                 = 0x2111;
    hvupdi_support         = 1;
;

@mcuee
Copy link
Collaborator Author

mcuee commented Oct 22, 2022

@MCUdude
I cannot test this. I am wondering if you have the XplainedPro board for the ATxmega device to check whether the above is correct or not. Thanks.

@MCUdude
Copy link
Collaborator

MCUdude commented Oct 22, 2022

@mcuee I don't own an Xplained Pro board, so I can't test this.
Ideally, I'd like to get an ATmega324PB Xplained Pro and an Xmega A1U Xplained Pro for testing, but I can't really justify spending the money.

@mcuee
Copy link
Collaborator Author

mcuee commented Oct 22, 2022

@mcuee I don't own an Xplained Pro board, so I can't test this. Ideally, I'd like to get an ATmega324PB Xplained Pro and an Xmega A1U Xplained Pro for testing, but I can't really justify spending the money.

@MCUdude
Totally agree. These boards are just too expensive. Maybe someone from Microchip can help to check, probably no need to test either, just to check some internal design documentations.

@mcuee
Copy link
Collaborator Author

mcuee commented Oct 22, 2022

@MCUdude

I have documented what I have here. I have no issues spending on tools like the Curiosity Nano or Xplained Mini board or Microchip SNAP. But anything more expensive may not be justified. The only thing I might buy in the future is PICkit 4 as it seems to be the preferred tool down the road.
#1021 (comment)

I am not so sure if you can list down the tools and boards you have. You certainly have more official tools than what I have.

@MCUdude
Copy link
Collaborator

MCUdude commented Oct 22, 2022

I am not so sure if you can list down the tools and boards you have. You certainly have more official tools than what I have.

I have acquired quite a lot over the years, mostly because I've been maintaining several Arduino cores. I can probably make a list sometime, but it will take some time to go through everything.

In #1003 we discussed how one can support the Avrdude project. Personally, I'm not interested I'm money, but hardware for testing is always helpful.

mcuee added a commit to mcuee/avrdude that referenced this issue Oct 23, 2022
This will fix avrdudes#1143.

Xplained Pro should be able to support PDI mode as per the documentation.

Reference: take note that the following document does not cover UPDI support.
https://ww1.microchip.com/downloads/en/DeviceDoc/Atmel-42096-Microcontrollers-Embedded-Debugger_User-Guide.pdf

Reference discussion:
* avrdudes#1139 (comment)
* avrdudes#1019 (comment)
@mcuee
Copy link
Collaborator Author

mcuee commented Oct 23, 2022

Pull request #1147 has been created. Even though we can not test it, I think it is correct based on the documentation.

@mcuee
Copy link
Collaborator Author

mcuee commented Oct 28, 2022

Pull request #1147 has been created. Even though we can not test it, I think it is correct based on the documentation.

It is better to test that before merging. Hopefully we can find someone who can test #1147.

I managed to borrow the PICkit 4 and ATtiny817 Xplained Pro evaluation kit from local Microchip office but unfortunately they do not have the XMEGA A1U Xplained Pro evaluation kit to test #1147.

@mcuee
Copy link
Collaborator Author

mcuee commented Oct 28, 2022

BTW, xplainedpro_updi works fine.

C:\work\avr\avrdude_test\avrdude_bin> .\avrdude -c xplainedpro_updi -p t817 -t

         Vtarget                      : 3.34 V
         JTAG clock megaAVR/program   : 1000 kHz
         JTAG clock megaAVR/debug     : 1000 kHz
         JTAG clock Xmega             : 1000 kHz
         PDI/UPDI clock Xmega/megaAVR : 1000 kHz
avrdude: AVR device initialized and ready to accept instructions
avrdude: device signature = 0x1e9320 (probably t817)
avrdude> dump flash 0 0x10
>>> dump flash 0 0x10

Reading | ################################################## | 100% 0.05 s

0000  55 c8 18 95 18 95 18 95  18 95 18 95 ca c7 18 95  |U...............|

avrdude> dump eeprom 0 0x10
>>> dump eeprom 0 0x10

Reading | ################################################## | 100% 0.05 s

0000  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|

avrdude> write eeprom 0 0xaa 0x55 0xaa
>>> write eeprom 0 0xaa 0x55 0xaa

Caching | ################################################## | 100% 0.01 s

avrdude> flush
>>> flush
avrdude: synching cache to device ...
Writing | ################################################## | 100% 0.01 s
avrdude> dump eeprom 0 0x10
>>> dump eeprom 0 0x10

Reading | ################################################## | 100% 0.04 s

0000  aa 55 aa ff ff ff ff ff  ff ff ff ff ff ff ff ff  |.U..............|

avrdude> quit
>>> quit
avrdude>
avrdude done.  Thank you.

C:\work\avr\avrdude_test\avrdude_bin> .\avrdude -c xplainedpro_updi -p t817 -U flash:w:t817.hex:i

         Vtarget                      : 3.34 V
         JTAG clock megaAVR/program   : 1000 kHz
         JTAG clock megaAVR/debug     : 1000 kHz
         JTAG clock Xmega             : 1000 kHz
         PDI/UPDI clock Xmega/megaAVR : 1000 kHz
avrdude: AVR device initialized and ready to accept instructions
avrdude: device signature = 0x1e9320 (probably t817)
avrdude: Note: flash memory has been specified, an erase cycle will be performed.
         To disable this feature, specify the -D option.
erasing chip
avrdude: reading input file t817.hex for flash
         with 8192 bytes in 1 section within [0, 0x1fff]
         using 128 pages and 0 pad bytes
avrdude: writing 8192 bytes flash ...

Writing | ################################################## | 100% 1.34 s

avrdude: 8192 bytes of flash written
avrdude: verifying flash memory against t817.hex

Reading | ################################################## | 100% 0.65 s

avrdude: 8192 bytes of flash verified

avrdude done.  Thank you.

PS C:\work\avr\avrdude_test\avrdude_bin> .\avrdude_git -c xplainedpro_updi -p attiny817 
 -U eeprom:w:.\hex2\entest_128B.eep:i

             Vtarget                      : 3.34 V
             JTAG clock megaAVR/program   : 1000 kHz
             JTAG clock megaAVR/debug     : 1000 kHz
             JTAG clock Xmega             : 1000 kHz
             PDI/UPDI clock Xmega/megaAVR : 1000 kHz
avrdude_git: AVR device initialized and ready to accept instructions
avrdude_git: device signature = 0x1e9320 (probably t817)
avrdude_git: reading input file .\hex2\entest_128B.eep for eeprom
             with 128 bytes in 1 section within [0, 0x7f]
             using 4 pages and 0 pad bytes
avrdude_git: writing 128 bytes eeprom ...

Writing | ################################################## | 100% 0.04 s

avrdude_git: 128 bytes of eeprom written
avrdude_git: verifying eeprom memory against .\hex2\entest_128B.eep

Reading | ################################################## | 100% 0.02 s

avrdude_git: 128 bytes of eeprom verified

avrdude_git done.  Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants