Unable to connect to AVR programmer

I ordered the Pololu AVR programmer and spent a day using it, worked great. Unplugged my laptop and moved it, came back the next day and now I can’t get the programmer to work. The green LED is on and the yellow LED is blinking. AVR Studio 5 reported, “Unable to connect to tool STK500 (COM9)”

I tried rebooting the laptop and when I try to connect again with AVR Studio I get:

Started communication server.
Stk600Tool: failed to get tool properties: An error occured while executing command with ID 0x03.
Timed out waiting for a response.
Stk600Tool::getBoardProperties(AREFVOLTAGE): An error occured while executing command with ID 0x03.
Timed out waiting for a response.
Stk600Tool::getBoardProperties(CLK): An error occured while executing command with ID 0x03.
Could only write 0 of 1 bytes: Error 0x0.
GenericTool::getProperties(): An error occured while executing command with ID 0x03.
Could only write 0 of 5 bytes: Error 0x0.
GenericTool::getProperties(): An error occured while executing command with ID 0x03.
Could only write 0 of 5 bytes: Error 0x0.
GenericTool::getProperties(): An error occured while executing command with ID 0x03.
Could only write 0 of 5 bytes: Error 0x0.
GenericTool::getProperties(): An error occured while executing command with ID 0x03.
Could only write 0 of 5 bytes: Error 0x0.
GenericTool::getProperties(): An error occured while executing command with ID 0x03.
Could only write 0 of 5 bytes: Error 0x0.
GenericTool::getProperties(): An error occured while executing command with ID 0x03.
Could only write 0 of 5 bytes: Error 0x0.
GenericTool::getProperties(): An error occured while executing command with ID 0x03.
Could only write 0 of 5 bytes: Error 0x0.
GenericTool::getProperties(): An error occured while executing command with ID 0x03.
Could only write 0 of 5 bytes: Error 0x0.
GenericTool::getProperties(): An error occured while executing command with ID 0x03.
Could only write 0 of 5 bytes: Error 0x0.
GenericTool::getProperties(): An error occured while executing command with ID 0x03.
Could only write 0 of 5 bytes: Error 0x0.
GenericTool::getProperties(): An error occured while executing command with ID 0x03.
Could only write 0 of 5 bytes: Error 0x0.
GenericTool::getProperties(): An error occured while executing command with ID 0x03.
Could only write 0 of 5 bytes: Error 0x0.
GenericTool::getProperties(): An error occured while executing command with ID 0x03.
Could only write 0 of 5 bytes: Error 0x0.
09:17:15.541: [ERROR] Property not found: InterfaceProperties/IspClock
GenericTool::getProperties(): An error occured while executing command with ID 0x03.
Could only write 0 of 5 bytes: Error 0x0.
09:27:17.225: [ERROR] TCF command: Tool:connect failed: Code:1 ,Service: ,Message from peer:Could not establish communication with the tool.
09:27:17.230: [ERROR] Unable to connect to tool context: ‘Atmel.VsIde.AvrStudio.Services.TargetService.TCF.Internal.Services.Remote.ToolProxy+ToolContext’.

AVR Studio is set to use the STK500 in ISP mode on COM9. Windows device manager shows the Programming Port on COM9 and the TTL Serial Port on COM8. The Pololu USB AVR Programmer Configuration Utility communicates with the programmer with no errors.

Any suggestions?

Hello, I’m sorry you’re having trouble.

AVR Studio 5 is saying “STK600” in some of its error messages, but the programmer emulates an STK500. Is it possible you accidentally selected STK600 somewhere instead of STK500?

It looks like the AVR Studio 5 is sending commands to the port but never getting a response. Do you have any other serial ports that are assigned to COM 9? It is possible that USB-to-serial driver has messed up and switched your COM ports. Could you try connecting to COM 8? Another thing to try is changing the COM port numbers in the device manager, then unplugging the programmer, and replugging it.

–David

Thanks for the response. Before seeing your response I loaded up the programmer configuration utility and put the programmer into bootload mode. I loaded up my terminal program and reflashed the firmware, seeing the usual …|

After that I power cycled the programmer and it comes back as Pololu pgm03a Bootloader every time but doesn’t respond to anything in a terminal program or in the programmer configuration utility. I have a solid red, solid yellow, and a double blink green.

