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.

Compiler/TMS320C5535: Blinking a led using timer interrupt

Part Number: TMS320C5535

Tool/software: TI C/C++ Compiler

Hello!

I have the C5535 ezdsp board and I'm trying to set it up to do a simple task. I use the code composer studio v4 program. The task is : "Blinking a led using timer interrupt. So I have to get a rectangular signal by turning on/off a led ."  I don't know what libraries I need.

I need of an example the program in C for this task.

Thank you so much!!! 

  • Hi Davidas,

    You can find eZdsp5535 Software Resources including LED blinking example at:
    support.spectrumdigital.com/.../
    also the TMS320C55x Chip Support Library API Reference Guide should be helpful
    www.ti.com/.../spru433j.pdf

    BR
    Tsvetolin Shulev
  • Hello,

    thank you for your sugestions. But, please explain me, how can I combine the examples "led_test" and " csl_gpt_example" in order to get  a program to generate a SQUARE WAVE of 1Hz(by example) frequency on a pin where it is connected a LED, using TIMER INTERRUPT. How calculate the value that have to introduce in the timer registers???  

    This is the program that I try to resolve my task.

    Thank you so much!

    #include "stdio.h"
    #include "ezdsp5535.h"
    #include "ezdsp5535_led.h"
    #include "csl_gpt.h"
    #include "csl_intc.h"
    #include <csl_general.h>
    
    
    
    interrupt void gpt0Isr(void);
    
    void main() {   
     EZDSP5535_init( );
     
     EZDSP5535_LED_init( );
     EZDSP5535_XF_toggle(); 
     
     
    CSL_TIM_0_REGS->TIMPRD1 = 0xFFF2;                     // Period counter = 0x186A0 (100,000)
    
    CSL_TIM_0_REGS->TIMPRD2 = 0xFFFF;
    
    CSL_TIM_0_REGS->TIMCNT1 = 0xFFF2;                     // Reset Timer 0 Count Down Register
    
    CSL_TIM_0_REGS->TIMCNT2  = 0xFFFF;
    
    CSL_SYSCTRL_REGS->TIAFR = 0x00;                                      // Reset Aggregate Timer interrupt flags (Timer 0, Timer 1, Timer 2)
    
    IRQ_clear(TINT_EVENT);                               // Reset Timer global interrupt flag
    
    CSL_TIM_0_REGS->TCR = 0x8003;                                // Enable Timer, Prescale divider=0, Auto reload
    
    IRQ_globalEnable ();           // Enable global interrupts
    
    EZDSP5535_LED_on(0);
    //EZDSP5535_waitusec( 2000000 );
    }
    
    
    interrupt void gpt0Isr(void)
    {
       // Disable global interrupts
     IRQ_globalDisable ();
     
     EZDSP5535_LED_off(0);
     //EZDSP5535_waitusec( 2000000 );                                   // Toggle XF port (Grn Led)
    
     CSL_SYSCTRL_REGS->TIAFR = 0x00;                 // Reset aggregate timer interrupt flags (0, 1, 2)
    
     IRQ_clear(TINT_EVENT);                                            // Reset Timer global interrupt flag
    
     // Enable global interrupts
     IRQ_globalEnable ();
    }
    
    
    

  • Davidas,

    I assume you have the CSL installed in your machine as referenced above.
    If you take a look at this file C:\ti\c55_lp\c55_csl_3.08\ccs_v6.x_examples\gpt\CSL_GPTExample\csl_gpt_example.c, it explains at the top of the file on how the scalar values are calculated.

    In this example, I believe the GPT Count is Initialized to 1/4 of CPU Clock Cycles per Millisecond.

    Lali
  • Hallo,

    thank you for your help.