Anyone done dead time with tiny25 family?

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

An app driving an H-bridge driver is having problems with apparent shoot-through with a normal complementary signal.  So I thought of using Tiny25 as it has the complementary outputs and dead-time insertion.  (Is this the least expensive AVR model with those features?  About $1 for Tiny25; is there an Xmega less expensive?)

 

We've never used the dead-time before.  Can anyone post a code snippet or point to links?  Thanks.

 

[edit] The app is to generate a (accurate as practical) 512Hz  complementary square wave that is used for push-pull excitation signal.  A CTC job, but it appears dead-time insertion is only for PWM?

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.

Last Edited: Wed. Jan 28, 2015 - 05:09 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

It appears to be straightforward.  CodeVision Wizard [apparently] doesn't have support for it, so I jammed in some test values for dead time:

// Timer/Counter 1 initialization
// Clock source: System Clock
// Clock value: 125.000 kHz
// Mode: PWMA top=OCR1C
// OC1A output: OC1A=PWM, /OC1A=/PWM
// OC1B output: Disconnected
// Timer Period: 1.952 ms
// Output Pulse(s):
// OC1A Period: 1.952 ms Width: 0.98002 ms
// Timer1 Overflow Interrupt: Off
// Compare A Match Interrupt: Off
// Compare B Match Interrupt: Off
PLLCSR=(0<<PCKE) | (0<<PLLE) | (0<<PLOCK);

TCCR1=(0<<CTC1) | (1<<PWM1A) | (0<<COM1A1) | (1<<COM1A0) | (0<<CS13) | (1<<CS12) | (0<<CS11) | (0<<CS10);
GTCCR=(0<<TSM) | (0<<PWM1B) | (0<<COM1B1) | (0<<COM1B0) | (0<<PSR1) | (0<<PSR0);
TCNT1=0x00;
OCR1A=0x7A;
OCR1B=0x00;
OCR1C=0xF3;

// Dead time
DTPS1 = (0<<DTPS10) | (0<<DTPS11); // /1 prescaler on dead time
DT1A = (1<<DT1AH1) | (1<<DT1AH0) | (1<<DT1AL1) | (1<<DT1AL0); // 3 timer counts

 

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.

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

It looks scary, but is pretty simple really.   Just setup your pwm for the freq. you want, then set the DT reg for the DT time needed to save your outputs.

You have 16 DT's to choose from, with I think 16 pre-scales also.   Start small and work your way up to what works.

 

 

Jim

 

 

 

 

Keys to wealth:

Invest for cash flow, not capital gains!

Wealth is attracted, not chased! 

Income is proportional to how many you serve!