Help on Debugger and Programmer Options

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

Hello everyone,

 

I'm just working on my first major project and also using it as a learning experience. I have decided to go down the Atmel Studio route but pop into Arduino to test basic principles.

 

I am using an ATmega 328PB, ATMega2560(I think U4) designation.

 

Anyway, I am increasingly  finding I need some form of hardware debugger and ideally a programmer. Now, I am getting really confused with all the terms used for various options and pieces of hardware from both Atmel and forums when I search what's out there - from JTAG to debugwire, dragon, ICE, SDK500, etc etc.

Unfortunately the cost of the genuine Atmel kit is prohibitive for me what with losing job and Covid,  but even if I DID have the required pennies I still cannot work out what I would buy too many options   ..... Help!!!!

 

Oh, it would be nice to have high voltage programming for fuses so which rabbit hole do I go down.

Thanks

 

 

 

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

Docara wrote:
the cost of the genuine Atmel kit is prohibitive

An  ATmega 328PB XPlained Mini is under a tenner - and includes a debugger and programmer.

 

https://www.microchip.com/DevelopmentTools/ProductDetails/atmega328pb-xmini

 

Docara wrote:
I still cannot work out what I would buy too many options 

You buy something which supports the chip(s) you're interested in.

 

Microchip list relevant tools on the Product Page for each chip.

 

https://www.avrfreaks.net/commen...

https://www.avrfreaks.net/commen...

 

Docara wrote:
it would be nice to have high voltage programming for fuses

you only need HV to recover if you've really messed up the fuses - otherwise, a normal debugger/programmer will do

 

 

EDIT

 

XPlained Mini link

 

EDIT 2

 

Recovering from fuse "mistakes": https://www.avrfreaks.net/forum/tutsoft-recovering-locked-out-avr

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
Last Edited: Thu. Oct 29, 2020 - 12:40 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

You probably want to look at "Snap" as the cheap option:

 

https://www.microchip.com/develo...

 

Another way to go is to buy "Xplained Pro" or "Xplained Mini" boards. They have a programmer/debugger on board together with some model of AVR. In some cases the same debugger can be used "off board" to debug other targets.

Oh, it would be nice to have high voltage programming for fuses so which rabbit hole do I go down.

Don't base your decision on that alone - everyone has a "chip accident"  that might require HVPP once in their lives. Usually the "cheap" solution is to discard the chip, learn by the experience and move on. Tying yourself to something that can do HVPP (like Dragon) will severely limit your options (in fact the tools that could do HVPP - STK500, Dragon, etc all seem to be obsolete anyway)

Last Edited: Thu. Oct 29, 2020 - 12:47 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Welcome to AVRFreaks!

 

Docara wrote:
I have decided to go down the Atmel Studio route but pop into Arduino to test basic principles.

Good choices!  As others have suggested, the Xplained modules give you a programmer/debugger for that type of AVR, as each family has its own way of doing things, one cheap solution will not work for all, but at

least for now, the Atmel ICE will work for all when you can afford one. 

 

Docara wrote:
e what with losing job and Covid

Learn to look for opportunities to serve others and a world will open up to you! Good luck with your search.

Let us know where your located, a freak may be near by that can help.

 

Jim

 

(Possum Lodge oath) Quando omni flunkus, moritati.

"I thought growing old would take longer"

 

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

clawson wrote:
In some cases the same debugger can be used "off board" to debug other targets.

Indeed.

 

For an example of how to "hack" an ATmega328P XPlained Mini  to do this, see:

 

https://www.avrfreaks.net/forum/low-cost-debugger-xplained-kits

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Docara wrote:
Oh, it would be nice to have high voltage programming for fuses

You can program fuses using ISP.  You do not need HVPP for that.

 

As others have said HVPP is a 'last resort' and for the cost of a programmer to support this:

 

Docara wrote:
ATMega2560(I think U4) designation.

 

Just toss the part(resoldering a fresh one is your teacher to NOT screw up LOL)

 

