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.

SYS/BIOS CPU Clock and Tick period

Other Parts Discussed in Thread: SYSBIOS

Hi,

      I use f2809 platform and want to run program in flash.  In SYS/BIOS if i disable the C28x Boot config, should i config the PLL before BIOS_Start()? when i import the SYS/BIOS examples in CCS5, i can't found any configuration about PLL, but need to set CPU clock frequency(Hz) = 100000000 ?

      the clock module set the Tick period 1000us by default , does it used Timer2 to generate the OS Tick?  should i config Timer2 before BIOS_Start() ? if i want to change the tick period = 500us, what i need to do besides setting tick period 500us?

  • Junyan,

    Yes, if you disable the Boot module then you will need to setup the PLL on your own, within your application code.  

    And yes, it is best to do this before calling BIOS_start() at the end of main().  After setting up the PLL you can call BIOS_setCpuFreq() to tell SYS/BIOS what you’ve configured the CPU frequency to be.

    The timer peripheral used by the Clock module may vary, depending upon other usage of timers within the application.  It won’t always be Timer #2.  There is some description of Timer management for C28x devices here: http://processors.wiki.ti.com/index.php/SYS/BIOS_for_the_28x#28x_Timer_Management_with_SYS.2FBIOS

    To configure the Clock tick rate you typically don’t need to know the specific timer peripheral used by Clock.  Clock will configure its assigned timer peripheral directly, based upon Clock module configuration settings.  And you should *not* modify that timer peripheral directly, otherwise you’ll get undetermined behavior from the timer.

    If for some reason you *do* want to specifically configure the timer peripheral… you can declare to the Clock module that the tick source is of type “Clock.TickSource_USER”, and then manage the timer peripheral on your own.  This is possible, but is not commonly done.  You can find some example snippets of how to do this in the “cdoc” documentation for the Clock module. You can find this in your SYS/BIOS installation, at a location similar to this: file:///C:/ti/bios_6_35_01_29/docs/cdoc/index.html (substitute the appropriate CCS and SYS/BIOS install locations).  Once that page is opened, navigate to the ti.sysbios.knl.Clock module description.

    You might also look at the “Clock Example” that is bundled with the SYS/BIOS installation.

    Scott

  • Hi Scott,

        thank you very much for your support. and i have another question.

    when i test  the C28x interrupt nesting, I found that interrupt nesting is only depended on hwiParams.maskSetting, no mater the box "Enable interrupt nesting" is set or not. can you explain this?

  • Hi Junyan,
     
    No, I can't explain that.  The Hwi dispatcher will only manipulate the IER interrupt mask (before/after calling the specified ISR function) when “Enable interrupt nesting” is specified true. The underlying configuration parameter for the GUI option is named “Hwi.dispatcherAutoNestingSupport”.  This parameter is true by default, but can be disabled. 

    You can see this in the function Hwi_dispatchC(), in Hwi.c, at a location similar to this in your SYS/BIOS installation: C:\ti\bios_6_35_01_29\packages\ti\sysbios\family\c28 (replace your CCS and SYS/BIOS install locations).

    Can you clarify how you are seeing this behave differently?

    Are you maybe manipulating IER within your ISR function?

    In your application configuration file (with the .cfg extension), is Hwi.dispatcherAutoNestingSupport set to true anywhere?  It may have been set false earlier in the file, but set to true later, which will “win”.

    Also, with your program running, can you halt it, and then look at the Hwi module state with ROV, and see what is shown for “Hwi.autoNestingSupport”?

    Thanks,
    Scott

  • Hi Scott

           Thank you for your attention. I test with the PIE_post() to simulate the hardware interrupt , and in the ISR use PIE_post() again to simulate interrupt nesting. I will check the configuration parameter again tomorrow.

            Today I test the interrupt response time, and use PIE_post() to simulate hardware interrupt. when i use interrupt dispatcher, interrupt response time is about 2.35us, and when i use Hwi_plug()  to plug interrupts instead of dispatcher, interrupt response time is about 380ns (F2809, 100MHz) . just because we don't need the interrupt nesting and the interrupt response time is important for our program, so i think it's better for us to use Hwi_plug() instead of SYS/BIOS interrupt dispatcher. but in http://processors.wiki.ti.com/index.php/SYS/BIOS_for_the_28x#Plugging_Interrupts_for_Use_Outside_the_SYS.2FBIOS_Interrupt_Dispatcher , it points that "Hwi_plug()  can only be used for ISR functions that do not call any SYS/BIOS APIs ".  what does "do not call any SYS/BIOS APIs" means?  does it means in the ISR functions, i cann't use such as Event_post() , Swi_or() or other SYS/BIOS APIs ???

  • Hi Junyan,

    Yes, you interpreted correctly, if you aren’t using the dispatcher, your ISR cannot call SYS/BIOS APIs that trigger scheduling.  The reason is that the dispatcher will temporarily disable scheduling within the ISR.  Without this protection, calling the API may cause immediate context switching to a new thread (Task or Swi) while still in the context of the hardware interrupt, which is usually fatal.

    The text says “any” SYS/BIOS APIs, but it is really APIs that would trigger scheduling.  You should be able to call simpler SYS/BIOS APIs without issue.  But both Event_post() and Swi_or() that you list must not be called without the protections provided by the dispatcher.

    Scott