arduino with debugwire possible?

Hi,

I would like to use the debugWire of the mega328 on Arduino Ethernet to do some debugging with AVR Dragon.
I connected the ISP with the dragon and this part seems to work.
Entering debugWire looks ok, but stepping into the code (written with avrstudio and gcc) does not work.

Are modifications on the Arduino Ethernert required to make debugWire run?

Thank you
Peter

Did you enable the debug wire fuse? Iirc, you won't be able to use the bootloader.

yes, the fuses ar ok. The bootloader don't mind me at this moment because this time I will make a piece of software without all the good Arduino-stuff.
Any ideas are welcome.

If you want, I can give you a copy of optiboot which supports the debugWire being enabled - basically it allows the use of the power on flag to enter the bootloader instead of the Reset pin flag (actually both of them, so it can be used when debug wire is disabled as well).

Hello Tom,
sounds good. But will that solve my Problem?

Should the Arduino-Ethernet hardware (!) work with debugWire without any modification on the board?

Peter

The only thing likely to interfere with the debugWire is the capacitor between the DTR pin and reset. I believe somewhere on the playground there is some information about disabling the autoreset feature.

Once that is done, the only problem is that the optiboot bootloader installed on the atmega chip requires the reset pin functionality to enter programming mode. However I modified optiboot to allow simply turning the power off and on to enter programming mode, which would allow you to disable the reset pin - which is essentially what enabling the debugWire does.

Hello Tom,

i downloaded the schematic from here: http://arduino.cc/en/uploads/Main/arduino-ethernet-schematic.pdf
and it looks like you are talking about C3 (100nF). Can you confirm this?
Unfortunately my hardware knowledge are relatively underdeveloped. So I could not localize C3 on the board.
It would be great if someone can give me hint.
Thank you very much
Peter

I believe it is actually C23, next to the programming header (J4) on the schematic. It is the capacitor right next to the programming header on the circuit board.

Edit:
Correction, C3 as well you are correct. In fact from the pictures on the arduino website, C3 isn't actually soldered onto the board!

ethernet reset capacitor.png

ethernet reset capacitor.png

Tom, thank you very much for your help. J4 would be unused in my configuration because I connect the AVR Dragon on the ICSP.
Do I have to remove C23 ? or can I possible do "something" on the connector J4 ? And whats about C3?
Peter

Having set that however, I notice from the schematic that the Wiznet chip's reset is connected essentially to the Atmega chips reset, which means as you try and use debugWire, it will be constantly reseting the ethernet module. That is something which, having looked at the pcb design, cannot easily be changed.

It would require cutting a trace which would also disconnect the reset button at the same time, along with the pullup resistor on the reset pin.

I get what you are doing now. For some reason I thought you were using the J4 header. I which case if you are using an ICSP, then you don't need the modified bootloader either.

You wont need to remove C23 in this case as the debugWire is going through the ICSP header. You need to make sure that the bottom pin on J4 (closest to the ICSP header) is not connected to anything as if it were, then C23 would interfere.

You are still going to need to find a way to disconnect the Wiznet chips reset from the debugWire.

Hi Tom,

bad news for me! Looks like I cannot make the changes you developed. On the schematic I see *RESET fro wiznet is connected to RES of the CAT811. Whats about cutting PIN3 of CAT811 ? Would this make ist? And can it done more easly?

Peter

There is a trace you can cut which would require no other modification to components. The only thing you would then need is a pullup resistor on the debugWire - but that is probably included as part of you ISP programmer.

If you are careful about how you cut it, you can repair the cut later if you need to by either soldering the two parts of the trace back together, or adding a jumper wire between the via near to the cut and one of the components on the other side of the cut.

ethernet reset.png

Thanks Tom,
can you make a description of the best point to cut the line? Would be a great help for me due my little hardware-knowledge.
Peter

Thank you, I didn't saw your picture this morning, because I wasn't logged in :~
I will try to make the cut tommorow (today I am very busy ...)
The conclusion for me is, that debugWire should work anyway with the Board, but the w5100 only after making the cut?
Did I understand this right?

Peter

Pretty much yeah. There is the capacitor C3 that you noted earlier which may interfere, but if you make the cut where I suggested the C3 will be on the opposite side of the cut from the atmega which means it can't interfere.

C3 is not soldered on my board, so it could not make any problems.
But in fact, the debugwire does behave a little strange.
Variables are not always have the right contents, the programcounter
make silly steps and so on.
Still its not stable!!!! Years ago I used to use debugWire on my job and there
wasn't any problems with it.
Now shorten my ISP cable to 20cm and it looks this have a very little positiv effect.
Do you suggestions at this point Tom?
Peter

You could try adding a 1k pullup resistor from the reset pin to 5v. The debugWire is open drain, so it may not work properly if the programmer is not pulling it up.

Due to where the trace was cut, you can use the reset hole on the power connector header for your pullup resistor.

You may think the original pullup for the reset pin will work, however that was disconnected when you cut the trace (it was needed to pull up the Wiznet chips reset via the other IC).

Hi Tom,

all is working now. Thank you very much for your help. Now I could do my softwork :slight_smile:
Whats about the bootloader you recommended?

Peter

If you are using the ICSP, then you don't need a bootloader (it would be overwritten by the upload), that was just me not quite understanding what you were doing.