Cheers,

JIm

I would rather attempt something great and fail, than attempt nothing and succeed - Fortune Cookie

 

"The critical shortage here is not stuff, but time." - Johan Ekdahl

 

"Step N is required before you can do step N+1!" - ka7ehk

 

"If you want a career with a known path - become an undertaker. Dead people don't sue!" - Kartman

"Why is there a "Highway to Hell" and only a "Stairway to Heaven"? A prediction of the expected traffic load?"  - Lee "theusch"

 

Speak sweetly. It makes your words easier to digest when at a later date you have to eat them ;-)  - Source Unknown

Please Read: Code-of-Conduct

Atmel Studio6.2/AS7, DipTrace, Quartus, MPLAB, RSLogix user

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

I was looking at:

 

8bit dev boards

 

and it seems to me that something like the 328PB one at £6.84 (I guess that means $10) seems to be a very good place to start:

 

https://www.microchip.com/Develo...

 

A 328PB is a modern/utilitarian AVR and would be a good place to start learning about AVR and that on-board debugger will help a LOT!

 

EDIT: should pay more attention to 1st post - you already said 328PB (I was too focussed on 2560) so this Xmini should be perfect shouldn't it?

 

(but also take a look at Nanos and Unos on ebay from about £3 upwards (less if you can bulk buy) - sure there's no debugger but you can achieve a lot with serial printing that such boards make very easy).

Last Edited: Thu. Oct 29, 2020 - 01:06 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi

 

Thank you all for all the replies.

I think I will look over the Xplained boards, based on the feedback here with one or two £2 ebay 'specials' to fill in the gaps.

 

I think my issue is that technology is moving soo quickly these days and I no longer have an '18yr olds brain' ... I don't know which is more difficult keeping up with the new terms, different manufacturer terms for the same thing or learning the technology itself. 

 

Thanks again :-)

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

Docara wrote:
I think my issue is that technology is moving soo quickly these days
Two days ago I was using a Dragon that has got to be 10+ years old and STK500 which is 15+ so I wouldn't worry too much about things going out of fashion. While Atmel/Microchip do discontinue things they seem to have a habit of supporting them for some time after their demise and even give firmware updates to support new debug/program interfaces from time to time.

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

Two main choices:

 

1.  Buy a SNAP, Pickit4, ATMEL-ICE.   Will debug all AVR and ARM devices.   SNAP is cheap.

2.  Buy a XMINI or XPRO board.   Do everything with one USB cable.

 

I like the idea of everything on one USB cable.

  

The SNAP, ... solution involves extra USB cable and ribbon connector.   (you have to make your own ribbon for the SNAP)

And is more future proof.

 

David.

Last Edited: Thu. Oct 29, 2020 - 01:33 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi David

 

I like the look of the Xmini, I don't suppose you know if this could be used with other devices with a bit of 'Heath Robinson esq'  work? I'm thinking akin to the way STM developments do 

 

 

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

david.prentice wrote:
XMINI or XPRO board.   Do everything with one USB cable

Note that includes a (virtual) COM port.

 

Docara wrote:
I don't suppose you know if this could be used with other devices

It can be used with other devices which use the debugWire connection - see #5

 

Docara wrote:
I'm thinking akin to the way STM developments d

Not quite sure what you're alluding to there?

 

If you're talking about STM32, they are ARM Cortex-M - so they use the ARM standard SWD connection

 

debugWire is an Atmel (now Microchip) proprietary connection; it is used on only some AVR products - and not on any other manufacturer's products.

 

 

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Yes,  you can use an Xmini-328 on another debugWIRE target.   But it is a bit of f*rting about.   And the Xmini debug chips are SLOW.

 

The XPRO debug chips are FAST.   I don't know if they handle all ARM SWD, JTAG, PDI, UPDI, ... protocols or just the protocol used by the specific target board.

 

SNAP, PK4, ATMEL-ICE handle all protocols and are all fast.   Have input voltage protection.

