DebugWire problem with AT90PWM3B

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

Hi,
I post here after having searched the net for clues on this error without success, I will be glad if some is able and willing to help me with this showstopper.

I have seen two error messages, either DW fails to synchronize, or set parameter command failed.

HW used:

Lenovo W500 dual core 4GB ram 2.8GHz, I also tested with a Lenovo T51 dual core 2GB ram and 2.2GHz to see if the PC processer speed mattered.

AVR dragon or JTAGICE mk2 connected via USB, both with same error messages using debugwire.

The AT90PWM3B is located on yet another switch mode supply PCB I have designed and built. The 5V supply is stable, the PCB is just in this early test phase populated with a 5V supply and the AT90PWM3B running with a 16MHz crystal.

All connections has been checked and re-checked, and the reset line is clean from load, except for a 82kOhm pullup. I have also tried with another AT90PWM3B chip, same result.

SW:

I use Linux Mint 14 64 bit version on the W500, and Ubuntu 12.04 on the T51.

I have used the avarice ver. 2.10 from the repository, and I also downloaded and built avarice 2.13, which fails the same way as ver. 2.10.

What works:

I can program the fuses correctly and succesfully download a program in ISP mode, I programmed the CLKO fuse to see the system clock on the CLKO pin and blinked a LED.
I can use avrdude to program DWEN fuse to enable debugwire.
I can use avrdude to "un program" DWEN to enable ISP mode again.

What don't work:

I can in no way get debugwire to work, this is the first time I have had this persisting problem.

Let me add that I have made around 10 PCB's with tiny AVR's and small mega AVR's where I have used debug wire successfully.
I have also tested that the Dragon which does not work with the AT90PWM3B works OK with a mega328 on another PCB I have made.

So either I have turned my blind spot to the cause of this problem, or something is not good with the combination of avarice and AT90PWM3B.

I will be thankful for any help, and deliver screendumps requested by helpers.

Regards
ekh

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

Quote:
I can use avrdude to program DWEN fuse to enable debugwire.
I can use avrdude to "un program" DWEN to enable ISP mode again.
You should NOT really do either, let the debugger set and clear DW for you and follow the prompts.

But you seem to have used DW before so if it worked before it should work again. No DW experience here outside of windows unfortunately.

John Samperi

Ampertronics Pty. Ltd.

www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

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

And I have scrapped Windows 6 years ago, I have not used a post XP versions, so I have to stick to the Linux tools.

I still have a virtual machine with XP and avrstudio 4 if that can be to any help.

Are there any who have seen DebugWire work with an AT90PWM3 or AT90PWM3B, if so, did it run on a crystal or the internal RC oscillator, and what was the PC> configuration ?

I will test if DW will function if I reprogram the fuses to run from the internal RC oscillator even though the DW wire system is claimed to be independent from the processor clock.

The Ubuntu I mentioned is a 32bit version.

I wonder if this has something to do with the avarice configuration file. Any clues how to proceed ?

I have seen somewhere that the DebugWire protocol is proprietary, but as I understand it there are also clones,

If I had the protocol info, then I could debug avarice to see what fails. It will probably be a project in itself. But it seems to be the only way, if I don't get clues or help.

ekh

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

I just gave it a try, using the SVN version of AVaRICE. Hardware platform
is an STK500+STK520, using one of the early AT90PWM3 devices (that's all
I've got around here).

I can basically debug with both, the Dragon and a JTAGICEmkII. The Dragon
appears to be more flakey though (I've got situations where I could not
even program the target). The only issue I've seen is that after
disconnecting from GDB, it eventually times out, and throws a C++
exception (resulting in a coredump if your OS has not disabled coredumps).

Jörg Wunsch

Please don't send me PMs, use email if you want to approach me personally.

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

Hi Jörg,

Thank you for giving it a try :-)

I can not test before sunday evening, but then I will install the SVN version and see how much info I get with the -d option.

Are there undocumented options that makes it possible to trace the DW communication.

If so, then it can be possible to see the difference between your working DW and mine failing DW.

I have a bunch of solar modules waiting for this to succeed, so I can convert to green power for the house.

ekh

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

I do not own AT90PWM or dW dongle, but..
The AT90PWM chips have a more advanced clock tree than other AVRs. And the dW is asynchronous. Is it possible that perhaps you are tweaking the clock frequency on-the-fly?

No RSTDISBL, no fun!

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

Hi Brutle,

No I don't tweak the clock frequency on the fly, I just run off the 16 MHz crystal, I works so far that I can see the CLKO pin has a stable 16 MHz square signal, and some port pin toggling confirms the CPU runs at 16 MHz.

I can program the chip, but I can not get DW to work.

ekh

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

Windoze has Studio4 or Studio6 from Atmel.
C-SPY from IAR.
CrossStudio from Rowley.

All work fine with debugWIRE.

You can run CrossStudio as a native Linux application. It is identical to its Windows (or Mac) version.
Studio and C-SPY require you to run Windoze in a virtual machine.

In principle, avrice can run in Linux.
I doubt if any Eclipse or other IDE will compare with the Windoze debugger applications (or CrossStudio).

You just have to choose whether your dislike of Windoze triumphs over your desire to get on with your project.

David.

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

Hi David,

Thank you for the info :-)

