This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Scheduling Simulator

Other Parts Discussed in Thread: MSP430F5438

Hey i have to make a scheduler using msp430f5438... and i am supposed to have a simulator that analyses and calculates the performance of the system.

Please can someone tell me how to go about it ?? If there are any already existing simulator softwares, that i can use ?? Or if i can design on my own ??

If it is to be designed on my own, then what language and framework would it require ??

Thanks in advance

Ankit

  • Ankit Agarwal said:
    Hey i have to make a scheduler using msp430f5438

    What kinf of scheduling? thread scheduling, event scheduling or maybe calendar-triggered code execution?
    I once dd a thread scheduler on the 5438 which supports multiple (unlimited) threads, thread sleep, thread priority and wakeup events (uart etc.). Preemptive, using the RTC clock as switching timer.
    Quite some task but after it was done, not so much code at all.
    (don't ask, it belongs to my employer, as almsot all my MSP work does)

    Ankit Agarwal said:
    and i am supposed to have a simulator that analyses and calculates the performance of the system

    Simplest case, this can be a por tpin that is toggled on entry/exit of the scheduler code,so the total 'on' time per second is the time wasted by scheduling. It only needs a digital scope to analyze it (RMS-value to port high-voltage level is the performance ratio of the scheduler)

    Of course you can go and do somethign more sophisticated in MatLab or write your own applicaiton in VisualBasic or such.

  • I have to use thread scheduling. Please suggest me ways on how to start it's implementation, m just beginning to learn this !!

    Also i know Visual C#, but i want to know if MATLAB will be more eficient ??

  • Basically, thread scheduling means interrupting a running thread, freeze it and its environment, switch to a different environment and revive the thread there.

    On MSP it means: each new thread requires its own stack area and it needs to be large enough to cover its needs, the stack requirements of all ISRs that might run, and to save all processor register contents.

    Then set up a timer-based ISR which is called in regular intervals.
    When the ISR is called, it saves all registers on the stack, saves teh stack pointer of a dedicated place that contains the thread data, loads a different stack pointer (whcih in turn switches to a different stack area), etches allr egisters from stack and returns.

    This may be expanded to keep track of sleep states (skip executing a thread for a defined time), manually triggered thread switching (so a thread may give up its remaining time i fnot needed) or waiting for specific events or messages (e.g. 'byte received').

    What you have to do depends on what you need exactly. Implementing a general-purpose thread scheduler without need is massive overkill for a microcontroller. Implement what you need for this project, and add more features if needed for a second project, maybe just conditionally compiling these features to keep the code as small and effective as possible for each project.

**Attention** This is a public forum