I didn’t make any changes to AVR Studio, it still shows STK500 in the Tool pulldown.

Removing the programmer from my breadboard and power cycling gives me the dual COM ports again, still can’t connect to the programmer. Went back into the AVR programming tool, flashed the firmware again (with the programmer disconnected from the breadboard), power cycled, NOW I can go into AVR programming on AVR Studio. Plug the programmer back into the breadboard and into my AVR, can’t program it, AVR Studio doesn’t recognize the programmer anymore.

Completely removed the programmer from everything, plugged in the USB cable, solid green and slow blinking red, cannot get AVR Studio to talk to it.

Thanks for trying all those things. Now, for a clean start, please try doing this:

  1. Unplug the programmer from everything.
  2. Reboot your computer.
  3. Plug the programmer into USB.
  4. Open AVR Studio 5 and try to connect to the programming port.

If that doesn’t work, then I would try to reassign the COM ports in the device manager and then do steps 1-4 again. For example you could assign the programming port to COM6 and the TTL port to some other COM number. This should allow you to connect to the programmer from AVR Studio 5.

One thing that can mess up the programmer’s COM ports is if it disconnects from USB and reconnects while a handle is open to the device. Whenever the AVR Programming dialog is open and you have clicked “Apply”, there is a handle open to the programmer. So whenever you are about to plug your programmer in, you should first close all instances of the programmer’s configuration utility and close all instances of the AVR Programming dialog box.

It’s possible that when you had the AVR Programming dialog open and plugged the programmer into the breadboard, that this caused the programmer to temporarily disconnect from USB and reconnect, messing up its COM port. I have two recommendations:

  1. If you haven’t already, turn up your sound so you can hear the sounds that Windows makes when a USB device is connected or disconnected.
  2. Try closing the AVR Programming dialog before connecting the programmer to the breadboard, and then opening it again.

–David

Powered off laptop and unplugged everything. Powered up laptop, logged into Windows, plugged the programmer USB cable in (programmer not connected to anything else). Got a solid green light and a slow blinking red light. Programmer on COM9, Serial on COM8.

Started up AVR Studio 5.1 (yes, I upgraded it), chose “STK500 on COM9” as the tool. Clicked apply and after a short delay (maybe 20-30 seconds) got a popup window that stated:

Failed to get interface clock value.
Timestamp: 2012-03-25 18:10:30.963
Severity: ERROR
ComponentId: 41000
StatusCode: 0

Property not found: InterfaceProperties/IspClock

The AVR Studio output window shows:

Communication server listening on port 49208.
Stk600Tool: failed to get tool properties: An error occured while executing command with ID 0x03. Timed out waiting for a response.
Stk600Tool::getBoardProperties(AREFVOLTAGE): An error occured while executing command with ID 0x03. Timed out waiting for a response.
Stk600Tool::getBoardProperties(CLK): An error occured while executing command with ID 0x03. Could only write 0 of 1 bytes: Error 0x0.
GenericTool::getProperties(): An error occured while executing command with ID 0x03. Could only write 0 of 5 bytes: Error 0x0.
GenericTool::getProperties(): An error occured while executing command with ID 0x03. Could only write 0 of 5 bytes: Error 0x0.
GenericTool::getProperties(): An error occured while executing command with ID 0x03. Could only write 0 of 5 bytes: Error 0x0.
GenericTool::getProperties(): An error occured while executing command with ID 0x03. Could only write 0 of 5 bytes: Error 0x0.
GenericTool::getProperties(): An error occured while executing command with ID 0x03. Could only write 0 of 5 bytes: Error 0x0.
GenericTool::getProperties(): An error occured while executing command with ID 0x03. Could only write 0 of 5 bytes: Error 0x0.
GenericTool::getProperties(): An error occured while executing command with ID 0x03. Could only write 0 of 5 bytes: Error 0x0.
GenericTool::getProperties(): An error occured while executing command with ID 0x03. Could only write 0 of 5 bytes: Error 0x0.
GenericTool::getProperties(): An error occured while executing command with ID 0x03. Could only write 0 of 5 bytes: Error 0x0.
GenericTool::getProperties(): An error occured while executing command with ID 0x03. Could only write 0 of 5 bytes: Error 0x0.
GenericTool::getProperties(): An error occured while executing command with ID 0x03. Could only write 0 of 5 bytes: Error 0x0.
GenericTool::getProperties(): An error occured while executing command with ID 0x03. Could only write 0 of 5 bytes: Error 0x0.
GenericTool::getProperties(): An error occured while executing command with ID 0x03. Could only write 0 of 5 bytes: Error 0x0.
18:10:30: [ERROR] Property not found: InterfaceProperties/IspClock
GenericTool::getProperties(): An error occured while executing command with ID 0x03. Could only write 0 of 5 bytes: Error 0x0.

