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.

Cannot run USB and GPT at the same time

Hi all.

I'm using the C5515 eZdsp and CSL v2.10. I've set up USB using the USB-DMA CSL example successfully. Then I've set up the GPT for periodic timer interrupts using the CSL example. GPT alone works. Okay I have some small issue about the interrupt interval, see * at end of post. USB alone works as well. But if I want to run both, USB doesn't work anymore!

Here are my code snippets:

interrupt void gpt0isr (void) {
    IRQ_clear(TINT_EVENT);
    CSL_SYSCTRL_REGS->TIAFR = 0x01;
    dataReady = TRUE;
}

void init_timer (void) {
    // ...
    hGpt = GPT_open (GPT_0, &gptObj, &status);
    // ...
    status = GPT_reset(hGpt);
    // ...
    // Clear any pending interrupts
    IRQ_clearAll();
    // Disable all the interrupts
    IRQ_disableAll();
    // plug&enable Timer interrupt
    IRQ_setVecs((Uint32)(&VECSTART));
    IRQ_plug(TINT_EVENT, &gpt0isr);
    IRQ_enable(TINT_EVENT);
   
    // Configure GPT module
    hwConfig.autoLoad      = GPT_AUTO_ENABLE;
    hwConfig.ctrlTim      = GPT_TIMER_ENABLE;
    hwConfig.preScaleDiv = GPT_PRE_SC_DIV_3;    // div Sys Clk by 16 -> 160ns period
    hwConfig.prdLow      = 0x4E20;                // prd low interrupts at 3.2ms period
    hwConfig.prdHigh      = 0x0000;

    status =  GPT_config(hGpt, &hwConfig);
    // ...
    // Enable CPU Interrupts
    IRQ_globalEnable();

    // Start the Timer
    status = GPT_start(hGpt);
}

void init_all() {
    // ...
    init_usb(); // as in the USB-DMA example
    // ...
    init_timer(); // similar to GPT example, see below
    // ...
}

I think it is an interrupt issue because if I comment out the IRQ-CSL calls in init_timer() USB works properly (and the timer probably as well).
But how can I solve this issue?

* And then there's the other, "small" issue with respect to the timer period. Is my setting hwConfig.prdLow = 0x4E20 correct with hwConfig.preScaleDiv = GPT_PRE_SC_DIV_3 to have interrupts at 3.2 ms? What's strange is that I observe the interrupts (on the scope) with a PRD of 7.04 ms. But when I set the value of prdLow to 0xEA60 i suddenly have 9.6 ms periods on the scope. So maybe I did not understand something correctly about those timers... Could you help me get the settings right?

Thank you very much for your help.

Andreas