abcminiuser / lufa

LUFA - the Lightweight USB Framework for AVRs.
http://www.lufa-lib.org
1.03k stars 321 forks source link

XMega AVRISP2 #178

Open masterxq opened 2 years ago

masterxq commented 2 years ago

Hi Dean, we have a small hackerspace and our members have build some programmers based on xmega for programming some microcontrollers. We want to extend the functionality to also be able to program avr based microcontrollers. So we forked your software and trying to get the Project AVRISP-MKII work on the XMEGA. I think we allready did a lot, but we have trouble to complete it. I really wish i could make a pull request for a branch of your project. Every change is forked on ARCH... Except the makefile. If you want to accept this pull request you possibly will need to change the ARCH in the makefile back to AVR8 and check the AppConfig.h. Then it should be ok to merge to master, even if our code is not completed it will not break the current functionality. The current status of XMEGA support is: It compiles and will be detectected as AVRISP mkII. But we can not program over PDI. SPI is still untested.

We want to ask for your help.

  1. We have trouble with debugging (leak of tools and knowledge) so we don't know exactly what the problems are.
  2. We can do more Task, but currently we are not sure what to do. If you can give us specs will just implement things.
  3. We created the function Endpoint_SetEndpointDirection, this needs to be checked and should maybe be modified, its just a guess about how to do.

You can just merge the code under your name and your licence. We just want is to get it work and learn something :)

Please drop some words, also if you have no time for help. So we know we need to continue alone :)

Thanks that we may use your your amazing code!

masterxq commented 2 years ago

We can now read signature and fuses via PDI, then USB crashes while trying to read the memory. We get the answer 0xd9 0xc9 from the device and expecting something like 0x50 0x05 0x00... We will continue with SPI as soon PDI works.

But ok something working ^^

masterxq commented 2 years ago

Hi, PDI is now woking fine! We also found an critical bug related to #172. Length check was broken, even if you still don't want to merge you should fix this. The programming of the XMega is not possible with your current length check... We also compared our PDI implementation on a logic analyzer to the orignal AVRISP II PDI signal. Everything looks great! Really nice to have this finally working :)

Regards the HTV Group!

masterxq commented 2 years ago

Now SPI works too. Verified with programming an atmega328p. Lowerest clk rate not possible with SPI module but could be reached with USART in SPI Master mode. But i think it's fine as it is. Not tested with avr8 as programmer.

masterxq commented 2 years ago

Hi Dean, if there are some modifications you need before you can merge, you have to tell us soon. Because the device is now working as we wish and we are going to forget details and losing the focus on this project.

There are following limitations:

But we have:

Compare with the orignal AVRISP2 is done for ISP and PDI.

Of cause you are welcome to modify our PR yourself or make a PR against our git. We can test your modifications and report back.

Regards