Page 1 of 1

Tutorial TU3 Tasks not running

PostPosted: Mon Jun 26, 2006 6:55 am
by jtnum
Using the TULite version and free libraries for initial eval
After getting the tu3 to build under:
MP-LAB IDE v7.40
MCC-18 v3.03
Using PIC18F4520

Demo1 runs and blinks Port B
Tu3, however, runs to OSSched(), as confirmed by breakpoints along the way, but breakpts at count++ in TaskCount() or InitPORT() in TaskShow() never trigger, and there is no LED activity on PortB.

I am using sfc18sna.lib.

What else do I need to do?


Re: Tutorial TU3 Tasks not running

PostPosted: Tue Jun 27, 2006 1:11 am
by jtnum
I finally figured it out.....
main() calls init(), defined in main.h, which sets INTCONbits.TMR0IE, which should not be done, since TMR0 is not being used.

The problem is resolved by deleting init() in main().

Now the LEDS show the up-counting.


Re: Tutorial TU3 Tasks not running

PostPosted: Tue Jun 27, 2006 7:22 am
by aek
General things to check:

1) Is OSTASKS in salvocfg.h set to 3?

2) Are you building without warnings?

3) Often MPLAB will not properly break on certain lines (it gets confused by macros, etc.). Ideally, add a NOP line and break on it.

4) This does not apply to tu3 -- which does not use interrupts -- but in general, applications that use interrupts have more places to go wrong. Therefore I always place a breakpoint in the beginning of main (e.g. on the call to OSInit()) to trap interrupt- and other related problems, like WDT issues.

5) Many of Salvo's services return error codes. On the PIC -- with its single working register, W -- it's very easy to examine these return codes without adding extra code. Just watch W in a watch window and break immediately after the function of interest. For tu3, if OSTASKS were still set to 1, you'd see that W is non-zero after the second and third calls to OSCreateTask().

------------------


Re: Tutorial TU3 Tasks not running

PostPosted: Tue Jun 27, 2006 8:38 am
by jtnum
quote:
Originally posted by aek:
General things to check:

1) Is OSTASKS in salvocfg.h set to 3?
It was 2, but I set it to 3
2) Are you building without warnings?
Warnings and messages are on....it builds without any errors
3) Often MPLAB will not properly break on certain lines (it gets confused by macros, etc.). Ideally, add a NOP line and break on it.

4) This does not apply to tu3 -- which does not use interrupts -- but in general, applications that use interrupts have more places to go wrong. Therefore I always place a breakpoint in the beginning of main (e.g. on the call to OSInit()) to trap interrupt- and other related problems, like WDT issues.

5) Many of Salvo's services return error codes. On the PIC -- with its single working register, W -- it's very easy to examine these return codes without adding extra code. Just watch W in a watch window and break immediately after the function of interest. For tu3, if OSTASKS were still set to 1, you'd see that W is non-zero after the second and third calls to OSCreateTask().


The WREG = 0x0A at OSCreateTask(TaskCount...
The WREG = 0x0A at OSCreateTask(TaskShow...
The WREG = 0x00 at counter = 0

PS I changed the PIC back to an 18F452 just for grins.

EX1 still works, blinking the LEDs as expected.

Still no LED activity with TU3???