Go Down

Topic: SOLVED: Has anyone managed to integrate ATMEL-ICE in the Arduino IDE? (Read 23219 times) previous topic - next topic

somedude

There are some threads throughout the forum on this topic, but either old or incomplete.
I would like to put together a tutorial on how to incorporate this device in the IDE, of course, if possible, so that it can be used as a reference.

What I know so far:
- avrdude 6.1 and 6.2 support it (technically)
- Windows drivers are not readily available (let me qualify that):
             - Atmel Studio presumably includes USB drivers, but that won't make the device visible to avrdude
             - in order for avrdude to "see" it, a libusb driver would be needed
             - my machine has libusb installed for my USBtinyISP, but ATMEL ICE was not detected

What I believe needs to be done next:
- sort out the driver so that avrdude can use the device
- sort out programmers.txt to include it (there is some info on that topic as well)
- try it out...

One might ask: why?
Well, this is the big kahuna programmer. Yes, expensive, more than a Mega, but it does quite a lot.
Maybe not appealing to Arduino enthusiasts because of the price, but it's definitely out there.
My reason - it does PDI programming as well, so I want to try it on my xmega.

What do you guys think?
Is this worthwhile pursuing?

Thank you.


jremington

Atmel Studio 7 supports Arduino code and programming.

somedude

Atmel Studio 7 supports Arduino code and programming.
Libraries and all?

My IDE is now set up with all the stuff I need, libraries, programmers, boards.
Since I never used AS, I thought sticking to a familiar environment would be ideal.

Plus, others would benefit from it too.

jremington


hacketet

I'm struggling to get AS7 and the Atmel ICE to talk to a Mega2560 board.  So far I've been able to program it, but no debugging capability.  A couple of web pages suggested that AVRdude should be loaded into Atmel Studio (they reference v 6.2) as an external tool, but they all reference the use of the old COMM ports - which I don't have.  I just downloaded version 6.3 of AVRdude.  In the config file it says that it supports USB ports but that's as far as I've been able to get.  No success in getting communication setup between SAS7 and the Mega board.  I did find a little exe "USB View" that provided detailed information about what was connected to each USB port, but I have no idea how to use that information. 

I have no problem purchasing a programmer if it works.  Is there a recommendation for a programmer?

hacketet

I'm struggling to get AS7 and the Atmel ICE to talk to a Mega2560 board.  So far I've been able to program it, but no debugging capability - which is critical for my application.  A couple of web pages suggested that AVRdude should be loaded into Atmel Studio (they reference v 6.2) as an external tool, but they all reference the use of the old COMM ports - which I don't have.  I just downloaded version 6.3 of AVRdude.  In the config file it says that it supports USB ports but that's as far as I've been able to get.  No success in getting communication setup between SAS7 and the Mega board.  I did find a little exe "USB View" that provided detailed information about what was connected to each USB port, but I have no idea how to use that information.  

I have no problem purchasing a programmer if it works.  Is there a recommendation for a programmer?

pert

Is this worthwhile pursuing?
I've seen several posts/issue reports from users who were fooled by the ICE programmers included with the Arduino SAMD Boards into thinking they could use them with AVR. They were very disappointed to hear this couldn't be done without updating the avrdude version and adding a programmers.txt entry for the ICE. So I think there would be interest in this. It would be great if you could install the whole package via Boards Manager and I would be willing to have a try at that part of the project if you want.

hauerdie

Hi,

I got the ICE working with the Arduino IDE, but on OSX, didn't try under Win.

A dummy kernel extension is needed and can be found here:
http://www.avrfreaks.net/comment/1421981#comment-1421981

Just changed avrdude to V6.3 and added programmers.txt info.

Code: [Select]

atmelice_isp.name=ATMEL-ICE (ISP)
atmelice_isp.program.tool=avrdude
atmelice_isp.program.extra_params=
atmelice_isp.communication=usb
atmelice_isp.protocol=atmelice_isp


Upload is working, but not burn bootloader. There seems to be an issue with writing lock bits.
Here is the error.

Code: [Select]

Writing | ################################################## | 100% 0.02s

avrdude: 1 bytes of lock written
avrdude: verifying lock memory against 0x3F:
avrdude: load data lock data from input file 0x3F:
avrdude: input file 0x3F contains 1 bytes
avrdude: reading on-chip lock data:

Reading | ################################################## | 100% 0.01s

avrdude: verifying ...
avrdude: verification error, first mismatch at byte 0x0000
         0xff != 0x3f
avrdude: verification error; content mismatch

avrdude done.  Thank you.


I was also able to debug an UNO with AR7, but I had to cut the auto reset, otherwise communication via debugWire is not possible. I guess its the same on the Mega.

somedude

For a while this post has been idle, but I can see that there is interest, so here is an update.

I was able to get avrdude 6.3 to talk to the ICE in Windows, using libusb, following the valuable instructions in THIS post.

In avrdude, once it sees the ICE, you will need to specify the programmer as -c atmelice_isp
I was able to read fuses from an m328p and an m1284p, so there is some light at the end of the tunnel.

