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.

  • Resolved

Interrupt does not occur

Intellectual 485 points

Replies: 13

Views: 3642

Hey everybody,

I am working on evaluating CCSV4, because I change my system to Win7. Therefore I am trying to import my CCSV2.2 projects (with CSL, and Bios 4.9) to CCSV4 and that works now quite fine (see also here and here). Now I tried to debug my old project file on my hardware (C6713), which worked on CCSV2.2 very well.

Unfortunately I have now the problem that it looks like the device does not perform the interrupts. I already checked the registers of the MUXH and the global interrupt flag, which both are set. I added as example my 'Timer1.c' file which use a hardware interrupt as well as a software interrupt afterward, but all other hardware/software interrupts (see picture below) didn't occur as well.

After start of program the dsp runs in the idle functions of bios. So far the CSL settings seems for me to work, because the registers getting set correctly. Did I forgot something else?

Here is the code of the 'Timer1.c':

// Include files ===============================================================
#include <csl.h>                                                                                        //Include Chip Support Library
#include <csl_timer.h>                                                                             //Include Timer chip support

#include "timer.h"
#include "flash.h"
#include "gpio.h"

#include "c6713cfg.h"                                                                                //Generated by DSP/BIOS

// Global Variables ============================================================
// Define Timer handle
TIMER_Handle hTimer1;                                                                          //Handle for Timer1 device


    // Configuration Structure for Timer registers -----------------------------
    TIMER_Config timerCfg1 = {
   
        // Timer Control Register (CTL)
        TIMER_FMKS(CTL, TSTAT, 0)                |                                         //Timer status bit
        TIMER_FMKS(CTL, INVINP, NO)                |                                    //TINP inverter control bit
        TIMER_FMKS(CTL, CLKSRC, CPUOVR4)        |                           //Timer clock source
        TIMER_FMKS(CTL, CP, CLOCK)                |                                    //Set timer to Clock- or Pulse-Mode
        TIMER_FMKS(CTL, HLD, YES)                |                                       //Counter hold bit
        TIMER_FMKS(CTL, GO, NO)                    |                                       //Timer GO Bit. Resets and starts counter
        TIMER_FMKS(CTL, PWID, ONE)                |                                    //Pulse width bit
        TIMER_FMKS(CTL, DATIN, 1)                |                                          //Define TINP to be logic high or low
        TIMER_FMKS(CTL, DATOUT, 1)                |                                      //Data output bit
        TIMER_FMKS(CTL, INVOUT, NO)                |                                    //TOUT inverter control bit
        TIMER_FMKS(CTL, FUNC, TOUT),                                                  //Define function of TOUT
   
        // Timer Period Register (PRD)
        TIMER_FMKS(PRD, PRD, OF(0)),                                                   //Define timer period
   
        // Timer Count Register (CNT)
        TIMER_FMKS(CNT, CNT, OF(0))                                                     //Holds current counter value
    };
   

    // initTimer1() ============================================================
    void initTimer1(void){
        hTimer1 = TIMER_open(TIMER_DEV1, 0);                                    //Open Timer1 device
        TIMER_config(hTimer1, &timerCfg1);                                             //Load configuration structure into Timer1
        TIMER_setPeriod(hTimer1, TIMER_PRD);                                    //Load PRD register with period time
        TIMER_start(hTimer1);                                                                      //Kick off Timer1
    }

    // HWI_Timer1() ============================================================
    void HWI_Timer1(void){
        TIMER_pause(hTimer1);                                                                    //Pause Timer1
        SWI_post(&processTimer1Swi);                                                      //Call software interrupt
        TIMER_start(hTimer1);                                                                       //Reset and restart timer
    }

    /****************************************************************************************************************
     *                                                                                                                *
     *  ========= processTimer1() ==========                                                                        *
     *                                                                                                                *
     *    Processing function that gets called out of HWI_Timer1() in Timer1.c, which is called every 125ms             *
     *    after Timer1 generated a hardware interrupt.                                                                 *
     *                                                                                                                *
     *    Furthermore, every 5 seconds the function will check the save2flash flag, that                                *
     *    indicates if an important setting that should be saved for next startup has bee changed. If yes, all recent *
     *    variables needed for audio processing will be stored on flashposition 0x90020000 of the 29LV400 memory.     *
     *  On the next bootup, the DSP will restore these settings by reading out the FLASH at beginning of main().    *            *
     *                                                                                                              *
     ***************************************************************************************************************/
    void processTimer1(void){
   
        static Uint8 pin_toggle = FALSE;
        static Uint16 count1      = 0;
        static Uint16 count2      = 0;
       
        if (++count1>LED_TIME) {                                                              //Toggle 'Still Alive'-LED
            count1 = 0;
            if (pin_toggle) {
                GPIO_pinWrite(hGPIO, GPIO_PIN15, 0);
                pin_toggle = FALSE;}
            else {
                GPIO_pinWrite(hGPIO, GPIO_PIN15, 1);
                pin_toggle = TRUE;}
        }
   
        if ((++count2>SAVE_TIME)&(save)) {                                            //Save settings to Flash
            count2 = 0; save = FALSE;
            save_settings();
        }
    }

