This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Delay until signal functions start

Anyone know why the signal functions doesn't start running directly they are started, but instead waits until the first timer tick?

I have been working with I2C in the simulator (MDK 4.04 on LPC 2119).

When I start running my application, all signal handlers are in the idle state, with a zero line number:

  0  idle     Signal = I2CMEMORY (line 0)
  1  idle     Signal = s1in_sig (line 0)
  2  idle     Signal = s1out_sig (line 0)
  3  idle     Signal = port0_sig (line 0)

After that, the program will generate a number of serial and ADC interrupts. Directly the first timer0 interrupt occurs and the code reaches the assember interrupt stub, I get the following printout from the signal handlers (the first number emitted is the number of CPU cyles processed):

2999872: port0_sig started
2999872: s1out_sig started
2999872: s1in_sig started
2999872: i2c: started

and the signal handler functions changes state to:

 -3  idle     Signal = I2CMEMORY (line 28)
 -3  idle     Signal = s1in_sig (line 84)
 -3  idle     Signal = s1out_sig (line 111)
 -3  idle     Signal = port0_sig (line 95)

The signal handlers looks like:

signal void s1out_sig(void) {
    printf("%u: s1out_sig started\n",states);
    while (1) {
        wwatch(S1OUT);
        ...
    }
}

I had the same problem when trying to run the i2c example from the book 'The Insider's Guide to the Philips ARM 7 Based Microcontrollers'. The application tried to perform i2c communication, but since the signal handler didn't start (no timer0 interrupt), all I got was a huge number of resends while waiting for an acknowledge.