Here
goes the inicialization routine
void
init_mega32(void)
{
{
#ifndef DEGUB
MCUCSR|=0x80; // Disable JTAG
#endif
// Port A initialization
PORTA=0b00001000;
DDRA=0b00001000;
// Port B initialization
DDRB=0b00000000;
PORTB=0b00001111;
// Port C initialization
DDRC=0b10110000;
PORTC=0b10000000;
// Port D initialization
DDRD=0b11100000;
PORTD=0b00000000;
// Timer/Counter 0 initialization
// Clock source: System Clock
// Clock value: Timer 0 Stopped
// Mode: Normal top=FFh
// OC0 output: Disconnected
TCCR0=0x00;
TCNT0=0x00;
OCR0=0x00;
MCUCSR|=0x80; // Disable JTAG
#endif
// Port A initialization
PORTA=0b00001000;
DDRA=0b00001000;
// Port B initialization
DDRB=0b00000000;
PORTB=0b00001111;
// Port C initialization
DDRC=0b10110000;
PORTC=0b10000000;
// Port D initialization
DDRD=0b11100000;
PORTD=0b00000000;
// Timer/Counter 0 initialization
// Clock source: System Clock
// Clock value: Timer 0 Stopped
// Mode: Normal top=FFh
// OC0 output: Disconnected
TCCR0=0x00;
TCNT0=0x00;
OCR0=0x00;
// Timer/Counter 1 initialization
// Clock source: System Clock
// Clock value: Timer 1 Stopped
// Mode: Normal top=FFFFh
// OC1A output: Discon.
// OC1B output: Discon.
// Noise Canceler: Off
// Input Capture on Falling Edge
TCCR1A=0x00;
TCCR1B=0x00;
TCNT1H=0x00;
TCNT1L=0x00;
OCR1AH=0x00;
OCR1AL=0x00;
OCR1BH=0x00;
OCR1BL=0x00;
// Clock source: System Clock
// Clock value: Timer 1 Stopped
// Mode: Normal top=FFFFh
// OC1A output: Discon.
// OC1B output: Discon.
// Noise Canceler: Off
// Input Capture on Falling Edge
TCCR1A=0x00;
TCCR1B=0x00;
TCNT1H=0x00;
TCNT1L=0x00;
OCR1AH=0x00;
OCR1AL=0x00;
OCR1BH=0x00;
OCR1BL=0x00;
// Timer/Counter 2 initialization
// Clock source: System Clock
// Clock value: Timer 2 Stopped
// Mode: Normal top=FFh
// OC2 output: Disconnected
ASSR=0x00;
TCCR2=0x00;
TCNT2=0x00;
OCR2=0x00;
// Clock source: System Clock
// Clock value: Timer 2 Stopped
// Mode: Normal top=FFh
// OC2 output: Disconnected
ASSR=0x00;
TCCR2=0x00;
TCNT2=0x00;
OCR2=0x00;
// External Interrupt(s) initialization
// INT0: Off
// INT1: Off
// INT2: Off
GICR|=0x00;
MCUCR=0x00;
// Timer(s)/Counter(s) Interrupt(s) initialization
TIMSK=0x00;
// INT0: Off
// INT1: Off
// INT2: Off
GICR|=0x00;
MCUCR=0x00;
// Timer(s)/Counter(s) Interrupt(s) initialization
TIMSK=0x00;
// USART initialization
// Communication Parameters: 8 Data, 1 Stop, No Parity
// USART Receiver: On
// USART Transmitter: On
// USART Mode: Asynchronous
// USART Baud rate: 9600 (Double Speed Mode)
UCSRA=0x02;
UCSRB=0x18;
UCSRC=0x86;
UBRRH=0x00;
UBRRL=0x0C;
// Communication Parameters: 8 Data, 1 Stop, No Parity
// USART Receiver: On
// USART Transmitter: On
// USART Mode: Asynchronous
// USART Baud rate: 9600 (Double Speed Mode)
UCSRA=0x02;
UCSRB=0x18;
UCSRC=0x86;
UBRRH=0x00;
UBRRL=0x0C;
// Analog Comparator initialization
// Analog Comparator: Off
// Analog Comparator Input Capture by Timer/Counter 1: Off
// Analog Comparator Output: Off
ACSR=0x80;
SFIOR=0x00;
// Analog Comparator: Off
// Analog Comparator Input Capture by Timer/Counter 1: Off
// Analog Comparator Output: Off
ACSR=0x80;
SFIOR=0x00;
}
Any
ideas???
thanks
javier
-----Mensaje original-----
De: Mark Jordan [mailto:mark@cpovo.net]
Enviado el: Jueves, 03 de Febrero de 2005 12:50 p.m.
Para: AVR-Chat@yahoogroups.com
Asunto: RE: [AVR-Chat] Re: Bootup/reset very big problem
De: Mark Jordan [mailto:mark@cpovo.net]
Enviado el: Jueves, 03 de Febrero de 2005 12:50 p.m.
Para: AVR-Chat@yahoogroups.com
Asunto: RE: [AVR-Chat] Re: Bootup/reset very big problem
Could you post here your initialization routine?
I suspect your software is doing something wrong.
Mark Jordan
On 3 Feb 2005 at 9:43, Javier Fiasche wrote:
>
>
> I have:
>
> all vcc pins 5.05v
> rst pin 4.89 v
> and the device is at mega32l
>
> javier
>
>
> -----Mensaje original-----
> De: Stefan Trethan [mailto:stefan_trethan@gmx.at]
> Enviado el: Jueves, 03 de Febrero de 2005 09:24 a.m.
> Para: AVR-Chat@yahoogroups.com
> Asunto: Re: [AVR-Chat] Re: Bootup/reset very big problem
>
>
>
> On Thu, 3 Feb 2005 08:53:00 -0300, Javier Fiasche
> wrote:
>
> > As i use the external reset source (ex ISP programmer,) , i works almost
> > fine(LCd, etc works), the problem is when i remove the isp, the cpu
> > seems to halt. I am using internal clock so i cant check the
> > oscilator.If i powwer on the board withoput the isp, it never stars to
> > runThanks Javier
>
> Then check if you have 5V at the reset pin (and supply while you are at
> it) or not, please.
>
> ST
>
>
>
> Yahoo! Groups Links
>
>
>
>
>
>
>
>; ______________________________
> Visita http://www.tutopia.com y comienza a navegar más rápido en Internet. Tutopia es Internet para todos.
>
>;
>
> Yahoo! Groups Links
>
>
>
>
>
>
>
>
Visita www.tutopia.com y comienza a navegar más rápido en Internet. Tutopia es Internet para todos.