@pert, it would be great if you could do that.
I don't mind doing the leg work and gathering info, but I am not able to do anything for the boards manager.

Here is a (sort of) working entry in programmers.txt:
Code: [Select]
atmelice.name=AtmelICE
atmelice.communication=usb
atmelice.protocol=atmelice_isp
atmelice.program.tool=avrdude
atmelice.program.extra_params=


I was able to upload the Blink sketch using AtmelICE but burning the bootloader failed at lock bits.
Still, a bit of progress.

pert

Glad to hear you're making progress! I have already successfully used Boards Manager to install a custom programmer and am happy to do the same for this process. If you think you'll be able to find a solution to the problem with Burn Bootloader I think it would be best to wait for adding Boards Manager support but I'm ready to get started whenever. Have you tried running the avrdude commands for Burn Bootloader manually from the command line to check if the lock bits issue is specific to the IDE?

somedude

Great idea, I will try it, but it may have to wait a few days, I will be tied up.

Thanks again.

somedude

SUCCESS!!!

Well, sort of, heheheh

It appears that Atmel ICE has a feature similar to the STK programmers that "dislike" unprogrammed bits to be set to 0.

As such, while trying to burn the bootloader to my Uno, lock bits and the extended fuse, which have unused bits, were failing verification.

Here is the original Arduino Uno entry in boards.txt:
Code: [Select]
uno.bootloader.low_fuses=0xFF
uno.bootloader.high_fuses=0xDE
uno.bootloader.extended_fuses=0x05
uno.bootloader.unlock_bits=0x3F
uno.bootloader.lock_bits=0x0F


Locks bits:
0x0F converts 0xCF with the two MSB unprogrammed (1)
0x3F converts to 0xFF
Extended fuse:
0x05 converts to 0xFD with the five MSB unprogrammed (1)

So my new entry in boards.txt (based on the one for Uno) has this:
Code: [Select]
unoICE.bootloader.low_fuses=0xFF
unoICE.bootloader.high_fuses=0xDE
unoICE.bootloader.extended_fuses=0xFD
unoICE.bootloader.unlock_bits=0xFF
unoICE.bootloader.lock_bits=0xCF


And it works great, uploading Blink and burning the bootloader.

pert

That's great you found the problem. It's unfortunate that it requires duplicate Board menu entries to work but it's better than nothing. I just had a look through the AVRDUDE manual hoping to find a setting that would get around this but nothing jumped out at me. So I'm starting to look into implementing the Boards Manager installation. This will consist of:
  • boards.txt with all standard Arduino AVR boards with modified fuse values
  • programmers.txt with the ICE entry
  • AVRDUDE 6.3
  • libusb driver?

So my immediate question is about the driver. Is is necessary to include a driver for the ICE? I'd like to try to make this automatically install via the post-install.bat file. I apologize in advance if I ask some dumb questions in the pursuit of this. I do have quite a bit of experience with Boards Manager(though this is the first time using tools and drivers) but I don't own an ICE so I'm at a bit of a disadvantage here.

I was able to get avrdude 6.3 to talk to the ICE in Windows, using libusb, following the valuable instructions in THIS post.
From reading that thread it appears that step is only necessary if you have the Jungo driver installed for Atmel Studio. Is that correct?

somedude

From reading that thread it appears that step is only necessary if you have the Jungo driver installed for Atmel Studio. Is that correct?
Sorry I took so long to reply.
I will try to figure it out, my machine already has Atmel Studio installed, so I can't tell.
I would have to try it on another PC and I will report back.

Thanks for all your efforts.

technix

Hi,

I got the ICE working with the Arduino IDE, but on OSX, didn't try under Win.

A dummy kernel extension is needed and can be found here:
http://www.avrfreaks.net/comment/1421981#comment-1421981

Just changed avrdude to V6.3 and added programmers.txt info.

Code: [Select]

atmelice_isp.name=ATMEL-ICE (ISP)
atmelice_isp.program.tool=avrdude
atmelice_isp.program.extra_params=
atmelice_isp.communication=usb
atmelice_isp.protocol=atmelice_isp


Upload is working, but not burn bootloader. There seems to be an issue with writing lock bits.
Here is the error.

Code: [Select]

Writing | ################################################## | 100% 0.02s

avrdude: 1 bytes of lock written
avrdude: verifying lock memory against 0x3F:
avrdude: load data lock data from input file 0x3F:
avrdude: input file 0x3F contains 1 bytes
avrdude: reading on-chip lock data:

Reading | ################################################## | 100% 0.01s

avrdude: verifying ...
avrdude: verification error, first mismatch at byte 0x0000
         0xff != 0x3f
avrdude: verification error; content mismatch

avrdude done.  Thank you.


I was also able to debug an UNO with AR7, but I had to cut the auto reset, otherwise communication via debugWire is not possible. I guess its the same on the Mega.

To debug the Mega (and Leonardo) you need to enable the JTAGEN fuse through ICSP. This reduces the available analog pins by 4.

Go Up