Unable to use AVR-ISP-MKII via avrdude or Atmel Studio 7

Started by Auzman, August 31, 2017, 06:54:18 PM

Previous topic - Next topic

Auzman

Hello everybody!
I read a lot of threads regarding the issue that many people (like me) find in using AVR-ISP-MKII.
So far I had no luck on getting it to work.
This is the situation, starting with avrdude:
- the firmware on AVR-ISP-MKII has been upgraded to the latest one
- the drivers are correctly reported as libusb 1.2.6.0
- I'm running Windows 7 64bit
- I tried both avrdude 6.3 and 5.1.1
- I'm trying to flash an atxmega128a1u-au

Latest test has been made with the following:
avrdude -p x128a1 -P usb -c avrispmkii -F -U flash:w:ensemble-CH-3044.hex
and this is the result:

avrdude: stk500v2_command(): error in CMD_XPROG: Failed
avrdude: stk600_xprog_program_enable(): XPRG_CMD_ENTER_PROGMODE failed
avrdude: initialization failed, rc=-1
avrdude: AVR device initialized and ready to accept instructions
avrdude: Device signature = 0x000000
avrdude: Yikes!  Invalid device signature.
avrdude: Expected signature for ATXMEGA128A1 is 1E 97 4C
avrdude: NOTE: FLASH memory has been specified, an erase cycle will be performed

         To disable this feature, specify the -D option.

avrdude done.  Thank you.


Do you guys have a suggestion for me?
Thank you!

LubOlimex

This is not an issue with the drivers since AVR-ISP-MK2 is properly recognized. It is probably improper hardware connection between AVR-ISP-MKII an atxmega128a1u or lack of power supply. It can be wrongfully set configuration bits, make sure to test with another x128a1 chip if possible (sometimes source of clock is wrongfully set).
Technical support and documentation manager at Olimex

Auzman

Hi LubOlimex, sorry for the increbibly late answer!
The same target works correctyl with an original Atmel AVR ISP MK2 on the same PC.
If I use avrdude 6.3 I get the following:


avrdude: stk500v2_recv_mk2: error in USB receive
avrdude: stk500v2_recv_mk2: error in USB receive
avrdude: stk500v2_recv_mk2: error in USB receive
avrdude: stk500v2_recv_mk2: error in USB receive
avrdude: stk500v2_recv_mk2: error in USB receive
avrdude: stk500v2_recv_mk2: error in USB receive
avrdude: stk500v2_getsync(): timeout communicating with programmer


I have 3 Olimex programmers and I cannot get anyone to work...

LubOlimex

This is another error message, different from the one in your original post. I believe it is caused by a endpoint pass detect bug in the source code of AVRDUDE described in the FAQ section. Test the same thing with this version of AVRDUDE - http://download.savannah.gnu.org/releases/avrdude/avrdude-5.11-Patch7610-win32.zip - and report back.

The following threads also describe the same problem:

https://www.olimex.com/forum/index.php?topic=5401.0
https://www.olimex.com/forum/index.php?topic=5358.0
https://www.olimex.com/forum/index.php?topic=2057.0
https://www.olimex.com/forum/index.php?topic=5207.0

> The same target works correctyl with an original Atmel AVR ISP MK2 on the same PC.

Unfortunately, this doesn't mean a lot since AVR-ISP-MKII is not a replica of the original unit. It has own hardware and software design based on the LUFA design.
Technical support and documentation manager at Olimex

Auzman

Quote from: LubOlimex on April 25, 2018, 11:16:42 AM
...
Test the same thing with this version of AVRDUDE - http://download.savannah.gnu.org/releases/avrdude/avrdude-5.11-Patch7610-win32.zip - and report back.
...
With this version I get the following:

avrdude: stk500v2_command(): error in CMD_XPROG: Failed
avrdude: stk600_xprog_program_enable(): XPRG_CMD_ENTER_PROGMODE failed
avrdude: initialization failed, rc=-1
         Double check connections and try again, or use -F to override
         this check.


avrdude done.  Thank you.


Quote from: LubOlimex on April 25, 2018, 11:16:42 AM
...
> The same target works correctyl with an original Atmel AVR ISP MK2 on the same PC.