If you use XMINI on an external target you must be more careful with wiring,  voltages etc.

 

David.

Last Edited: Thu. Oct 29, 2020 - 02:46 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Yeah some STM development boards have what seems to be a breakoff section that can be used as a standalone programmer. 

 

XMINI PB 329PB - £7 directly from Microchip free postage delivered Monday - sold! 

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

If you are in the UK and have a Farnell account,   your order would arrive tomorrow.  (if you order before 20.00 today)

 

Yes,  you can use the SWD debugger from an ST Nucleo on different manufacturer Arm Cortex chips.

But proprietary software like AS7.0 will not support it.

 

Keil, Rowley, ... will let you use the ST debugger on Microchip/Atmel ARM chips.

Obviously none of this applies to an AVR with debugWIRE.

 

David.

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

Docara wrote:
(I think U4)
A USB megaAVR?  (ATmega32U4 are popular and in several Arduino)

If yes then factory or Arduino or PJRC bootloaders; so, loaders therefore no programmer required and can debug by other means.

AVR simulator in Atmel Studio is complete so can debug some (most?) AVR code on a Microsoft Windows.

Docara wrote:
Unfortunately the cost of the genuine Atmel kit is prohibitive for me ...
The ones at Waveshare recognize that issue and have repackaged Atmel-ICE with extras.

Docara wrote:
Oh, it would be nice to have high voltage programming for fuses so which rabbit hole do I go down.
MPLAB PICkit 4 has 12V programming, has been tested for most AVR including mega328PB and mega2560, and is in Atmel Studio 7 though I haven't tried that debugger (yet to acquire a MPLAB PICkit 4)

 

P.S.

Docara wrote:
... what with losing job and Covid, ...
Similar pain here due to USA/STATE OF/CITY OF COVID-19 responses; if one has an essential job then usually good to go otherwise a struggle.

 


Microchip - USB DFU via Atmel FLIP (loader)

New and Noteworthy | Atmel Studio 7

...

 

Atmel Studio 7.0.582

...

  • Support for Flip-compatible bootloaders in atprogram and programming dialogue. The connected device appears as a tool.

...

Arduino - USB CDC

PJRC - USB HID, HalfKay bootloader :

HalfKay Communication Protocol | PJRC

 

Atmel-ICE - Waveshare Wiki

East :

Atmel ICE C Kit Powerful development tool for debugging and programming Atmel SAM and AVR microcontrollers ATMEL ICE PCBA inside-in Demo Board from Computer & Office on Aliexpress.com | Alibaba Group

West :
Cost Effective Original Atmel-ICE-C Kits PCBA Inside Debugger Supports JTAG SWD | eBay

 

MPLAB PICkit 4 In-Circuit Debugger

PICkit 4 - Waveshare Wiki

 

"Dare to be naïve." - Buckminster Fuller

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

awneil wrote:
Microchip list relevant tools on the Product Page for each chip.
also listed with MPLAB X.

Unaware of such for Atmel Studio though the data is in the XML.

 

Device Support | MPLAB X IDE v5.40

 

         <device Dname="ATmega328PB">
