Great video! Some notes for those interested in details: 1. The reason ICSP connector has red wire as NOT number 1 is that this cable combines ICSP/debugWIRE/JTAG connectors, which can also be reused as JTAG/SWD cable for debugging their ARM chips (SAM series) - you need to connect it to the SAM port on the device. So Atmel probably figured that getting pin 1 on JTAG/SWD connector correct is more important than on ICSP connector (it's really just a function of output connector's pinout, they probably figured that adding a dedicated output port for ICSP/DW is not worth the trouble). This is a small price to pay for ability to debug/program pretty much any of their chips - I used it extensively with their ATSAM4N MCUs (ARM Cortex-M4), also ATtiny841's I used for my "smart home" outdoors sensors board. I did make an SWD cable myself though (just bought 1ft of 10x0.0025" flat cable and a couple of "push-in" connectors from Mouser) as the cable that Atmel ships is way too short in my opinion. 2. This I/O window is actually THE goldmine for newer users who haven't memorized all registers and bit names/meanings as they break down registers into bit chunks (if you expand it in the lower portion of window), and if you hover bit name - short tooltip with explanation will appear. You can also CHANGE any register/value/bit you see in that window, which is very powerful for experiments - you can set I/O pins high/low, set any peripheral mode, set whatever register to whatever you think should be there (but isn't for some reason) - all of that with a simple mouse click. You might want to make a separate video on that, as there is A LOT of features, and - more importantly - it shows registers/flags/whatever for specific chip you've chosen - so it knows every single Atmel MCU/MPU chip with all their peripherals, registers, flags etc. It's incredible if you think about it for a second. This was especially helpful for me as I was working on transmitter board based on attiny841 and receiver board based on ATSAM4N at the same time, so switching between them would be quite annoying otherwise. So my advice for anyone just starting up (or starting to use a different chip) is this - write a simple "LED-blink-style" project, get into gebug mode, open IO window and just go though all registers/peripheral just to see what state they are in, what all these flags really mean, and so on. It will get you up-to-speed much faster than reading 600+ pages long datasheets (although they are also important to keep around during development just in case you need some explanation on how specific periphery is set up, or see timings diagram, or whatever else that isn't displayed inside IO window). 3. In general, Atmel Studio/Visual Studio is a VERY powerful tool, but - like many powerful tools out there - has quite a learning curve. I'm fortunate in that I've been using Visual Studio professionally at work for many years (I'm software developer), so I've jumped on Atmel Studio pretty much immediately with no issues nor learning curve whatsoever - I've felt "right at home" almost immediately. I would STRONGLY suggest anyone who plans to use VS/AS more than occasionally to learn hotkey combinations for commonly used actions - it will speed things up tremendously. I barely ever touch mouse when I work in VS as I do everything using hotkeys. But overall I gotta say I really like your style of videos - very informative, to the point with just the right amount of sidetracks just to make things more lively if I may say so. Keep this up! P.S. How's your owen project going? Can't wait to hear/see updates on that.
SUPER useful! I really like how you went through the basics of a full use case. Also, while I knew what you meant when you said 'toggle power' around 16:40, I still found the video inset visually clarifying and helpful. I can also tell that you've spent a fair amount of time getting to know visual/atmel studio and leveraging it to your advantage. We vi loyalists appreciate the tips! Keep up the great videos!
Hi, I just bought an Atmel ICE and it's been a pain till I finally had a brilliant idea. I tried to debug code on Arduino UNO R3 and I bricked 3 Atmega328 till I finally figured it out! Even though I used the steps you followed I always got an error after power cycling. It said that it failed to set the fuse and the chip is bricked or at least so I thought. Apparently it actually entered debug mode but it can't be recognized for some reason. My guess is because of the C5 cap but who knows, anyways it was an easy fix, all I needed to do is to remove the micro-controller from the socket and use it instead on a breadboard on a bare bare minimum configuration. After I configured Arduino on the breadboard without the capacitor on the PIN 1 (Reset Pin) I went back to Atmel Studio and clicked Debug -> Attack to target and It worked perfectly! Also you have to make sure that you use a 16Mhz Crystal with your micro-controller because Arduino has one built in. Without it the micro-controller won't start and it won't be recognized on the Atmel Studio. After the success I un-bricked the other micro's and now I can program them perfectly. Hope this helps anyone, also If you have any questions don't hesitate to ask. :)
Late response, but all you have to do is remove the capacitor on the reset line (C5). No need to remove the MCU. It says in the ATMEL-ICE user guide to have no capacitor here.
@@harrypehkonen Hi Harry, to wire up a 328P for Debugwire you need to use an ICSP interface. On an UNO for instance it's the 6 pin connector above the main 328P IC.....you are essesntially using SPI but there is another connection for ICSP to the reset line with a 10K pull up and diode. www.14core.com/wp-content/uploads/2015/06/14Core_Arduino_UNO1.jpg So: Copy the rightmost ICSP connection on that schematic from the to your design. That will work. BTW, You can experiment with DebugWIRE on an UNO but with a few caveats. FirstS: make sure you use a through hole 328P uno, not SMD, so if you brick your ATMEGA328P chip during debug you can just replace it vs. the entire UNO board. Also--important: Make sure to cut the reset trace, or else DebugWire won't work with an uno. Once you do you won't be able to burn ino sketches until you solder the trace back up again, but that will work as well. More detail here, go to the bottom of the post. audiodiwhy.blogspot.com/2021/02/fun-with-atmel-studio-and-burning.html
I have Atmel ICE, i hooked it up onto my board with 10pin ISP header, all pins are correct but when i try to read device i got this error: Failed 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 and connections to the target device. What is the solution? Target to program is Atmega 8.
I do not want to debug yet. I just want to programming the darn chip and you do not show that! I know I have to do some magic thing with the fuses and then press the lightning bolt thingy to program the chip but try as I may I cannot get a simple blinky program to my atmel 328p!!!
Hello Dude, thx a lot for yout perfect movie. So I figure out only the atmega328 in my opinion hast under properties->tool -> interface the option debugWIRE! Perfect. For the next time I know now what I have looking for. Thank youuuuuuu
Thank U for this video. I learned a few things like "on the header, pin 1 is always on the right of the tabs". Where did you get the diagram/datasheet you show? It is not one from the user guide of the Atmel-ICE. At 16:41 you said "and we will turn on the power for the board that you are testing on". Does that means that the Atmel-Ice does not provide the nescessary power trhough its female header pins2 and 6?I ask this because me, like many others, got an error when I tried to program the MCU. MCU is plugged in a breadboard without any other components, just the wires from the Ice header. The error message was "Failed to enter programming mode. ispEnterProgMode: Error status received: Got 0xc0, expected 0x00" "The supplied power was only 0.2V and should be between 2.7V and 5V" was the second message.I tought that the Atmel-Ice header would supply the nescessary power to the MCU because it has enough power from the PC trough the USB cable. But no, I have to supply an external power of 5V to the board to power up the MCU. i don't get it. Why does the GND and Vcc lines supply a true 5V?
The user guide does show the header pins layout on the bottom of page 15. I wouldn't say "...on the right of... " because you can look at the header in 2 different directions :) .
Dear sir, thank you for your interesting video. I have a problem when connecting the ATMEL ICE to the Arduino Mega2560: in fact, the interface "debugWIRE" is not activated: I have only ISP and JTAG!! I even disconnected the reset from the USB and the capacitor on the reset line but still the interface "debugWIRE" is not appearing in the Tool tab of the project properties. Can you please help in this issue?
Sounds like one of the fuses got messed up, did you change the fuse settings? if not you may have a bad chip, you could try a high voltage programmer to reset the fuses like the one from "mightyohm.com".
Did you ever get this sorted? Today I have installed Atmel Studio 7 hoping to use existing Arduino drivers deploying to my Mega2560. So far so good but the inevitable next step is to get a better debugging solution. I thought the ICE was going to be the answer until I saw this great video by R&D and your comments.
Wrya Monnet you might have to reload the bootloader onto your arduino to use the USB to program. When you program an arduino using an ICSP or jtag it writes over the bootloader. You'll have the bootloader on your computer in the arduino directory, use atmel studio to write it to the chip and you should be good.
The answer is simple: Atmel 2650 has no Debugwire. ;-) Look at the Atmel web site. Atmel 2560 has JTAG instead. They might have done this because Debugwire needs only one pin and so the "smaller" AVR controllers use Debugwire and the "bigger" JTAG.
I've just ordered up an Atmel Ice pcba (a barebones version of yours.) It is still in transit, so I have yet to experience the frustrations you have. In anticipation however ... You show a sheet in your video with pinouts and the little square mark. Can you provide a link to this? Thanks
Sorry, I don't remember were I got that from, but I found another that has the little square to use as a reference, hope it helps. www.avrfreaks.net/forum/really-dumb-atmel-ice-basic-question?skey=atmel%20ice%20pinout You may have to copy and past it into your browser.
Ya more Atmel Studio everyone has an arduino tutorial but I sure would like to see someone go deep into asf c code and explain exactly how a ssd1306 drives an oled display. Anyone can call a function from a library someone else wrote but what if you want to drive your own display? Even Atmel doesn't do that in their own tutorials they just go over their quickstart guides in video form.I guess I'll wander around in the Atmel c wilderness some more.Your Ice video is great !Thanks
+Bruce Ismond Thanks for the kind comments, yes it is hard to find stuff on Atmel, maybe things will change now that Microchip acquired them, we can only hope.
use step out not STEP IN before delay OR run to line and NEVER not use F_CPU in main setup cpu freq in project configuration better example mayby debug spi interface or timer ?
I want to start by saying I really appreciate your videos. However, there must be more to the basic startup than what you just showed here, so.... warning for beginners like me. I followed the steps but in my case burning the DWEN fuse failed. After it asked to re-start the device, I have no sign of life from my Nano. Trying to read the device signature gives me this: Failed 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. Timestamp: 2017-11-25 01:21:12.098 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) Searched but haven't yet found a way to fix the issue.
I understand now why Atmel_ICE does not supply the power! The reason is that some MCU uses 3.3V other 5V so it is up to us to provide the correct power.
In addition of what I wrote, the user guide never mention the need to add an external power supply to the MCU (or board). That is the reason I thought that the Atmel-ICE would provide enough power.
Enough whining about the pin one on the 6-pin connector. There are two connectors on the cable---one is a 10 pin (for the SAM programming via SWD) and the other is the 6-pin ISP you are familiar with. Some of the pins had to change position to work properly for both connectors. Just get over it. Besides, embedded programming is not a TLDR-friendly. If you don't like it, just make one with the red stripe going to pin one. I hate to think about how much you will whine about the JTAG adapter board.
Great video! Some notes for those interested in details:
1. The reason ICSP connector has red wire as NOT number 1 is that this cable combines ICSP/debugWIRE/JTAG connectors, which can also be reused as JTAG/SWD cable for debugging their ARM chips (SAM series) - you need to connect it to the SAM port on the device. So Atmel probably figured that getting pin 1 on JTAG/SWD connector correct is more important than on ICSP connector (it's really just a function of output connector's pinout, they probably figured that adding a dedicated output port for ICSP/DW is not worth the trouble). This is a small price to pay for ability to debug/program pretty much any of their chips - I used it extensively with their ATSAM4N MCUs (ARM Cortex-M4), also ATtiny841's I used for my "smart home" outdoors sensors board. I did make an SWD cable myself though (just bought 1ft of 10x0.0025" flat cable and a couple of "push-in" connectors from Mouser) as the cable that Atmel ships is way too short in my opinion.
2. This I/O window is actually THE goldmine for newer users who haven't memorized all registers and bit names/meanings as they break down registers into bit chunks (if you expand it in the lower portion of window), and if you hover bit name - short tooltip with explanation will appear. You can also CHANGE any register/value/bit you see in that window, which is very powerful for experiments - you can set I/O pins high/low, set any peripheral mode, set whatever register to whatever you think should be there (but isn't for some reason) - all of that with a simple mouse click. You might want to make a separate video on that, as there is A LOT of features, and - more importantly - it shows registers/flags/whatever for specific chip you've chosen - so it knows every single Atmel MCU/MPU chip with all their peripherals, registers, flags etc. It's incredible if you think about it for a second. This was especially helpful for me as I was working on transmitter board based on attiny841 and receiver board based on ATSAM4N at the same time, so switching between them would be quite annoying otherwise. So my advice for anyone just starting up (or starting to use a different chip) is this - write a simple "LED-blink-style" project, get into gebug mode, open IO window and just go though all registers/peripheral just to see what state they are in, what all these flags really mean, and so on. It will get you up-to-speed much faster than reading 600+ pages long datasheets (although they are also important to keep around during development just in case you need some explanation on how specific periphery is set up, or see timings diagram, or whatever else that isn't displayed inside IO window).
3. In general, Atmel Studio/Visual Studio is a VERY powerful tool, but - like many powerful tools out there - has quite a learning curve. I'm fortunate in that I've been using Visual Studio professionally at work for many years (I'm software developer), so I've jumped on Atmel Studio pretty much immediately with no issues nor learning curve whatsoever - I've felt "right at home" almost immediately. I would STRONGLY suggest anyone who plans to use VS/AS more than occasionally to learn hotkey combinations for commonly used actions - it will speed things up tremendously. I barely ever touch mouse when I work in VS as I do everything using hotkeys.
But overall I gotta say I really like your style of videos - very informative, to the point with just the right amount of sidetracks just to make things more lively if I may say so. Keep this up!
P.S. How's your owen project going? Can't wait to hear/see updates on that.
+asmi06 Thanks for the explanation, that makes sense.
SUPER useful! I really like how you went through the basics of a full use case. Also, while I knew what you meant when you said 'toggle power' around 16:40, I still found the video inset visually clarifying and helpful. I can also tell that you've spent a fair amount of time getting to know visual/atmel studio and leveraging it to your advantage. We vi loyalists appreciate the tips! Keep up the great videos!
Thanks for watching, and the kind words.
Hi, I just bought an Atmel ICE and it's been a pain till I finally had a brilliant idea. I tried to debug code on Arduino UNO R3 and I bricked 3 Atmega328 till I finally figured it out!
Even though I used the steps you followed I always got an error after power cycling. It said that it failed to set the fuse and the chip is bricked or at least so I thought. Apparently it actually entered debug mode but it can't be recognized for some reason. My guess is because of the C5 cap but who knows, anyways it was an easy fix, all I needed to do is to remove the micro-controller from the socket and use it instead on a breadboard on a bare bare minimum configuration. After I configured Arduino on the breadboard without the capacitor on the PIN 1 (Reset Pin) I went back to Atmel Studio and clicked Debug -> Attack to target and It worked perfectly! Also you have to make sure that you use a 16Mhz Crystal with your micro-controller because Arduino has one built in. Without it the micro-controller won't start and it won't be recognized on the Atmel Studio. After the success I un-bricked the other micro's and now I can program them perfectly. Hope this helps anyone, also If you have any questions don't hesitate to ask. :)
Late response, but all you have to do is remove the capacitor on the reset line (C5). No need to remove the MCU. It says in the ATMEL-ICE user guide to have no capacitor here.
Your step by step is missing step ~one. Wiring up the target board.
...which is exactly the information that I am looking for :D
@@harrypehkonen Hi Harry, to wire up a 328P for Debugwire you need to use an ICSP interface. On an UNO for instance it's the 6 pin connector above the main 328P IC.....you are essesntially using SPI but there is another connection for ICSP to the reset line with a 10K pull up and diode. www.14core.com/wp-content/uploads/2015/06/14Core_Arduino_UNO1.jpg So: Copy the rightmost ICSP connection on that schematic from the to your design. That will work. BTW, You can experiment with DebugWIRE on an UNO but with a few caveats. FirstS: make sure you use a through hole 328P uno, not SMD, so if you brick your ATMEGA328P chip during debug you can just replace it vs. the entire UNO board. Also--important: Make sure to cut the reset trace, or else DebugWire won't work with an uno. Once you do you won't be able to burn ino sketches until you solder the trace back up again, but that will work as well. More detail here, go to the bottom of the post. audiodiwhy.blogspot.com/2021/02/fun-with-atmel-studio-and-burning.html
Thank you very much for the video, it was very useful!
Hope to see some interesting future projects on Atmega microcontrollers, good luck!
+Eugen Stegura Thanks for watching and commenting.
When I plug in my Atmel-ICE, it doesn’t show up in the debugger tab; only the J-Link appears for me! Help! :)
I have Atmel ICE, i hooked it up onto my board with 10pin ISP header, all pins are correct but when i try to read device i got this error: Failed 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 and connections to the target device.
What is the solution? Target to program is Atmega 8.
i have the same problem, did you already find a solution?
Could you show me how to build the breadboard which is used together with the Atmel ICE to program the microcontroller? Thank you!
Doesn’t Atmel Studio do this natively w/o the ext ice device?
How does one debug using Atmel-ICE on a JTAG interface? I'm using the ATmega2560 which has an On-Chip circuit.
Hi, it seems I did exactly as in the video, but the debugging didn't start and the chip is bricked. What could I did wrong?
I do not want to debug yet. I just want to programming the darn chip and you do not show that! I know I have to do some magic thing with the fuses and then press the lightning bolt thingy to program the chip but try as I may I cannot get a simple blinky program to my atmel 328p!!!
Maybe this video will help you more ->ua-cam.com/video/_52r8cCf4AY/v-deo.html at 15:30
Hello Dude, thx a lot for yout perfect movie. So I figure out only the atmega328 in my opinion hast under properties->tool -> interface the option debugWIRE! Perfect. For the next time I know now what I have looking for. Thank youuuuuuu
Is there any kind of tutorial for this microcontroller coding in your channel?
Thank U for this video. I learned a few things like "on the header, pin 1 is always on the right of the tabs".
Where did you get the diagram/datasheet you show? It is not one from the user guide of the Atmel-ICE.
At 16:41 you said "and we will turn on the power for the board that you are testing on".
Does that means that the Atmel-Ice does not provide the nescessary power trhough its female header pins2 and 6?I ask this because me, like many others, got an error when I tried to program the MCU. MCU is plugged in a breadboard without any other components, just the wires from the Ice header.
The error message was "Failed to enter programming mode. ispEnterProgMode: Error status received: Got 0xc0, expected 0x00"
"The supplied power was only 0.2V and should be between 2.7V and 5V" was the second message.I tought that the Atmel-Ice header would supply the nescessary power to the MCU because it has enough power from the PC trough the USB cable.
But no, I have to supply an external power of 5V to the board to power up the MCU.
i don't get it. Why does the GND and Vcc lines supply a true 5V?
The user guide does show the header pins layout on the bottom of page 15.
I wouldn't say "...on the right of... " because you can look at the header in 2 different directions :) .
Dear sir, thank you for your interesting video. I have a problem when connecting the ATMEL ICE to the Arduino Mega2560: in fact, the interface "debugWIRE" is not activated: I have only ISP and JTAG!! I even disconnected the reset from the USB and the capacitor on the reset line but still the interface "debugWIRE" is not appearing in the Tool tab of the project properties. Can you please help in this issue?
Sounds like one of the fuses got messed up, did you change the fuse settings? if not you may have a bad chip, you could try a high voltage programmer to reset the fuses like the one from "mightyohm.com".
Did you ever get this sorted? Today I have installed Atmel Studio 7 hoping to use existing Arduino drivers deploying to my Mega2560. So far so good but the inevitable next step is to get a better debugging solution. I thought the ICE was going to be the answer until I saw this great video by R&D and your comments.
Finally I changed to the JTAG instead of the ISP. I damaged two Atmega2560 i.e. I cannot programme them using the serial port any more.
Wrya Monnet you might have to reload the bootloader onto your arduino to use the USB to program. When you program an arduino using an ICSP or jtag it writes over the bootloader. You'll have the bootloader on your computer in the arduino directory, use atmel studio to write it to the chip and you should be good.
The answer is simple: Atmel 2650 has no Debugwire. ;-) Look at the Atmel
web site. Atmel 2560 has JTAG instead. They might have done this
because Debugwire needs only one pin and so the "smaller" AVR
controllers use Debugwire and the "bigger" JTAG.
I've just ordered up an Atmel Ice pcba (a barebones version of yours.) It is still in transit, so I have yet to experience the frustrations you have. In anticipation however ...
You show a sheet in your video with pinouts and the little square mark. Can you provide a link to this? Thanks
Sorry, I don't remember were I got that from, but I found another that has the little square to use as a reference, hope it helps. www.avrfreaks.net/forum/really-dumb-atmel-ice-basic-question?skey=atmel%20ice%20pinout
You may have to copy and past it into your browser.
Okay ... thanks
How about for production mode?
Ya more Atmel Studio everyone has an arduino tutorial but I sure would like to see someone go deep into asf c code and explain exactly how a ssd1306 drives an oled display. Anyone can call a function from a library someone else wrote but what if you want to drive your own display? Even Atmel doesn't do that in their own tutorials they just go over their quickstart guides in video form.I guess I'll wander around in the Atmel c wilderness some more.Your Ice video is great !Thanks
+Bruce Ismond Thanks for the kind comments, yes it is hard to find stuff on Atmel, maybe things will change now that Microchip acquired them, we can only hope.
Newbie question. What kind of programming language is this? My best guess is that is assembly but i might be wrong. o_0 ???
It is the "C" language.
R&D Department
Thank you.
Hi ! Thanks for the good video, could you please share the document with PinOUT ?
Red is "2" in electronics (black, brown, red, orange, yellow...) which is probably why they use it that way.
use step out not STEP IN before delay OR run to line
and NEVER not use F_CPU in main
setup cpu freq in project configuration
better example mayby debug spi interface or timer ?
what about wiring ?
I want to start by saying I really appreciate your videos. However, there must be more to the basic startup than what you just showed here, so.... warning for beginners like me.
I followed the steps but in my case burning the DWEN fuse failed. After it asked to re-start the device, I have no sign of life from my Nano.
Trying to read the device signature gives me this:
Failed 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.
Timestamp: 2017-11-25 01:21:12.098
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)
Searched but haven't yet found a way to fix the issue.
....Bricked 2 nanos so far this way
I understand now why Atmel_ICE does not supply the power!
The reason is that some MCU uses 3.3V other 5V so it is up to us to provide the correct power.
In addition of what I wrote, the user guide never mention the need to add an external power supply to the MCU (or board).
That is the reason I thought that the Atmel-ICE would provide enough power.
Somebody put together some parts and make a video..... Without wiring diagram is absolutely USELESS
Enough whining about the pin one on the 6-pin connector. There are two connectors on the cable---one is a 10 pin (for the SAM programming via SWD) and the other is the 6-pin ISP you are familiar with. Some of the pins had to change position to work properly for both connectors. Just get over it. Besides, embedded programming is not a TLDR-friendly. If you don't like it, just make one with the red stripe going to pin one. I hate to think about how much you will whine about the JTAG adapter board.