AVR-ISP-MK2 - Failed to enter programming mode

Started by JaNk0, November 07, 2017, 01:18:00 AM

Previous topic - Next topic

JaNk0

Hi everyone

I've tried searching the forums for answers but did manage to find any.
Recently I purchased an arduino mega 2560 and Olimex avr-isp-mk2 programmer to train my c++ programming skills.
I'm working on windows 10 pro N version with atmel studio 7 as my IDE.
The avr-programmer is flashed with the latest firmware through Flip (version AVR456-studio-AVRISP-MKII.hex).
I have followed the avr-programmer manual and also deleted Jungo drivers, only the atmel device is displayed in the device manager.

Now, the problem that I am having is that I cannot get a device read in studio. I am getting an error message saying

QuoteFailed to enter programming mode. ispEnterProgMode: Error status received: Got 0xc0, expected 0x00 (Command has failed to execute on the tool)

Unable to enter programming mode. Verify device selection, interface settings, target power, security bit, and connections to the target device.

with the details

Quote
Timestamp:   2017-11-07 00:00:50.831
Severity:      ERROR
ComponentId:   20100
StatusCode:   1
ModuleName:   TCF (TCF command: Device:startSession failed.)

Failed to enter programming mode. ispEnterProgMode: Error status received: Got 0xc0, expected 0x00 (Command has failed to execute on the tool)


I do have basic skills when it comes to Arduino and atmel studio but I've never combined them before but I figure it should to possible to flash an Arduino Mega 2560 in atmel studio 7, or at least get a device read from it.

Has anyone ever encountered this issue before ? Is there something I'm doing wrong, is it possible to flash a custom program onto mega 2560 on the Arduino circuit with the avr-isp-mk2 programmer? I'm struggling to debug this issue.

Thank you in advance

LubOlimex

#1
You didn't mention how did you establish the hardware connection. Quite likely you are using the 6-pin TPI or PDI interface connector of the programmer with Arduino Mega 2560 (since Arduino Mega 2560 has only 6-pin ISP connector). So this would not work. AVR-ISP-MK2 has only 10-pin ISP connector. You need to either use jumper wires or adapter cable.

If you have used the drivers and instructions from the manual the unit should work fine under Windows 10. Make sure you use these drivers: https://www.olimex.com/Products/AVR/Programmers/AVR-ISP-MK2/resources/DRIVER-MK2-AS-6-7-W10.zip

Also make sure the Arduino MEGA 2560 is powered.

Edit: formatting
Technical support and documentation manager at Olimex

JaNk0

Hi LubOlimex

Thank you for the fast reply!

The hardware connection was "established" using the 6-pin PDI connector. You're right, the Arduino Mega 2650 has only 6-pin ISP connector and that will explain the issues I'm having. I will try to use jumper wires or create my own adapter. The schematics is given in the manual. I will give it a try and publish my result

JaNk0

Hi again

Tried connecting jumper wires to the 10-pin ICSP connector without any success. I'm still getting the same error message when trying to get a read from the device. Are the jumpers on the avr-isp-mk2 device making any difference, that is the "TARGET" label with "on off" and "5V 3.3V" ? Is there anything else I can try before I start switching the hardware components i.e. Arduino board?

LubOlimex

The jumpers control the powering from AVR-ISP-MK2. If you power the target externally (e.g. from USB cable), keep the powering from AVR-ISP-MK2 off.

If you want to power your target from AVR-ISP-MK2 set jumper to position ON. Also depending on the target you might provide either 3.3V or 5V of voltage - check the power required and set the other jumper respectively.

Refer to chapter 5.4 Jumpers description in the user's manual. Refer to this picture: https://www.olimex.com/Products/AVR/Programmers/AVR-ISP-MK2/resources/isp-mk2-layout-connectors.png

Is there anything else I can try before I start switching the hardware components i.e. Arduino board?

A lot of things, unfortunately this is a very general error message that doesn't indicate much, and there are a lot of things that might have went wrong. Quite honestly I'd start by checking multiple times the wire connections and the power supply. It is less likely to be a driver issue. So few ideas:

1. Ensure that hardware connection is flawless. Missing MISO or MOSI or misconnecting them would lead to this error for sure.

2. Ensure that the board is powered, but make sure that you are not powering it from multiple sources.

3. Check if you have enabled debugWire by mistake and disable it (go to Debug -> Disable debugWire and Close)

4. Check the ISP clock frequency - sometimes it is too high. Set it lower value. There is a slider in Atmel Studio 7.

5. Search for similar reports with the original AVRispmkii - it might be some bug in Atmel Studio 7.

6. Refer again to the quick start section of the user's manual. If drivers and everything else at your side seems like in the pictures in the manual, then the problem is somewhere else and no need to re-install drivers.

Best regards,
Lub/OLIMEX
Technical support and documentation manager at Olimex