Unfortunately, this doesn't mean a lot since AVR-ISP-MKII is not a replica of the original unit. It has own hardware and software design based on the LUFA design.
...

This was meant just to qualify the hardware that is correctly working.

The firmware I am using on the AVR ISP MK2 is the one described in readme.txt as "libUSB-AVRISP-MKII.hex - based on latest stable LUFA as of 06/01/2016".

Thank you again.

LubOlimex

Until we figure it out I would recommend using the AVRDUDE version from my previous post (http://download.savannah.gnu.org/releases/avrdude/avrdude-5.11-Patch7610-win32.zip). This would exclude other possible problems.

The new error hints a problem in the hardware connections. It can be simply a lose wire. Or you might be using a wrong connector or pinout. The original ISP MK II has only one 6-pin connector that is used for TPI, PDI, ISP programming. Olimex AVR-ISP-MK2 has separate connectors for each interface and NO 6-pin ISP.

Can you upload somewhere a picture that shows the hardware connections between AVR-ISP-MK2 and your target then share the link here so we can inspect it?

Best regards,
Lub/OLIMEX


Technical support and documentation manager at Olimex

Auzman

Hi, I made some photos to better explain.
These are the available programmers:



and this is the schematic of the PDI interface:



I'm using the avrdude version you required.
By connecting the Atmel programmer



I get this output:


PS C:\AVRDude\avrdude-5.11-Patch7610-win32> avrdude -p x128a1 -P usb -c avrispmkii -U flash:w:ToGo.hex

avrdude.exe: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.00s

avrdude.exe: Device signature = 0x1e974c (probably x128a1u)
avrdude.exe: NOTE: Programmer supports page erase for Xmega devices.
             Each page will be erased before programming it, but no chip erase is performed.
             To disable page erases, specify the -D option; for a chip-erase, use the -e option.
avrdude.exe: reading input file "ToGo.hex"
avrdude.exe: input file ToGo.hex auto detected as Intel Hex
avrdude.exe: writing flash (41952 bytes):

Writing | ################################################## | 100% 2.58s

avrdude.exe: 41952 bytes of flash written
avrdude.exe: verifying flash memory against ToGo.hex:
avrdude.exe: load data flash data from input file ToGo.hex:
avrdude.exe: input file ToGo.hex auto detected as Intel Hex
avrdude.exe: input file ToGo.hex contains 41952 bytes
avrdude.exe: reading on-chip flash data:

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

avrdude.exe: verifying ...
avrdude.exe: 41952 bytes of flash verified

avrdude.exe done.  Thank you.


If I try the Olimex programmers like this:


I get this output:


PS C:\AVRDude\avrdude-5.11-Patch7610-win32> avrdude -p x128a1 -P usb -c avrispmkii -U flash:w:ToGo.hex
avrdude.exe: stk500v2_recv_mk2: error in USB receive
avrdude.exe: stk500v2_recv_mk2: error in USB receive
avrdude.exe: stk500v2_recv_mk2: error in USB receive
avrdude.exe: stk500v2_recv_mk2: error in USB receive
avrdude.exe: stk500v2_recv_mk2: error in USB receive
avrdude.exe: stk500v2_recv_mk2: error in USB receive
avrdude.exe: stk500v2_getsync(): timeout communicating with programmer

avrdude.exe: stk500v2_recv_mk2: error in USB receive
avrdude.exe: stk500v2_recv_mk2: error in USB receive
avrdude.exe: stk500v2_recv_mk2: error in USB receive
avrdude.exe: stk500v2_recv_mk2: error in USB receive
avrdude.exe: stk500v2_recv_mk2: error in USB receive
avrdude.exe: stk500v2_recv_mk2: error in USB receive
avrdude.exe: stk500v2_recv_mk2: error in USB receive
avrdude.exe: stk500v2_getsync(): timeout communicating with programmer
avrdude.exe: stk500v2_recv_mk2: error in USB receive
avrdude.exe: stk500v2_recv_mk2: error in USB receive
avrdude.exe: stk500v2_recv_mk2: error in USB receive
avrdude.exe: stk500v2_recv_mk2: error in USB receive
avrdude.exe: stk500v2_recv_mk2: error in USB receive
avrdude.exe: stk500v2_recv_mk2: error in USB receive
avrdude.exe: stk500v2_recv_mk2: error in USB receive
avrdude.exe: stk500v2_getsync(): timeout communicating with programmer
avrdude.exe: stk500v2_recv_mk2: error in USB receive
...


Hope that this is what you asked for...

LubOlimex

This in not PDI interface.... This is 6-pin ISP interface...

PDI has only DATA and CLK signals and VCC and GND. It looks like this: https://www.microchip.com/webdoc/avrone/avrone.using_ocd_physical_pdi.html

So you have to use the AVR-ISP-MK2's 10-pin ISP connector. You need a 10-pin ISP <-> 6-pin ISP adapter cable for AVR-ISP-MKII (or use standard jumper wires). You can refer to the AVR-ISP-MKII's user's manual there is a separate chapter about such adapter. Alternatively, take a look at our adapter here: https://www.olimex.com/Products/AVR/Programmers/AVR-ICSP/

You should also search online - there are many guides describing how to convert 10-pin ISP to 6-pin ISP (search for 10-pin isp to 6-pin isp).
Technical support and documentation manager at Olimex

Auzman

Well, this would be surely an issue!  :-[
I changed the connector to ICSP10 and, using this document, I made the following connections:


ISP 6 pin | ICSP10 10 pin
1           9
2           2
3
4
5           5
6           6


and now I have the following output:

avrdude: stk500v2_command(): error in CMD_XPROG: Failed
avrdude: stk600_xprog_program_enable(): XPRG_CMD_ENTER_PROGMODE failed
avrdude: initialization failed, rc=-1
         Double check connections and try again, or use -F to override
         this check.


avrdude done.  Thank you.


I tested all the connections and they seem ok...

LubOlimex

So why pins 3 and 4 are unconnected? This leaves the ISP without SCK and MOSI... It should be like this:

ISP 6 pin (board side)| ICSP10 10 pin (MKII side)

1                       9
2                       2
3                       7
4                       1
5                       5
6                       4

This is also shown on page 22 of the user's manual here: https://www.olimex.com/Products/AVR/Programmers/AVR-ISP-MK2/resources/AVR-ISP-MK2.pdf

Also notice that plastic connectors usually have triangle that shows where the first pin is. If you can't see it search online to ensure that your orientation is correct.

Technical support and documentation manager at Olimex

Auzman

Pins 3 and 4 have been left unconnected also in the board, since the Xmega has PDI interface.
This is why I always tried to use the "PDI" connector.
Only two data pins are used for programming the microcontroller, as you can see also in this page.
PDI_DATA of the microcontroller is the MOSI of the programmer, while the PDI clock is connected to the reset pin (called on Xmega RESET/PDI_CLK).

Now I wonder if it is possible to use the Olimex programmer with a 2 pins interface...

LubOlimex

I'd test it when I can with this board: https://www.olimex.com/Products/AVR/Proto/AVR-PX128A1/

Would update when I test to let you know how the things went here.
Technical support and documentation manager at Olimex

Auzman

I checked your board schematic and I see that the connection is the very same of mine.
I wait for your tests, thank you very much!

LubOlimex

#13
It seems to work fine with Atmel Studio 7, Windows 10 x64 and the drivers that we provide. Check these two pictures:

https://imgur.com/a/cnvyeZk

I would also test with avrdude and upload pictures

Edit1: my setup can be seen here: https://drive.google.com/open?id=1j78IhAaaHpOkqmTqmIsl1kO-hiPYAa-X

Edit2: one of your errors seems like the problem this guy had: https://www.avrfreaks.net/forum/intermittant-programming-xplained-board-avrisp2?name=PNphpBB2&file=viewtopic&t=107517
Technical support and documentation manager at Olimex

LubOlimex

For AVRDUDE, the drivers shown from my previous post were not good enough! The drivers work fine only with Atmel Studio. It turns out those drivers were assigned automatically by Windows. So I had to change the drivers with the ones that we provide (https://www.olimex.com/Products/AVR/Programmers/AVR-ISP-MK2/resources/DRIVER-MK2-AS-6-7-W10.zip)

Refer to the three pictures of this album: https://imgur.com/a/N1UXipw

The hardware setup is the same as pictured in my previous post.

It is important to mention that I also tested the new drivers with Atmel Studio 7 and it also worked fine.
Technical support and documentation manager at Olimex