Forum: µC & Digital Electronics ATMEGA 644 on Pollin NETIO: sei leads to reset/restart

Author: Michael Haussmann (mh11)
Posted on:

Rate this post
0 useful
not useful
Hello all,

first of all: I hope that this is the correct forum, if not, please give 
me a hint.
2nd: I searched a couple of days, but did not find anything, so now, I 
need someone who likes to help me.

I run an Atmel ATMEGA 644 on a Pollin Net-I/O board and try "from 
scratch" to setup a simple timer 0 interrupt.

The code looks like this:
#include <stdint.h>
#include <avr/io.h>
#include <avr/interrupt.h> 
#include <util/delay.h>

// catch up all interrupts for which no ISR is defined

ISR (TIMER0_OVF_vect) 
  PORTC |= (1<< PC1);           // LED on
  PORTC &= ~(1<< PC1);          // LED off

// ********************** main function **************************
int main(void) {        // main function begins here

  DDRC |= (1<<PC0) | (1<<PC1); // set C.0 and C.1 as output  

  TCCR0B = 1<<CS02;
  TIMSK0 |= (1<<TOIE0);        // unmask timer0 interrupt

  sei();                       // enable interrupts 
  for (;;) {
    PORTC |= (1<<PC0);         // LED on
    PORTC &= ~(1<<PC0);        // LED off

  return (0);    // return from function main (never reached)


The strange thing is that the code after sei() is never reached, means 
the LED 0 is never blinking. If I comment out the sei() OR the TCCR0B = 
line, the LED 0 blinks.
(LED 1 stays dark in both cases)

If I try to use "external clock source on T0 Pin" (CS02 | CS01) the code 
"LED 0" is also reached, but obviously the ISR is not executed.

I also tried to configure Timer 1 with the same effect.

IMHO, the problem must be very trivial, but I don't have any clue 

I really appreciate some ideas / hints from you, TIA!

Author: Michael Haussmann (mh11)
Posted on:

Rate this post
0 useful
not useful
I set this myself to "Solved" (is there a formal way?).

As I found out today, I was a little bit confused, when I took over my 
makefile from another project (Bootloader), so this code was flashed 
into the bootloader section. Sure, interrupts in Bootloader are also 
possible, but need another interrupt tale. But, as I was using the 
"appl-interrupt table", the code could not work.

Removing the option LDFLAGS += -Ttext=E000 from the makefile did the 
trick, the code above is completely correct.

This, just that no one else uses his/her time to analyze my (phantom) 


Entering an e-mail address is optional. If you want to receive reply notifications by e-mail, please log in.

Rules — please read before posting

  • Post long source code as attachment, not in the text
  • Posting advertisements is forbidden.

Formatting options

  • [c]C code[/c]
  • [avrasm]AVR assembler code[/avrasm]
  • [code]code in other languages, ASCII drawings[/code]
  • [math]formula (LaTeX syntax)[/math]

Bild automatisch verkleinern, falls nötig
Note: the original post is older than 6 months. Please don't ask any new questions in this thread, but start a new one.