1
\$\begingroup\$

I'm using an Attiny84 to generate 100us pulses for a totem pole gate driver. I was expecting rise and fall times in the order of 10's of nanoseconds, what I got was rise times of 7.8us (10% to 90%) and a fall times of 230us. To rule out any parasitic capacitance or odd ground loops on my board, I stuck the uC on a breadboard with just the scope probe hooked up to the pin generating the 100us pulses with the same problem occurring. There are decoupling caps across the rails.

The scope probe attenuation is 1X, 1Mohm/20pF input load.

I'm using pin 11 for the pulse generation.

Things I already tried:

 - Tried another Attiny84 IC to rule out defective chip
 - Different loads. Placing a 100kΩ pull down decreases fall times
   somewhat, but the signal only plateus to 4V instead of 5V. Placing a 10k
   resistor makes the signal entirely disappear.
 - Tried different pins, same problem.
 - Scoped 50ns rise and fall times on a completely unrelated board to rule
   out the scope as being defective.

Source code:

int main(void)
{
    DDRA &= (1<<PA2);//set pin  as output 11

    while(1){
        PORTA |= (1<<PA2); //set pin 11 high
        _delay_us(100);    
        PORTA &= ~(1<<PA2);//set pin 11 low
        _delay_ms(100);
    }

    return 0;
}

Attiny84 Datasheet: link

Am I expecting too much from the chip? The datasheet provides a minimal amount of information about the I/O pins on pg 174.

Edit: Whoops, what an embarrassing mistake. Bruce Abbott's answer is correct. Thanks.

\$\endgroup\$
  • \$\begingroup\$ Use x10 probes and calibrate them first. \$\endgroup\$ – Brian Drummond Dec 26 '14 at 14:37
3
\$\begingroup\$

The signal is very weak because you are not setting the port pin to output mode.

The line

DDRA &= (1<<PA2);//set pin  as output 11

should be

DDRA |= (1<<PA2);//set pin  as output 11
\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for?Browse other questions tagged or ask your own question.