So far avarice has worked flawlessly for me. To go on I will first try with the SVN version of avarice, which has worked for Jörg.

If it does not work for me, then I will see if the newest avrstudio is able to run DW in my virtual machine. This way I can see if it is HW or SW related.

Regarding the choice, I made it 6 years ago. Back then it cost me 2-3 weeks of work to find and test GNU/Linux replacement programs for the windows programs I used for development.

Thinking about the visionary Richard Stallman, more that 2000 hours spent on studying how the world is organized, controlled and conditioned, and now the latest exposures from Snowden which is just the tip of the iceberg, I feel comfortable with my choice of different os'es on several computers, "gogle" (extremely disgusting and very hard to avoid, probably one of the most evil and deceptive companies in the world), Apple, Sony and social media to mention a few of an almost unlimited number of choices to avoid IMHO.

Freedom and privacy does not come without a cost, and as I prefer freedom for convenience, I must pay the cost to get it working, alternatively use another processor to do the job.

The AT90PWM3 is smart because it has ADC, DAC, two amplifiers, 3 comparators and the power stages to make an almost single chip solution. But if I'm unable to get it supported by avarice, then I let it go.

Some years ago I designed and built a PCB for a TMS 320 family signal processor and bought SW development tools. When I discovered that the Windows based tools required Internet connection, I scrapped all of it.

ekh

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

List of privacy alternatives.

https://prism-break.org/

ekh

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

I have had some time for making progress.

I resized the disk partition for my virtual machine.

http://trivialproof.blogspot.dk/...!

and installed studio 6.1.

Then I updated the firmware on my jtagice II and the Dragon.

That helped to some extent, DW can not download a program to the uP but avarice can start and wait for a connection.

When a debug session starts, then it fails.

According to this link, I need the newest SVN version of avarice.

https://www.mikrocontroller.net/...

-----

I have a user interface PCB (buttons and display) I use together with the PCBs I make with low pin count uP. By using a jumper the ISP reset pin can be connected to either uP reset or another uP pin.

When fuses are programmed I have used the ISP connector for the user interface, and an extra 6 pin "ISP" connector has just GND, VCC and reset for DW.

Then the DW has been used for programming and debugging, and the ISP connector could simultaneously be used for the user interface.

I'm out of time for today, still work to do.

ekh

EDIT: Just successfully got avrdude to do the flashing via DW, so hopefully the latest SVN version of avarice will solve the debugging problem.

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

I wrote:
I do not own AT90PWM or dW dongle, but..

AFAIK:
    1. dW cannot program/erase fuse-bits/lock-bits/boot-bits. 2. dW does not work without DWEN programmed
    3. ISP does not work when the chip is in dW mode

So the only method to enter dW is to program DWEN (via ISP, HVPP,....) first and then reset to enter dW debugging.
Chip can temporarily exit dW to ISP (even with DWEN prgrammed) by 0x55+0x06 dW commands sequence so that dongle could erase DWEN with ISP/....

Don't ask why they have made it that way.
So, if you want to use dW with single wire debugging (without ISP\HVPP\... connections), you have to leave DWEN programmed all the time.

No RSTDISBL, no fun!

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

Brutte wrote:

AFAIK:
    1. dW cannot program/erase fuse-bits/lock-bits/boot-bits. 2. dW does not work without DWEN programmed
    3. ISP does not work when the chip is in dW mode

I agree.
Quote:

So the only method to enter dW is to program DWEN (via ISP, HVPP,....) first and then reset to enter dW debugging.
Chip can temporarily exit dW to ISP (even with DWEN prgrammed) by 0x55+0x06 dW commands sequence so that dongle could erase DWEN with ISP/....

Don't ask why they have made it that way.
So, if you want to use dW with single wire debugging (without ISP\HVPP\... connections), you have to leave DWEN programmed all the time.

Yes, and this is the way I have used it:

A small PCB with 2 shift registers connected to the ISP connector are used to get input from buttons and send output to a 4 x 20 character display. The ISP reset pin is after the ordinary initial fuse programming is done changed via a jumper to be connected to an ordinary pin to select between shifting and latching data in the shift registers while the uP reset is used on the other connector with GND, VCC and reset for programming and debugging with DWEN left programmed all the time.

I just experienced these hopefully temporary problems.

ekh

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

What is the URL for the SVN server with avarice sources ?

I have searched and only found released versions and old tarballs.

ekh

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

Google "avarice svn", second hit (for me), click code gives
svn checkout svn://svn.code.sf.net/p/avarice/code/trunk avarice-code

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

snigelen wrote:
Google "avarice svn", second hit (for me), click code gives
svn checkout svn://svn.code.sf.net/p/avarice/code/trunk avarice-code

Thanks alot :)

I have to my best ability blocked all the URLs belonging to google, so I can and will not search google.

I use ddg.gg (just that) to search. I normally find what i need, but in this case not.

I tried with www.startpage.com which is anonymous google search, and there it was as the second hit.

I will remember startpage next time in case I don't find what I need.

By the way try this link from ddg.gg

http://donttrack.us/

You can also find it by going to ddg.gg, click the duck image and the more at the top bar.

There are good reasons IMO not to use google as you can see using the link above, please notice the 3 extras at the bottom of the page.

ekh