Next I switched the programmer to COM14, told AVR Studio 5.1 to add an STK500 on COM14, went into AVR Programming, selected the STK500 on COM14, got “Unable to connect to tool STK500 (COM14)”

Could you try rebooting (or at least disconnecting the programmer) after changing COM port assignment? I usually find that that is necessary.

Also please try telling AVR Studio to connect to the programmer’s TTL port instead of programming port. It’s possible that the driver has accidentally switched your two COM ports.

I’d say that a 20 second delay is very long. The process of connecting to the programmer should take less than a second.

–David

Tried rebooting and connecting to COM14, no luck. Tried COM8, no luck. The Pololu USB AVR Programmer Configuration Utility still communicates fine.

You were able to connect to the programmer; a few posts ago you wrote “NOW I can go into AVR programming on AVR Studio”. Was that just a one time thing or are you able to reproduce that success? If you can reproduce it reliably, that would help us narrow down the problem.

I have another thing for you to try. Please disconnect all USB devices that create virtual COM ports from your computer, including the programmer. Close AVR Studio 5.1. Using regedit.exe, navigate to HKEY_CURRENT_USER\Software\Atmel\AVRStudio51\5.1\TargetTracker. In that registry key, you should see an entry named “UserAddedTargets”. It should look something like this:

com.atmel.avrdbg.tool.stk500,com.atmel.avrdbg.connection.serialport,,COM14;

If you have AVR Studio 5.1 configured for multiple STK500s, you would see an entry for every STK500 there. Please delete whatever is currently in that key and replace it with:

com.atmel.avrdbg.tool.stk500,com.atmel.avrdbg.connection.serialport,,\\.\USBSER000;

This tells AVR Studio 5.1 to remove all the other STK500’s you added earlier, and add a new one with the unconventional COM port name of “\.\USBSER000”. The USBSER* objects are created by Microsoft’s USB-to-serial driver usbser.sys, and the COM port names are just symbolic links to the USBSER000 objects. It’s possible that your COM ports are screwed up but the underlying USBSER* objects still work.

Now you can open AVR Studio 5.1 and try to connect to that new STK500. Let me know how it goes. Make sure you select in the “Tool” dropdown box.

I tried this on my computer and it worked.

–David

I was able to get it to connect once but when I tried to read or write anything it gave the same error and disconnected. I haven’t been able to connect since then.

Changing the registry like you suggested fixed the problem! I am now able to read the fuse settings on my microcontroller!

I’m glad you got it working. If you want to diagnose the problem with those COM ports a little more, you could get WinObj and look at the COM* objects in the “GLOBAL??” section. I’d be interested to hear what you find out, e.g. what is COM14 really pointing to? It should be pointing to USBSER000.

–David

Yup, it is, and COM8 is \Device\USBSER001

We were considering buying these programmers in bulk for a microelectronics course at our university, but this recent surprise has made us second guess moving away from the AVRISP MKii. Is there any updates on what causes this problem and how to prevent it in the future?

Unfortunately, I don’t have any updates on your problem. I believe it is a bug with the Windows USB-to-serial driver, usbser.sys, but it’s hard to know without seeing a trace of the USB traffic between the programmer and the computer.

We’ve sold thousands of this programmer over the past three years and have only had a few reports of this problem, so it seems to be very rare. I would encourage you to try the programmer on a few other computers and see if they have the same problem. It would also be useful to look at the version number of C:\Windows\System32\drivers\usbser.sys by right-clicking on it and selecting “Properties”. Let us know what you find out.

Regardless, you might want to use the USBSER000 trick at your university because it lets you avoid the hassle of setting the programmers’ COM port numbers in the Device Manager. The alternative is that whenever someone plugs a new programmer into a computer that it hasn’t been plugged into before, they would have to set the COM port number in the device manager to some standard number (e.g. COM6) that AVR Studio has been configured to use.

–David