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

Cannot get round-robin scheduling working

I've been trying unsuccessfully to get round-robin scheduling working under RTXTINY on an EasyKit XC164CM dev board.

I have successfully managed to get co-operative multitasking working but following the simple examples about round-robin scheduling nothing appears to work.

I've copied CPU_TIMER.INC and CONF_TNY.A66 as well as START_V2.A66 into the project folder, set-up all the targets correctly and pointed the project towards RTX Tiny kernel (in the options for the target). Inside CONF_TNY.A66 the TIMESHARING equate is left at it's default of 5 and INT_CLOCK is 2500 indicating 1ms.

The code for the program is here:

#include <RTX166T.h>
#include "hardware.h"

#define TASK_STARTUP 0
#define TASK_ATTITUDE 1
#define TASK_VEHICLESPEED 2

void task_startup(void) _task_ TASK_STARTUP
{
        // Initialise the hardware
        IO_vInit();             // Chip selects
        SSC0_vInit();           // SPI port
        ASC0_vInit();           // Serial port

        DP1L = 0x00FF;

        // Initialise the operating system
        os_create_task(TASK_ATTITUDE);
        os_create_task(TASK_VEHICLESPEED);

        os_delete_task(TASK_STARTUP);
}

void task_attitude(void) _task_ TASK_ATTITUDE
{
        while (1)
        {
                P1L = ~TASK_ATTITUDE;
        }
}

void task_vehiclespeed(void) _task_ TASK_VEHICLESPEED
{
        while (1)
        {
                P1L = ~TASK_VEHICLESPEED;
        }
}

The hardware initialisation is more or less identical to the stuff generated by DAVE and does not affect any of the timers.

The problem is that when this code is run (using either the above code which turns on LEDs indicating which task is running, or outputting stuff to the serial port over ASC0 either via the ASC0_vSendData command or through the stdio functions) the system gets locked into TASK_ATTITUDE.

Any clues as to how to solve this? I can get things working by manually switching tasks but that kind of defeats the point. Functionally the code above is the same to the ones included in the C166 examples folder.