atprogram won't work outside the Atmel Studio directory

Go To Last Post
13 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi.

 

If I run atprogram from where it is installed (C:\Program Files (x86)\Atmel\Atmel Studio 6.2\atbackend) it works. If I copy the atbackend, devices and tools directories to another drive it fails with the following message:

 

D:\atprogram\atbackend>atprogram -t avrispmkii info
[ERROR] An unexpected error occurred when executing.
Traceback (most recent call last):
  File "__init__.py", line 50, in run
  File "atmel\avr\cli\commandline.pyc", line 77, in execute_commands
  File "atmel\avr\cli\commandexecutor.pyc", line 52, in execute_commands
  File "atmel\avr\cli\resourcemanager.pyc", line 44, in prepare_resources
  File "atmel\avr\cli\resourcemanager.pyc", line 51, in _prepare_resource
  File "atmel\avr\cli\resourcecontainers.pyc", line 49, in allocate
  File "atmel\avr\cli\backend.pyc", line 108, in start
UnicodeDecodeError: 'ascii' codec can't decode byte 0xb5 in position 12: ordinal not in range(128)

 

Any ideas? I tried copying the entire Atmel Studio folder but it didn't help.

Last Edited: Tue. Jan 20, 2015 - 02:41 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Try commenting out the "osp.codeCache" line in atbackend.properties.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I tried copying the entire Atmel Studio folder but it didn't help.

A guess but it's perhaps relying on something in the registry to tell it where to find some component (like XML files or something).

 

I'd get tools from sysinternals.com such as procexp / procmon or whichever Mark Russinovich app it is that lets you watch a program's access to the registry and see if it's relying on any key info there.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

If you put the full path of atprogram.exe into your .BAT file,   I would guess that it will all work just fine.

If you have a .BAT file in your PATH,   you can use atprogram.exe from anywhere in your filesystem

 

My Dragon seems to appear twice.   i.e. with and without its serialno (00A20000339C)

atprogram needs to know the serialno because it has found 'two' Dragons.

 

I would guess that this is just an Atmel 'feature'.

 

David.

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

ezharkov wrote:

Try commenting out the "osp.codeCache" line in atbackend.properties.

 

Thanks, didn't help unfortunately.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

clawson, I tried Process Monitor but couldn't see what the issue is. I could post the whole log but it's long...

 

David, I want to send the folder along with an automated testing app to the company that manufacturers boards for my company. I suppose I could tell them to just install Atmel Studio. I was hoping someone would have an idea though.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

mojo-chan wrote:

Thanks, didn't help unfortunately.

Well, I may have made other changes. But otherwise the whole thing seems to work without the Studio and I tried it already on several machines with different operating systems (XP, 7, 8, etc). What version of the Studio? 6.2 or or 6.2sp1? Mine is sp1. I also tried 6.1 in the past. That worked too. Commenting the osp.codeCache line was one the differences between 6.1 and 6.2sp1.

Last Edited: Tue. Jan 20, 2015 - 03:56 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thanks ezharkov. I have tried another machine and had problems with that as well.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

backend.py:108

newenv['PATH'] = workdir.encode('utf-8') + separator + newenv['PATH']

So, problem is in the workdir path or the PATH environment variable. Since the error is from the ascii codec, I would check your PATH environment variable for strange characters

 

(position 12, that's the \ after atprogram... Try change to /?)

:: Morten

 

(yes, I work for Atmel, yes, I do this in my spare time, now stop sending PMs)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Well spotted meolsen! There was a µ in the path, and removing it fixed that issue. Now I just have to figure out why it works from the command line but not when started from System.Diagnostics.Process in my app.

 

I inherited his app, written in C#. It apparently worked on XP with an older version of atprogram. I have noticed that the new version seems to have changed quite a bit. For example the app expects all the output to be on stdout, but it seems to be on stderr instead.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

This is very odd... From the command line:

 

[DEBUG] Starting execution of "program"
[DEBUG] Starting process 'D:\internal\Phocus3\LoggerATE\bin\Debug\atprogram\atba
ckend\atbackend.exe'
[DEBUG] Connecting to TCP:127.0.0.1:60567
[INFO] Connected to ispmk2, fw version: 1.17
Firmware check OK
[INFO] Firmware check OK
[DEBUG] Memory segment prog written at 0x00000000. Size = 0x00014d9c.
[DEBUG] Memory segment prog written at 0x00014d9c. Size = 0x0000086a.
[DEBUG] Memory segment prog written at 0x00020000. Size = 0x00001e46.
[DEBUG] Memory segment fuses written at 0x00000000. Size = 0x00000003.
[DEBUG] Memory segment fuses written at 0x00000004. Size = 0x00000002.
[DEBUG] Memory segment lockbits written at 0x00000000. Size = 0x00000001.
Programming and verification completed successfully.
[DEBUG] Command "program" finished with return code 0
[DEBUG] Exit successfully.

 

And from the app:

 

[DEBUG] Connecting to TCP:127.0.0.1:60554
[WARNING] Target not detected. (TCF Error code: 131118)
[WARNING] Could not create tool context. Retrying, 3 more attempts...
[WARNING] USB driver attach timed out. (TCF Error code: 1)
[WARNING] Could not create tool context. Retrying, 2 more attempts...
[WARNING] USB driver attach timed out. (TCF Error code: 1)
[WARNING] Could not create tool context. Retrying, 1 more attempts...
[ERROR] Target not detected. (TCF Error code: 131118)

So why doesn't it start the atbackend process when run from my app?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Fixed it. The solution is to add in a delay before calling atprogram. If I don't it fails.

 

The sequence I have is that I enable power to the target device, and then run atprogram. If don't wait a few seconds after turning on the target device atprogram always fails.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

hi, to help all of you struggling with programming using atprogram.  and to answer dozens of posts.

I just spent another 400 hours trying to pdi my xmegas.  4th time in my xmega life. studio 6.2 & 7.0 do nor see any tools, awful, can't use studio.

the answer is:

1.  copying 3 files to ...studio7\7.0\atbackend:

      ATxmega128A4U.atdf    change these for your micro

      ATxmega128a4udef.inc

      specs-atxmega128a4u

      don't know (and don't care 1 hoot) if all 3 have to be copied.  this solves the ERROR can't set device...

2.  use command prompt inside studio.  don't know (and don't care 1 hoot) if windows command prompt works--I am so burned out.

 

this works, doing production programming finally.

 

such a short 2 minute solution vs. 400 grieving painful hours.  shame on atmel and microchip.  shame.

<p>Vern</p>