I added my *.tcf file as well, maybe there is something I must now activate compared to the old *.cdb file but is not imported correct?

I am happy about any idea regarding that issue. Thanks...

Regards,

Max

P.S: Please rename the *.txt to *.tcf.

c6713.txt
  • Max,

    Are you using the DSK 6713 board?

    One thing I noticed in your *.tcf file is that you are loading the generic platform instead of the standard DSK 6713 platform.  I see that your clock rate is different than the rate that's set in the DSK6713 platform file, which sets it to 225MHz.

    It also configures the following function to be called, which is missing from the generic platform setup code.

    /* Plug user init function to program PLL */
    bios.GBL.CALLUSERINITFXN = 1;
    bios.GBL.USERINITFXN = prog.extern("GBL_setPLLto225MHz");

    If you are using the DSK 6713, can you try loading the standard platform file for your board?  Just add the following to your *tcf file:

    utils.loadPlatform("ti.platforms.dsk6713");

    Steve

  • In reply to Steven Connell:

    Hi Steve,

    sorry for my late answer, but I was traveling last week.

    No, I am not using the DSK6713, our project is/was based on some of the examples for the DSK6713, but now we have our own hardware. Which is for example set to 200MHz instead of 225MHz, therefore I set the PLL in the init function, which should be called out of the bios (it is set correctly in the *.tcf file, it is called "SYS_init", please see also attached file 'mcwd20_init.c').

    Also I can see the timer running (CNT1 register) in the debug session, but my breakpoint in:

    // HWI_Timer1() ============================================================
    void HWI_Timer1(void){
        TIMER_pause(hTimer1);                                                    //Pause Timer1
         SWI_post(&processTimer1Swi);                                     //Call software interrupt
         TIMER_start(hTimer1);                                                      //Reset and restart timer
    }

    is never called. So the interrupt never occurs and it looks like, as if the whole program is running just in the bios (rta.s62).

    Could it be, that the PLL configuration is not accepted or overwritten by the GEL file? I can watch all registers in the debug session, but where are the PLL registers? Would be good if I could check if they are set to the correct values?

    I use the example bootloader to load my application from flash after start-up, but in that the PLL is not set, may that cause the problem (similiar to that example: http://processors.wiki.ti.com/index.php/Flashing_the_C6713_EVM)?

    Thanks in advance for every hint to that issue.

    Regards,

    Max

    mcwd20_init.c
  • In reply to Max Forster:

    Hello everybody,

    I had a new observation, I got no *.pp file for my bootloader file, does that mean the compiler is not handling it? (I mentioned it in my reply before, the bootloader is similiar to the file TI described here: http://processors.wiki.ti.com/index.php/Flashing_the_C6713_EVM and therefore written in assembler).

    Regards,

    Max

  • In reply to Max Forster:

    Max,

    Have you enabled the timer interrupt?

    I'm pretty sure that configuring the interrupt in the TCF file does not cause it to be enabled at runtime.

    You should use C64_enableIER(0x8000) to set interrupt 15's corresponding bit in the IER register.

    Alan

  • In reply to Alan DeMars:

    Hey Alan,

    I use the CSL commands:

            //Initialize Hardware Interrputs ==================================
            IRQ_enable(IRQ_EVT_EDMAINT);                                        // Enable EDMA interrupt to CPU (IER)
            IRQ_enable(IRQ_EVT_TINT1);                                              // Enable TIMER1 interrupt to CPU (IER)    
            
            IRQ_globalEnable();                                                                // Turn on global interrupts (GIE)

    to activate the interrupt(s) (in this example also Timer 1).

    In the debug window I saw that either MUXH is set correctly by default to Timer 1 and GIE is set correctly active. My IER register is set to 0x000000A, but I didn't found an clear explanation about that register. Where can I read some information about that register?

    Just for my understanding, in *.cdb the configuration of interrupt and so on was done in bios configuration, in *.tcf it is not? So this phrase

    bios.HWI_INT15.fxn = prog.extern("HWI_Timer1");

    bios.HWI_INT15.useDispatcher = 1;

    in *.tcf does not mean that the interrupt dispatcher is configured? I will have a look at the CSL description of IRQ handling maybe that will help. Maybe some of you guys have a good described document where handling of interrupt is explained if using CSL and CCSV4 -.-

    Regards,

    Max

  • In reply to Max Forster:

    It's me again. There is definitv something different in using the interrupts, because I now use the function to debug a little bit more and my program hangs up:

    while (!IRQ_test(IRQ_EVT_TINT1));

    Regards,

    Max

  • In reply to Max Forster:

    Hi everybody,

    one more question where can I get some information regarding the bits of CPU IER register? I searched the datasheets and user guides but I can not find a description of that register!

    Regards,

    Max

  • In reply to Max Forster:

    Max,

    Max Forster
    therefore I set the PLL in the init function, which should be called out of the bios (it is set correctly in the *.tcf file, it is called "SYS_init", please see also attached file 'mcwd20_init.c').

    Are you positive that this is being done? Can you verify that this PLL initialization code is running?

    Max Forster
    Could it be, that the PLL configuration is not accepted or overwritten by the GEL file?

    Yes, this could be possible.  However, since the GEL file functions are run when the code is being loaded onto the target, I expect your run-time settings to win in this case (the run time settings overwriting the GEL settings).

    Max Forster
    where are the PLL registers? Would be good if I could check if they are set to the correct values?

    I found PLLCSR register addresses and information in a table in the guide "http://www.ti.com/lit/ds/sprs186l/sprs186l.pdf"

    Steve

  • In reply to Max Forster:

    Max,

    The IER register is the "interrupt enable register."  It is a bit mask that tells you which interrupts are enabled or disabled.  The bit numbers correspond to interrupt numbers.

    For example, in the following screen shot, I see that interrupt number 5, 6 and 14 are enabled:

    Steve

  • In reply to Steven Connell:

    Hi Steve,

    thank you for your response. I checked the PLL by watching the function calls in debug session, but I can not see the PLL registers you described in my 'Registers' window (also I am not able to "open" the IER field like you have done in your screenprint). But I think the whole problem is much more simple, but I was not aware of it: http://processors.wiki.ti.com/index.php/CSL_and_DSP_BIOS

    It looks like my problem is because I used the CSL libary to enable, init and configure my interrupts. I will try the recommondations which are described there to convert my old project style to the new one which uses the API commands.

    Regards,

    Max

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.