AVR128DB: Why no waveform-Output TCB0>WO(PA2)

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

The TCB0 timer of an AVR128DB28 should deliver a low-frequency signal to the associated WO pin A2 (configured as output).  Problem: Nothing comes of it, the pin stays on low.  The whole thing should be done in Periodic Interrupt Mode (see screenshot of the associated data sheet passage).  What's wrong here?  The associated timer asm init code looks like this:

 

;WO enable

ldi XL,$10

sts TCB0_CTRLB,XL

 

;Load Top Value with 4000 

ldi XL,$a0

ldi XH,$f

sts TCB0_CCMPL,XL

sts TCB0_CCMPH,XH

 

;activate Timer 8/2= 4Mhz::

ldi XL,3

sts TCB0_CTRLA,XL

 

There is also no pin bent to alternative ports.

Help requested.

This topic has a solution.
Last Edited: Thu. Dec 30, 2021 - 02:49 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0


Is PA2 set in the output direction?

 

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

Yes PA2=Output. As I already wrote...

This reply has been marked as the solution. 
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

Oh, I overlooked it.
You are using periodic interrupt mode.
TCB outputs nothing except in single-shot mode and 8-bit PWM mode.

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

kabasan wrote:
TCB outputs nothing except in single-shot mode and 8-bit PWM mode.

 

Yes Kabasan, in fact, that would be an explanation...

But the description 24.3.2. Initialization (in periodic interrupt mode) reads differently.

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

It just says that the default is periodic interrupt mode.
No significant waveform is output in that mode, but PA2 is inverted by manipulating the CCMPINIT bit.
Then switch modes at your discretion.

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

kabasan wrote:
It just says that the default is periodic interrupt mode.

 

I have to disagree.

It says if using it (= periodic intertupt mode) you can optional make waveform available. That is at least highly misleading.

But thank you very much for confirming that it's not possible.

I am very disappointed with the limited TCB options.

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

Certainly, there are few TCB waveform generation variations, which is a shame for me.
It looks like it is specialized for capture behavior.
However, the DB is equipped with an event system and CCL, and can synthesize various output waveforms.
One-shot mode is also very useful in some cases.
Please don't be depressed.