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.

RTOS/TMS320F28377D: How to make 30us priod timer interupt using sys/bios??

Part Number: TMS320F28377D
Other Parts Discussed in Thread: SYSBIOS, TMS320F28379D

Tool/software: TI-RTOS

hi

I using TMS320F28377D IC.

I want make timer ISR.

but  I can't make 30us(micro) TIMER in SYS/BIOS.

var Timer = xdc.useModule('ti.sysbios.family.c28.Timer');
var timerParams = new Timer.Params();
timerParams.startMode = Timer.StartMode_AUTO;
timerParams.runMode = Timer.RunMode_CONTINUOUS;
timerParams.period = XXXX;
timerParams.periodType = xdc.module("ti.sysbios.interfaces.ITimer").PeriodType_COUNTS;
var myTimer = Timer.create(0, '&myTickFxn', timerParams);

the result of an experiment

period  10000 -> 4ms

            5000 -> 2ms

            500 -> 200us

           100 ->100us

           50 -> 100us

I can't not understand.

I using 200MHZ IC.

i think "1Count = 5ns"

Is there a limit?

How to make  30us priod timer interupt using sys/bios??

Already make no-os system.

It works well. 30us

  • Hi Yeonseok,

    What do you need the timer for? Does it need to call a kernel API (e.g. Semaphore_post). If it does not, I'd use a zero-latency Hwi (the kernel adds zero latency). You can get more details about zero latency Hwis here: processors.wiki.ti.com/.../BIOS_for_the_28x

    Note: you'll basically be using the same code as your no-os version, except you need to tell the kernel that this interrupt is plugged, but the kernel should not do anything with it.

    Todd
  • I want using sys/bios, and timer(30us).

    i try your guide (zero latency Hwis here: processors.wiki.ti.com/.../BIOS_for_the_28x)

    but error  (ti.sysbios.family.c28.Hwi.Instance#0 : Hwi 38 conflicts with IER Mask 0x1 .xdchelp /swi28_TMS320F28379D line 259 C/C++ Problem)

    I can't make that.

    Could you provide sample code of 30us priod timer interupt using sys/bios?

    thank you

  • Can you post the code to setup the timer? I'm not familiar with the device enough to do that myself. I can show you how to bundle it into a zero-latency interrupt though.

    Todd
  • My code is base on SYS/BIOS sample code, TMS320F28379D ,28x Specific Examples, Task Example.

    Just modified Hwi.zeroLatencyIERMask = 1;

  • I'm working on an example. You cannot just set Hwi.zeroLatencyIERMask = 1. You also need to use Hwi_plug and configure the timer.
  • I don't know how to set Hwi_plug and configure the timer

    could you fix my cfg file?

    var Defaults = xdc.useModule('xdc.runtime.Defaults');
    var Diags = xdc.useModule('xdc.runtime.Diags');
    var Error = xdc.useModule('xdc.runtime.Error');
    var Log = xdc.useModule('xdc.runtime.Log');
    var LoggerBuf = xdc.useModule('xdc.runtime.LoggerBuf');
    var Main = xdc.useModule('xdc.runtime.Main');
    var SysMin = xdc.useModule('xdc.runtime.SysMin');
    var System = xdc.useModule('xdc.runtime.System');
    var Text = xdc.useModule('xdc.runtime.Text');

    var Hwi = xdc.useModule('ti.sysbios.family.c28.Hwi');

    /*
     * Uncomment this line to globally disable Asserts.
     * All modules inherit the default from the 'Defaults' module.  You
     * can override these defaults on a per-module basis using Module.common$.
     * Disabling Asserts will save code space and improve runtime performance.
    Defaults.common$.diags_ASSERT = Diags.ALWAYS_OFF;
     */

    /*
     * Uncomment this line to keep module names from being loaded on the target.
     * The module name strings are placed in the .const section. Setting this
     * parameter to false will save space in the .const section.  Error and
     * Assert messages will contain an "unknown module" prefix instead
     * of the actual module name.
    Defaults.common$.namedModule = false;
     */

    /*
     * Minimize exit handler array in System.  The System module includes
     * an array of functions that are registered with System_atexit() to be
     * called by System_exit().
     */
    System.maxAtexitHandlers = 4;      

    /*
     * Uncomment this line to disable the Error print function. 
     * We lose error information when this is disabled since the errors are
     * not printed.  Disabling the raiseHook will save some code space if
     * your app is not using System_printf() since the Error_print() function
     * calls System_printf().
    Error.raiseHook = null;
     */

    /*
     * Uncomment this line to keep Error, Assert, and Log strings from being
     * loaded on the target.  These strings are placed in the .const section.
     * Setting this parameter to false will save space in the .const section.
     * Error, Assert and Log message will print raw ids and args instead of
     * a formatted message.
    Text.isLoaded = false;
     */

    /*
     * Uncomment this line to disable the output of characters by SysMin
     * when the program exits.  SysMin writes characters to a circular buffer.
     * This buffer can be viewed using the SysMin Output view in ROV.
    SysMin.flushAtExit = false;
     */


    /*
     * Use SysMin for output (System_printf() and error messages) and
     * minimize the output buffer size to save data space.
     */
    System.SupportProxy = SysMin;
    SysMin.bufSize = 80;

    /*
     * Create a LoggerBuf and make it the default logger for all modules.
     */
    var LoggerBufParams = new LoggerBuf.Params();
    LoggerBufParams.numEntries = 16;
    var logger0 = LoggerBuf.create(LoggerBufParams);
    Defaults.common$.logger = logger0;

    Main.common$.diags_INFO = Diags.ALWAYS_ON;

    Program.stack = 0x100;

    /*
     * Application specific configuration
     */
     
    /*
     * Disable unused BIOS features to minimize footprint.
     * This example uses Tasks but not Swis or Clocks.
     */
    var BIOS = xdc.useModule('ti.sysbios.BIOS');
    BIOS.swiEnabled = false;
    BIOS.taskEnabled = true;
    BIOS.clockEnabled = false;

    /* Minimize system heap size */
    BIOS.heapSize = 0x0;

    /*
     * Create a timer instance to generate a periodic interrupts.
     *
     * The timer will be started within the BIOS_start()
     * thread
     */
    var Timer = xdc.useModule('ti.sysbios.family.c28.Timer');
    var timerParams = new Timer.Params();
    timerParams.startMode = Timer.StartMode_AUTO;
    timerParams.runMode = Timer.RunMode_CONTINUOUS;
    /* Timer period is 1/2 second (500,000 uSeconds) */
    timerParams.period = 500000;
    timerParams.periodType = Timer.PeriodType_MICROSECS;
    var myTimer = Timer.create(0, '&myTickFxn', timerParams);

    /* Create a task with priority 1 */
    var Task = xdc.useModule('ti.sysbios.knl.Task');
    var taskParams = new Task.Params();
    taskParams.priority = 1;
    var myTask = Task.create('&myTaskFxn', taskParams);

    /* Inhibit the creation of a task to run idle functions */
    Task.enableIdleTask = false;

    /*
     * Create a binary semaphore for the timer ISR to use to
     * signal the pended task every 10 ticks
     */
    var Semaphore = xdc.useModule('ti.sysbios.knl.Semaphore');
    var semParams = new Semaphore.Params();
    semParams.mode = Semaphore.Mode_BINARY;
    Program.global.mySem = Semaphore.create(0, semParams);

    /*
     * Build a custom BIOS library.  The custom library will be smaller than the
     * pre-built "instrumented" (default) and "non-instrumented" libraries.
     *
     * The BIOS.logsEnabled parameter specifies whether the Logging is enabled
     * within BIOS for this custom build.  These logs are used by the RTA and
     * UIA analysis tools.
     *
     * The BIOS.assertsEnabled parameter specifies whether BIOS code will
     * include Assert() checks.  Setting this parameter to 'false' will generate
     * smaller and faster code, but having asserts enabled is recommended for
     * early development as the Assert() checks will catch lots of programming
     * errors (invalid parameters, etc.)
     */
    BIOS.libType = BIOS.LibType_Custom;
    BIOS.logsEnabled = false;
    BIOS.assertsEnabled = true;

    Hwi.zeroLatencyIERMask = 1;

  • Sorry for the delay. You can take a look at this. It is still a draft (and any feedback is welcomed). Hopefully it will answer your questions on how to setup a zero-latency timer in a SYS/BIOS application. C28_zero_latency.pdf

    Todd

  • Fyi...I posted the complete pdf on this page: processors.wiki.ti.com/.../BIOS_for_the_28x

    Search for latency.pdf.

    Todd