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.

Parents
  • I got a problem which seems to be related to yours. I think that uVision has a bug in the startup code for the signal functions.
    I use the 8.06 demo C51 version and every signal function is delayed for exact 50ms befor the are started. And it is independend from cpu speed or other parameters. For me it is not related to interrupt functions, just this 50ms delay every time i start a signal function.

Reply
  • I got a problem which seems to be related to yours. I think that uVision has a bug in the startup code for the signal functions.
    I use the 8.06 demo C51 version and every signal function is delayed for exact 50ms befor the are started. And it is independend from cpu speed or other parameters. For me it is not related to interrupt functions, just this 50ms delay every time i start a signal function.

Children