0

I just managed to get Dean Camera's LUFA AVRISP clone working on my Arduino Pro Micro, when to my dismay I found that to use PDI for my XMega, I need to have PD5 exposed for the clock source! The Pro Micro has PD5 connected to an LED, so I am not easily able to use it.

If worst comes to worst, I can desolder the LED and wire a jumper, but that would be a pain in the butt. So I am wondering if any of you know if I can change the clock pin assignment from PD5 to PD6 or some other accesible pin. Thank you in advance for your help!

--[[ EDITS ]]-- Sorry for my lack of clarity, I am using the Pro Micro as the programmer, and the AVRISP clone supports PDI to the XMEGA. The 32u4 is actually directly supported by the programmer firmware. Here is what I am doing:

--[[ EDITS II ]]-- There is a schematic.. umm.. draw-o? I don't know but anyway the cathodes of D1 and D3 are NOT connected. That wire is an error.

schematic

simulate this circuit – Schematic created using CircuitLab

--Cantos

6
  • 1
    Umm, moderator? I do not know if this really belongs in arduino. I am not using any Arduino software or anything, and is more relavant to general AVR programming... Mar 15 '16 at 13:50
  • 1
    Mentioning Arduino in AVR questions on electronics.SE is like tagging a C question with C++ tag on SO. People will pay attention to the respective artifact instead of the question itself. Mar 15 '16 at 14:54
  • Okay, I'll remember that Mar 15 '16 at 15:35
  • 1
    Note that you may also bring your question up on meta if you feel the migration should be reversed. I doubt leaving your question on arduino.SE will bring you answers, while you got at least one on EE. Mar 15 '16 at 16:10
  • Do you have access to the source code? I can't seem find it. Only the .hex files. If only the hex code is provided, it won't be easy to change the pin mapping in the code. That would involve decompiling the hex etc.. I don't see anything particularly special about pin PB5, so changing the code to PB6 would most likely be possible (provided you have the code).
    – Gerben
    Mar 15 '16 at 16:29
1

I found the answer searching through the Doxygen files. I had to go to AppConfig.h under Config in the project root directory, and edit AUX_LINE_MASK to change the pin. Thanks to everyone who helped!

0

Can you give more details on your problem? Schematics or something like that?

As I see from here, the Arduino Pro Micro uses ATmega32u4 chip, which is not part of XMega family, so I'm not sure if their internals are mutually compatible. In any case, if you configure PD5 as an input for your clock, it will work as an input, since it's a GPIO pin (DDRD &= ~(1<<PIN5)). You'll just additionally have the LED blinking :). You can also configure PD6 as an input in the same way (DDRD &= ~(1<<PIN6)).

0

just in case anyone else is trying to use a Pro Micro as a makeshift PDI programmer with the AVRISPMKII firmware included in the LUFA library: contrary to what the OP claims to have accomplished by editing AppConfig.h, it is NOT possible to reassign the XCK pin on ATMEGA devices (at least not to my knowledge). I can only conjecture as to why he made that claim (perhaps he confused XMEGA/ATMEGA, and thus ISP/PDI). I do not wish to blame the OP, but his post had sent me and others down a dead end for a minute, too bad there is no easy fix like that. :(

The XCK function is hard-wired to the pin, in this (ATMEGA32U4) case PD5. The LUFA code utilizes the ATMEGA's USART transmitter configured for synchronous operation, hence a clock signal must be provided to transfer data to the target device. That's why XCK must be used and there is no other way, at least not with LUFA. The call that enables the PDI target has nothing to do with the AUX_LINE define in AppConfig.h

The only way a Pro Micro board can be used is by either soldering a wire to the XCK pin or by holding a wire against it (if you can hold it steady for a couple of seconds without slipping, that is). Thus, if you need a makeshift PDI programmer that will not require soldering, get a Teensy 2.0 or something else that breaks out PD5 as a GPIO pin.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.