...
                  <at:interface type="isp" name="ISP"/>
                  <at:interface type="hvpp" name="HVPP"/>
                  <at:interface type="dw" name="debugWIRE"/>
                  <at:tool id="com.atmel.avrdbg.tool.medbg"/>
                  <at:tool id="com.atmel.avrdbg.tool.atmelice"/>
                  <at:tool id="com.atmel.avrdbg.tool.pickit4"/>
                  <at:tool id="com.atmel.avrdbg.tool.avrdragon"/>
                  <at:tool id="com.atmel.avrdbg.tool.ispmk2"/>
                  <at:tool id="com.atmel.avrdbg.tool.jtagicemk3"/>
                  <at:tool id="com.atmel.avrdbg.tool.snap"/>
                  <at:tool id="com.atmel.avrdbg.tool.edbgc"/>
                  <at:tool id="com.atmel.avrdbg.tool.edbg"/>
                  <at:tool id="com.atmel.avrdbg.tool.avrone"/>
                  <at:tool id="com.atmel.avrdbg.tool.jtagice3plus"/>
                  <at:tool id="com.atmel.avrdbg.tool.powerdebugger"/>
                  <at:tool id="com.atmel.avrdbg.tool.edbg"/>
                  <at:tool id="com.atmel.avrdbg.tool.stk600"/>
                  <at:tool id="com.atmel.avrdbg.tool.jtagicemkii"/>
                  <at:tool id="com.atmel.avrdbg.tool.stk500"/>
                  <at:tool id="com.atmel.avrdbg.tool.simulator"/>
                  <at:property name="com.atmel.avrdbg.tool.simulator.key" value="ATmega328PB"/>
                  <at:property name="com.atmel.avrdbg.tool.simulator.model.win32" value="simulator/win32/libatmegakpb.dll"/>
                  <at:property name="com.atmel.avrdbg.tool.simulator.model.linux64" value="simulator/linux64/libatmegakpb.so"/>

copied from http://packs.download.atmel.com/#collapse-Atmel-ATmega-DFP-pdsc (unzip the download, open .pdsc)

 


https://www.avrfreaks.net/forum/come-join-us-mplab-now-supports-avrs?page=6#comment-3020136

 

"Dare to be naïve." - Buckminster Fuller

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

clawson wrote:
(in fact the tools that could do HVPP - STK500, Dragon, etc all seem to be obsolete anyway)
STK500 is still in production; STK600 likewise.

STK500 | Microchip Technology

ISP Programming | STK600 AVR® Flash MCU Starter Kit User's Guide

 

"Dare to be naïve." - Buckminster Fuller

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

awneil wrote:
debugWire is an Atmel (now Microchip) proprietary connection; ...
debugWIRE has been "reversed".

awneil wrote:
it is used on only some AVR products - ...
The follow-on to debugWIRE is UPDI; both have inexpensive third party tools.

 


debugWIRE via USB UART | AVR Freaks

dwire-debug has an AVR GDB server; the GDB client in Atmel Studio 7 is mostly complete with significantly more coverage soon.

MPLAB Snap and atbackend | AVR Freaks

 

Standalone mEDBG UPDI programmer and issues with Avrdude | AVR Freaks

 

"Dare to be naïve." - Buckminster Fuller

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

david.prentice wrote:

If you are in the UK and have a Farnell account,   your order would arrive tomorrow.  (if you order before 20.00 today)

 

A quick whinge, if I may. Farnell UK have recently increased their minimum order value for free delivery from £20 to £30 +VAT for non-trade accounts. Having avoided RS, Mouser and Digikey for the last few years, I am now regularly comparing my baskets, although today's order still went to Farnell. I s'pose it couldn't last forever and I'll just have to be a little more organised from now on.

 

I would recommend the OP also look at AVR-DA, now that there is a AVR128DA48 Curiosity Nano board available (£9 +VAT). There is also a working Arduino core, and it's a luxury not having to jump through hoops to fit code into 2K of SRAM.

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

obdevel wrote:
Farnell UK have recently increased their minimum order value for free delivery from £20 to £30 +VAT for non-trade accounts.

On a trade account, it's easy to set up an alternative delivery address.

 

If you want to drop me a PM, maybe I could order for you - for delivery to your address ... ?

 

Similarly RS.

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

obdevel wrote:
Farnell UK have recently increased their minimum order value for free delivery from £20 to £30 +VAT
As someone with very limited hardware needs I don't even bother to look at the big distros like Farnell, Arrow, Element14, RS, etc because of things like min order. I find companies like BitsBox, CoolComponents, Pimroni, PiHut (yup even for AVR!), HobbyTronics to be far better prospect even if things are a few pennies more. You can make a lowly £2.73 order, pay about £1 postage and have it arrive the following day from most of these (1st class post is actually pretty good).