Leaving dW enabled?

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

Is there any down side to leaving debugwire enabled after I am done with development? E.G. will it run more slowly or be more prone to problems?

I had intended to use a socket for the CPU, but in the final layout, there is not enough clearance above the cpu for a socket.

-Tony

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

Yes. It uses more power.
There is an (unlikely) possibility of noise giving an extraneous dW command.

Simply disable dW when you are finished debugging.

David.

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

Quote:
E.G. will it run more slowly or be more prone to problems?

There is a remark in the datasheet to avoid such situations.
Quote:
Simply disable dW when you are finished debugging.

That is, you must toggle DWEN fuse-bit some way. Sending 0x06 will also disable dW, but only till the next reset.

No RSTDISBL, no fun!

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

When Studio tells the chip to reset the DWEN fuse, is that instruction given by debugwire, or is it done by SPI? In other words, do I need more wires than just the dW pin, +5v, and Gnd? When I have cleared dW mode in the past, I had the chip completely hooked up for serial programming, and in a socket.

In this case, the chip (M328) will be soldered in a board, and it will not be serial programmable.

I am not too worried about sleep modes. When the program decides to go to "sleep", it will switch off its own power supply and will require an external button press to reactivate the power supply.

-Tony

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

Quote:
do I need more wires than just the dW pin, +5v, and Gnd?
Yes, you need the FULL ISP header wired up.
Quote:
In this case, the chip (M328) will be soldered in a board, and it will not be serial programmable.
So how do you plan to program the chip? How about the "inevitable???" upgrade or bug fix?

John Samperi

Ampertronics Pty. Ltd.

www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

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

Spamian is working on the basis that if he contradicts the data sheet for long enough, somehow a silicon chip will behave in the way that he wants.

I would put money on his approach failing, but hey-ho, that is what he wants to do.

David.

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

Spamiam wrote:
When Studio tells the chip to reset the DWEN fuse, is that instruction given by debugwire, or is it done by SPI?

AFAIK you cannot write fuses through dW. I am not sure about read. You must use some other programming interface to do that. Indeed, ISP is one of the choices.

No RSTDISBL, no fun!

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

AVRs can read their own fuses in software. Look at the avr-gcc
You cannot change the fuses via software, nor by the debugWire interface.

You must use SPI, HVPP, HVSP to alter fuses.

David.

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

Just to be sure, if I am running the chip in dW mode while soldered-in on the target board, and without the ability to do ISP programming, then I can not permanently exit dW mode. But I can programmatically turn off dW until the next re-boot?

I might have some code in the boot section to read EEPROM to see if the main program wanted to turn off dW. If so, the "bootloader" can disable dW, and if not, then it will leave dW enabled. Probably this will not be a big issue and I will try leaving dW enabled,and only disable it if necessary.

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

david.prentice wrote:
Spamian is working on the basis that if he contradicts the data sheet for long enough, somehow a silicon chip will behave in the way that he wants.

HAHAHAHA! Actually, I did not intentionally contradict ANYTHING. I think I was always asking questions, or posing a hypothetical scenario and trying to get clarification of what the outcome will be.

Interestingly, Studio says that after having successfully entered dW mode, that the ISP wires can be removed. It does not say anything about replacing them when it comes time to disable dW. I suppose that they assume you know to do so, but then why tell me to remove the wires? If I am smart enough to know that I need to replace the ISP wires, then why do I need to be instructed to remove them????

as for the question of how do I program the chip in the first place if it is soldered in a location not compatible with ISP: I will program it first, and enable dW. Hopefully it will still work when soldered in place! I have access to the RESET pin as well as VCC and Gnd. SO I can continue to use dW for modifications. It appears that I can't deactivate dW permanently on thie target blard....

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

If you leave no access to the SPI pins, no, you can't disable the DWEN fuse.

Normally you would use debugWire for debugging. Then manufacture products with the debugged firmware.

If it is only a hobby project, leave it in debugWire mode forever. So what if it gets upset? It probably won't.

OTOH, if you sell 100k units that start failing, you will have some upset customers.

If you envisage field updates, install a bootloader.
If you are going to do every update personally, make an ISP jig with pogo pins.

David.

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

Yes, this is a hobby project (ESR meter based on the Bob Parker design), though I will probably be uploading the entire thing as a project here. I could make an ISP jig, but I am not sure how the ISP signals would interract with the hardware attached to those pins. It would be interesting to make the pogo pin jig just to see if I can do it!

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

You can normally arrange your GPIO to co-exist with ISP. It is only the MISO pin that is a little fussy.

I could not find the schematic.

I presume that it already has perfectly good firmware, so you probably have no need for debugWire.

David.

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

A bit of a warning about leaving DW enabled: the chip MAY NOT start correctly at power up I have seen it happen at times.

And, as you don't have a reset pin anymore, make sure that the BOD is set correctly to provide a good power on reset.

If you are using a bootloader FORGET about DW, simply program the bootloader and all the fuses before you solder the chip into the board. I'm guessing from above that you are using DIP packages?

Quote:
I had the chip completely hooked up for serial programming, and in a socket.

John Samperi

Ampertronics Pty. Ltd.

www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

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

js wrote:
A bit of a warning about leaving DW enabled: the chip MAY NOT start correctly at power up I have seen it happen at times.

And, as you don't have a reset pin anymore, make sure that the BOD is set correctly to provide a good power on reset.

If you are using a bootloader FORGET about DW, simply program the bootloader and all the fuses before you solder the chip into the board. I'm guessing from above that you are using DIP packages?

Quote:
I had the chip completely hooked up for serial programming, and in a socket.

Yes, I am using DIP packages. I am using almost all of the pins, and I do not have the USART pins available. Also, I am not using an external crystal, so even being ABLE to use USART is in question. That being said, I had been doing initial development with a bootloader, and the 8MHz internal oscillator, and it was working OK. I would continue to use the USART/Bootloader if I could.

I will be having the BOD set for 4.x volts, and I will have the longest delay possible on the start-up.

-Tony

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

I have used a zif socket on some veroboard with proper bypass caps and power supply to pre-program chips used in the past for boards that did not have ISP headers.

Do you have room for the header? Even if you have "run out ot pins" you can still use the SPI pins for programming AND your other components. Do it all the time. :-)

John Samperi

Ampertronics Pty. Ltd.

www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

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

js wrote:
Do you have room for the header? Even if you have "run out ot pins" you can still use the SPI pins for programming AND your other components. Do it all the time. :-)

Well, I am using a stripboard instead of a custom PCB. Everything is a tight fit as it is, so there isn't really room for a header, but as mentioned above, pogo pins might do the trick. From the bottom. There is an LCD screen directly over the CPU, hence the inability to use a socket for the CPU,. I had intended initially to use a socket for the CPU, but then I had to change that plan.

-Tony