Author Topic: ATTINY167 - ATA6617 cannot drive a red led? [solved]  (Read 2224 times)

0 Members and 1 Guest are viewing this topic.

Offline mimmus78Topic starter

  • Supporter
  • ****
  • Posts: 676
  • Country: it
ATTINY167 - ATA6617 cannot drive a red led? [solved]
« on: May 22, 2013, 11:26:13 pm »
Hi all,

I'm using a ATA6617 (it's an ATA6624 + an ATTINY167 in a single package) but something happen somewhere in my workflow or to the chip.

I'm not able anymore to drive a red led (and anything else) by any of the pin in port A or B.

I'm running this program:

Code: [Select]
#define LED0_PORT               PORTA
#define LED0_PIN                DDA7
#define LED0_H          LED0_PORT |= (1 << LED0_PIN);
#define LED0_L          LED0_PORT &= ~(1 << LED0_PIN);
#define LED0_T                  LED0_PORT ^= (1 << LED0_PIN);
#define F_CPU           8000000UL

#include <avr/io.h>
#include <util/delay.h>

int main(void)
{
LED0_PORT |= (1 << LED0_PIN) ; // Set LED as output

while (1)
{
_delay_ms(333);
LED0_T; // toggle led
}
}

If I check the pin without any load with an oscilloscope it's ok. As soon as I insert the red led (with an in series 220R) the voltage at DDA7 drop from 5V to 1.6V.

It's like the GPIOs build up a high internal resistance.

ATA6624 internal regulator is ok because if I connect the led (and resistor) to the 5V output it turn on regularly (and there is no voltage drop).

Anyone can confirm that the chip failed or I'm missing something?
« Last Edit: May 23, 2013, 08:53:14 am by mimmus78 »
 

Offline senso

  • Frequent Contributor
  • **
  • Posts: 951
  • Country: pt
    • My AVR tutorials
Re: ATTINY167 - ATA6617 cannot drive a red led?
« Reply #1 on: May 22, 2013, 11:47:52 pm »
Isn't que data direction register spelled DDRA and not DDA?
Also you are not setting the pin as an output, so only enabling and disabling the internal pull-up, so what you see is perfectly normal behaviour.

DDRA |= (1<<PA7);  //Set Pin A1 as output
PORTA ^=(1<<PA7);  //Toogle pin A1.
 

Offline mimmus78Topic starter

  • Supporter
  • ****
  • Posts: 676
  • Country: it
Re: ATTINY167 - ATA6617 cannot drive a red led?
« Reply #2 on: May 22, 2013, 11:57:42 pm »
Thanks it worked ... I write code every day for living and just started with electronic.

I always thinking I'm making something wrong in the electronic part of the project but it seems to be always the bloody code.

I was thinking I fried it ...

:-)
 

Offline senso

  • Frequent Contributor
  • **
  • Posts: 951
  • Country: pt
    • My AVR tutorials
Re: ATTINY167 - ATA6617 cannot drive a red led?
« Reply #3 on: May 23, 2013, 12:17:31 am »
Great, at the start it can be a bit strange to understand everything, but with time it will all fall into place, so keep up the good work  ;)
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf