I just spent hours for searching the reason why every dialog that needs communication with the AVR chip (AVR Programmer and debugging) gives me the message "An unknown emulator error occured."
Now I got a final solution to this problem. As I did not find any useful information on that issue yet, I'd like to share my solution with you.
If you are interested in the reasons why everything happens, just read on. For the quick readers a "solution cookbook" is at the end of this post.
The problem was: The firmware in the emulator did not fit for AVR Studio 5. As simple as it seems, as mean it is to detect this issue because the AVR Studio Firmware upgrader is lying to you. - Well actually the upgrader is keeping a secret rather than lying.
The upgrader does not tell you that it could not access necessary files for checking the emulator version. - What's the reason for that?
The upgrader trys to read the firmware archive (stored in <AS5 Installation Path>\tools\JTAGICEmkII where the install path is typically below C:\Program Files ) and opens this file requesting read and write access. Unfortunately as a normal user - especially in managed environments - you are not allowed to write anywhere in the Program Files-Folder. So the request of the upgrader is canceled by the operating system.
The upgrader now decides to not bother the user with error messages and keeps this fact as a secrett instead. The only indication you have is the fact that there is no status displayed beside your device in the list of devices the Firmware upgrader shows (nothing is displayed). But would you expect a status if you don't know that there has to be a status? - Well I didn't
So that's the whole story. What workarounds do you have? See the two possible solutions below:
A solution cookbook (1/2)
You can help the upgrader manually:
Copy the file jtagicemkii_fw.zip for the installation directory of AS5 to your "My Documents"-Folder
Start the Firmware upgrader from the "Tools"-Menu
After the upgrader detected your JTAGICE, click on the down-arrow on the right hand side of your device description (something like "JTAGICE mkII on ...")
Press the "File"-Button and choose the file jtagicemkii_fw.zip in your "My Documents" folder
The Firmware upgrader shows now a status on the right hand side of the arrow button you clicked in step 3. The status tells you if it's "Up to Date" or if an upgrade is needed or recommended.
Now you are able to upgrade your JTAG ICE mkII
Warning: You have to do this everytime you use the upgrader or refresh the list of devices as the upgrader forgets this setting.
A solution cookbook (2/2)
Change the rights for the tools folder.
Locate the tools folder of AVR Studio (in this example we assume the folder as C:\Program Files\Atmel\AVR Studio 5.0\tools\JTAGICEmkII )
Now find out what user you are or what group the users of the AVR Studio are in (We assume the group is Users here).
Open a privileged command prompt and execute the following command using the appropriate parameters for the path and the user/group:
CACLS "C:\Program Files\Atmel\AVR Studio 5.0\tools" /T /e /p Users:F
Unfortunately this workaround has a flaw too: Ever user is now able to destroy the firmware repository of the AVR Studio. But I think that's not really a problem.
I hope this helps others who are searching for a solution to this problem.