ATtiny87 watchdog problem

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

I have a tiny87 on a small board acting as an interface between two devices, all very simple. For the sake of reliability over temperature changes it has an external crystal (8MHz).

The fuses are set to startup using the internal RC oscillator. During initialisation the code switches to the external crystal and then enables the watchdog with a 2 second timeout. The main loop resets the watchdog every time round.

Problem.

If the clock is not switched to external it works perfectly.
If it switches to the external crystal it runs but gets reset every 2 seconds.
If it switches to an external clock (from STK600) it runs but gets reset every 2 seconds.
If it switches to an external clock or crystal but does not enable the watchdog it runs ok.

The code incorporates workrounds for the errata listed in the datasheet.

The implication is that the wdr instruction no longer clears the watchdog when using an external clock but I can't believe that, it must be something I am doing wrong. I have a ticket in with Atmel but so far their only response has been to totally misunderstand the problem. Has anyone here had any issues with the watchdog or can suggest what I am doing wrong please?

Example code attached.

TVM
Glyn

Attachment(s): 

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

What's the toolchain ( ALWAYS include such info...how are we to know on our own ? ) ?

1) Studio 4.18 build 716 (SP3)
2) WinAvr 20100110
3) PN, all on Doze XP... For Now
A) Avr Dragon ver. 1
B) Avr MKII ISP, 2009 model
C) MKII JTAGICE ver. 1

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

Sorry.

AVR Studio 4 with AVR toolchain version 3.2.3.579.

Glyn

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

Quote:

During initialisation the code switches to the external crystal

[OT]Wow cool feature! I didn't know there were any tiny/mega that allowed over-ride of CKSEL at run time. If only they'd add that same CLKSELR to some of the other tiny/mega.

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

Parts of your code structure make no sense . sei() doesn't need to be done multiple times in a while loop . You sleep the MCU and right away wake it up . Why are you using parameters in the main() call, if you're not using an OS ? You should get into the habit of commenting your code for yourself and others .

How about trimming the code down to a min. that still shows the problem and just copy/paste here since it's so small .

1) Studio 4.18 build 716 (SP3)
2) WinAvr 20100110
3) PN, all on Doze XP... For Now
A) Avr Dragon ver. 1
B) Avr MKII ISP, 2009 model
C) MKII JTAGICE ver. 1

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

Ummmm I thought I had cut it down to the minimum that somebody could try to reproduce the problem.

I guess nobody has any experience of these chips in order to offer any suggestions other than to criticise my coding style. Shame. Nice chip with lots of potential but a non-functioning watchdog and no support from Atmel makes it a bit difficult to pass through to production :(

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

This has now been confirmed by Atmel. Waiting for them to see if they can come up with a workround.

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

They have said it's a silicon bug and there is no workround.

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

Thanks for keeping us updated.

--greg
Still learning, don't shout at me, educate me.
Starting the fire is easy; the hardest part is learning how to keep the flame!

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

No problem Greg.