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.

dsp TMS320f2407

Other Parts Discussed in Thread: TMS320LF2407A, TMS320LF2402A, TMS320LF2406A, TMS320LF2403A

Good evening,

I have a relevant search the dsp TMS320f2407, I try to program it how and especially how to introduce a board  with language c or c++ and assembler.

Thank you.

  • Good evening Maha,

    I'm don't quite understand the question. Can you sketch in a few details?

    First of all you need some JTAG tool to load program into the DSP memory.

    Also you possible need some compiler for programming with C, C++, ASM. Code Composer is a good choice. 

     

     

  • maha zoghlami said:

    Good evening,

    I have a relevant search the dsp TMS320f2407, I try to program it how and especially how to introduce a board  with language c or c++ and assembler.

    Thank you.

    Maha,

    Please note that the 2407A has been designated NRND: This product is not recommended for new designs. However, the device, tool, or software continues to be in production to support existing customers. TI does not recommend using this part in a new design. TI encourages designers to consider alternative products for new designs.

    May I suggest looking at a 2802x device for your new development instead?

    www.ti.com/piccolo

    -Lori

  • Thank you for your answer but I already have to buy this dsp 2407 for my memory of master's degree thus it needs I me untangled with

  • Thank you for your answer, I schedule(program) my dsp with the software DMC pro, for the appliquations ca girls walking(step) but it is necessary to optimize the time(weather) it is for this reason I have to try to compile him(it) with language c with a picture(board), but the probléme that ca walk(work) not with, thus if you have an idea on the structue of the picture(board) to schedule(program) my DSP and thank you

  • Thank you for your answer, I program my dsp with the software DMC pro, for the applications  step but it is necessary to optimize the time it is for this reason I have to try to compile it with language c with a board, but the probléme that ca walk(work) not with, thus if you have an idea on the structue of the board to program my DSP and thank you

  • Hi 

    As I understand you already have some device based on 2407 and some program for it .

    You can not load the program  into the device or you new optimized program works wrong or did not work  at all. Or you can not compile you program?

  • Hello, I already compile my programs but my first one probléme that I found the instruction of the board, I made the meme work that we compile in it c but it don't work not: I can not read the board. I hope you have this instruction.merci

  • Hello, I already compile my programs but my first one probléme that I did not find the instruction of the board, I made the meme work that we compile in it c but it don't work : I can not read the board. I hope you have this instruction of board .thank you.

  • Hi Roman Ermakov,

    I am working on TMS320LF2407A EVM. I know that it is not recommended for new development but please,i want you to help with this.

    I have followed the application note @ http://www.ti.com/lit/an/spra755a/spra755a.pdf . which was useful and i was able to execute the program mentioned in that AN.

    But when i tried to add new interrupt program into the project it is not getting executed.

    please find program files in attachment. Timer2 configuration in the program is dummy and waste. Please look for problems timer1 configuration or linker settings

    Thanks in advance,

    Raghu K

    5383.example_c.c
    /*********************************************************************
    * Filename: example_c.c *
    * *
    * Author: David M. Alter, Texas Instruments Inc. *
    * *
    * Last Modified: 03/14/01 *
    * *
    * Description: This program illustrates basic initialization and *
    * operation of the LF2407 DSP. The following peripherals are *
    * exercised: *
    * 1) Timer 2 is configured to generate a 250ms period interrupt. *
    * 2) The quad LED bank on the LF2407 EVM is sequenced in the *
    * Timer2 ISR. *
    * 3) The IOPC0 pin is toggled in the Timer2 ISR. *
    * 4) Timer 1 is configured to drive 20KHz 25% duty cycle symmetric *
    * PWM on the PWM1 pin. *
    * *
    *********************************************************************/
     /*** Address Definitions ***/
    #include "f2407_c.h"    
    
    #define DAC0 port0000 /* EVM DAC register 0 (I/O space) */
    ioport unsigned port0000; /* �24xx compiler specific keyword */
    
    #define DAC1 port0001 /* EVM DAC register 1 (I/O space) */
     ioport unsigned port0001; /* �24xx compiler specific keyword */
    
    #define DAC2 port0002 /* EVM DAC register 2 (I/O space) */
     ioport unsigned port0002; /* �24xx compiler specific keyword */
    #define DAC3 port0003 /* EVM DAC register 3 (I/O space) */
     ioport unsigned port0003; /* �24xx compiler specific keyword */
    
    #define DACUD port0004 /* EVM DAC update register (I/O space) */
     ioport unsigned port0004; /* �24xx compiler specific keyword */
    
    #define DIPSWCH port0008 /* EVM DIP switch (I/O space) */
     ioport unsigned port0008; /* �24xx compiler specific keyword */
    #define LED port000C /* EVM LED bank (I/O space) */
     ioport unsigned port000C; /* �24xx compiler specific keyword */
    /*** Constant Definitions ***/
    
     #define timer2_per 58594 /* 250ms timer2 period with a 1/128
     timer prescaler and 30MHz CPUCLK */
    
     #define pwm_half_per 39000 /* period/2, 20KHz symmetric PWM with
       a 30MHz CPUCLK */
    
    /*#define pwm_duty 563  25% PWM duty cycle */
     unsigned int pwm_duty; 
     /*** Global Variable Definitions ***/
     unsigned int LED_index; /* LED_index */
    
    
    /****************************** MAIN ROUTINE ***************************/
    void main(void)
     {
    
     /*** Configure the System Control and Status registers ***/
     *SCSR1 = 0x06FD;
     *SCSR2 = (*SCSR2 | 0x000B) & 0x000F;
     /*** Disable the watchdog timer ***/
     *WDCR = 0x00E8;
     /*** Setup external memory interface for LF2407 EVM ***/
     WSGR = 0x0040;
     /*** Setup shared I/O pins ***/
     *MCRA = 0x00C0; /* group A pins */
     *MCRB = 0xFE00; /* group B pins */
     *MCRC = 0x0000; /* group C pins */
     /*** Configure IOPC0 pin as an output ***/
     *PCDATDIR = *PCDATDIR | 0x0100;
     /*** Setup timers 1 and 2, and the PWM configuration ***/
     *T1CON = 0x0000; /* disable timer 1 */
     *T2CON = 0x0000; /* disable timer 2 */
    
     *GPTCONA = 0x0000; /* configure GPTCONA */
    
    /* Timer 1: configure to clock the PWM on PWM1 pin */
    /* Symmetric PWM, 20KHz carrier frequency, 25% duty cycle */
     *T1CNT = 0x0000; /* clear timer counter */
     *T1PR = pwm_half_per; /* set timer period */
     *DBTCONA = 0x0000; /* deadband units off */    
     pwm_duty = 30000 ;
     *CMPR1 = pwm_duty; /* set PWM1 duty cycle */
      
     *ACTRA = 0x0006; /* PWM1 pin set active high */
     *COMCONA = 0x8200; /* configure COMCON register */
     *T1CON = 0x0F40; /* configure T1CON register */
    
     /* Timer 2: configure to generate a 250ms periodic interrupt */
     *T2CNT = 0x0000; /* clear timer counter */
     *T2PR = timer2_per; /* set timer period */
    
     *T2CON = 0xD740; /* configure T2CON register */
    
     /*** Other setup ***/
     LED_index = 0x0001; /* initialize the LED index */
     /*** Setup the core interrupts ***/
     *IMR = 0x0000; /* clear the IMR register */
     *IFR = 0x003F; /* clear any pending core interrupts */
     *IMR = 0x0002; /* enable desired core interrupts */
    
     /*** Setup the event manager interrupts ***/
     *EVAIFRA = 0xFFFF; /* clear all EVA group A interrupts */
     *EVAIFRB = 0xFFFF; /* clear all EVA group B interrupts */
     *EVAIFRC = 0xFFFF; /* clear all EVA group C interrupts */
     *EVAIMRA = 0x0002; /* enable desired EVA group A interrupts */
     *EVAIMRB = 0x0000; /* enable desired EVA group B interrupts */
     *EVAIMRC = 0x0000; /* enable desired EVA group C interrupts */
    
     *EVBIFRA = 0xFFFF; /* clear all EVB group A interrupts */
     *EVBIFRB = 0xFFFF; /* clear all EVB group B interrupts */
     *EVBIFRC = 0xFFFF; /* clear all EVB group C interrupts */
     *EVBIMRA = 0x0000; /* enable desired EVB group A interrupts */
     *EVBIMRB = 0x0000; /* enable desired EVB group B interrupts */
     *EVBIMRC = 0x0000; /* enable desired EVB group C interrupts */
    
     /*** Enable global interrupts ***/
     asm(" CLRC INTM"); /* enable global interrupts */
      LED = LED_index;
     /*** Proceed with main routine ***/
     while(1); /* endless loop, wait for interrupt */
    
     } /* end of main() */
    
     /********************** INTERRUPT SERVICE ROUTINES *********************/
    interrupt void timer2_isr(void)
     {
    
     *EVAIFRB = *EVAIFRB & 0x0001; /* clear T2PINT flag */
    
     /*** Sequence the LED bank on the LF2407 EVM ***/
     LED = LED_index; /* light the LEDs */
     LED_index = LED_index << 1; /* left shift LED index */
     if(LED_index == 0x0010) LED_index = 0x0001; /* reset LED index */
    
     /*** Toggle the IOPC0 pin ***/
     *PCDATDIR = *PCDATDIR ^ 0x0001; /* XOR the IOPC0 bit to toggle the pin */
    
     }
     
    interrupt void timer1_isr(void)
     { 
        
     *EVAIFRA = *EVAIFRA & 0x0002; /* clear T2PINT flag */
     /*** Sequence the LED bank on the LF2407 EVM ***/
     LED = LED_index; /* light the LEDs */
     LED_index = LED_index << 1; /* left shift LED index */
     if(LED_index == 0x0010) LED_index = 0x0001;
     *PCDATDIR = *PCDATDIR ^ 0x0001; 
     /* XOR the IOPC0 bit to toggle the pin * /* reset LED index *
      /    
     /**
      
      
     *CMPR1 = pwm_duty;   
     pwm_duty = pwm_duty - 1 ;  
      if(pwm_duty < 100) pwm_duty = 563;  */
    
     }
     
     
    8372.cvectors.asm

  •  

    good old 2407. I didn't work with it since 2005...

    asm file looks ok. 

    in the end of the ISR procedure usually present some code to clear some interrupt flags. not sure the compiler make this work itself after implementing the "interrupt" keyword or you need to do it manually.  

    All you need is:  

    TMS320LF2407A,TMS320LF2406A,TMS320LF2403A,TMS320LF2402A TMS320LC2406A,TMS320LC2404A,TMS320LC2403A,TMS320LC2402A DSP CONTROLLERS (SPRS145L) Datasheet,

    TMS320LF/LC240xA DSP Controllers Reference Guide System and Peripherals (SPRU357C) Datasheet

    Code Composer and JTAG

    Load your code into the DSP and start it.

    1. check if the timer 1 is counting (open T1CNT register in the watch window. it must changed after you do "refresh").

    2. check if the timer 1 interrupt flag is set

    3. check how the interrupt flag goes from the timer unit into the interrupt unit (look thought the SPRU357C, chapter 2,  to understand how the interrupt unit works).

    4. after you achieve the INT2 bit is set your ISR must got control. set the breakpoint inside the ISR and check if it works.

    5. it is possible the ISR is executed only one time. the reason -- you didn't clear some flags. look through all chain of flags to understand where is the problem.

    by the way, for checking all this points you don't need to recompile your project because you can change appropriate registers state right in the working program through the JTAG. so it is simple and funny work to debug your project. 

    good luck!

  • Hi Roman Ermakov,

    It is working,i just added one statement in ISR asm("CLRC INTM"); ...I think "interrupt" keyword will not clear central interrupt flag..

    Thank you very much..

    Regards,

    Raghu K

  • right!

    that what I mean by the "code to clear some interrupt flags". some hardware units needs to do some additional work to clear the interrupt source. be careful with it. 

    as for "interrupt" keyword, it is just completes the function call with RETI instead RET.

    regards,

    Roman

  • Hi Roman Ermakov,

    I am working on TMS320LF2407A EVM. I know that it is not recommended for new development but please,i want you to help with this. I have followed the application note @ http://www.ti.com/lit/an/spra755a/spra755a.pdf . which was useful and i was able to execute the program mentioned in that AN.

    I am trying to generate a sine wave using DAC on EVM. But when i tried to run the ISR generated by  timer 1 (with no prescaling of clock) .The ISR is getting executed for 90+ times, after that the ISR is not executing. control is jumping to NMI ISR (happens when trying to access restricted memory).  When the program is not accessing any restricted memory in first 90 ISR passes. How come it is accessing after 90 ISRs.

    The above problem is not occurring when i am prescaling the clock for timer1 by 128 times.

    Thanks

    Raghu K

    4604.cos_ser.asm7178.cvectors.asm

    1376.example_c.c
    /*********************************************************************
    * Filename: example_c.c *
    * *
    * Author: David M. Alter, Texas Instruments Inc. *
    * *
    * Last Modified: 03/14/01 *
    * *
    * Description: This program illustrates basic initialization and *
    * operation of the LF2407 DSP. The following peripherals are *
    * exercised: *
    * 1) Timer 2 is configured to generate a 250ms period interrupt. *
    * 2) The quad LED bank on the LF2407 EVM is sequenced in the *
    * Timer2 ISR. *
    * 3) The IOPC0 pin is toggled in the Timer2 ISR. *
    * 4) Timer 1 is configured to drive 20KHz 25% duty cycle symmetric *
    * PWM on the PWM1 pin. *
    * *
    *********************************************************************/
     /*** Address Definitions ***/
    #include "f2407_c.h"    
    
    #define DAC0 port0000 /* EVM DAC register 0 (I/O space) */
    ioport unsigned port0000; /* �24xx compiler specific keyword */
    
    #define DAC1 port0001 /* EVM DAC register 1 (I/O space) */
     ioport unsigned port0001; /* �24xx compiler specific keyword */
    
    #define DAC2 port0002 /* EVM DAC register 2 (I/O space) */
     ioport unsigned port0002; /* �24xx compiler specific keyword */    
     
    #define DAC3 port0003 /* EVM DAC register 3 (I/O space) */
     ioport unsigned port0003; /* �24xx compiler specific keyword */
    
    #define DACUD port0004 /* EVM DAC update register (I/O space) */
     ioport unsigned port0004; /* �24xx compiler specific keyword */
    
    #define DIPSWCH port0008 /* EVM DIP switch (I/O space) */
     ioport unsigned port0008; /* �24xx compiler specific keyword */  
     
    #define LED port000C /* EVM LED bank (I/O space) */
     ioport unsigned port000C; /* �24xx compiler specific keyword */
    /*** Constant Definitions ***/
    
     #define timer2_per 58594 /* 250ms timer2 period with a 1/128
     timer prescaler and 30MHz CPUCLK */
    
     #define pwm_half_per 80 /* period/2, 20KHz symmetric PWM with
       a 30MHz CPUCLK */
    
    /*#define pwm_duty 563  25% PWM duty cycle */
     /*** Global Variable Definitions ***/
     unsigned int LED_index; /* LED_index */      
     
      volatile unsigned int *pBank;       
      
      int sine_value; 
         
    /****************************** MAIN ROUTINE ***************************/
    void main(void)
     {
    
     /*** Configure the System Control and Status registers ***/
     *SCSR1 = 0x01FD;
     *SCSR2 = (*SCSR2 | 0x000B) & 0x000F;
     /*** Disable the watchdog timer ***/
     *WDCR = 0x00E8;
     /*** Setup external memory interface for LF2407 EVM ***/
     WSGR = 0x0040;
     /*** Setup shared I/O pins ***/
     *MCRA = 0x00C0; /* group A pins */
     *MCRB = 0xFE00; /* group B pins */
     *MCRC = 0x0000; /* group C pins */
     /*** Configure IOPC0 pin as an output ***/
     *PCDATDIR = *PCDATDIR | 0x0100;
     /*** Setup timers 1 and 2, and the PWM configuration ***/
     *T1CON = 0x0000; /* disable timer 1 */
     *T2CON = 0x0000; /* disable timer 2 */
    
     *GPTCONA = 0x0000; /* configure GPTCONA */
      sine_value = 0;   
      pBank = B0;   
    /* Timer 1: configure to clock the PWM on PWM1 pin */
    /* Symmetric PWM, 20KHz carrier frequency, 25% duty cycle */
     *T1CNT = 0x0000; /* clear timer counter */
     *T1PR = pwm_half_per; /* set timer period */
     *DBTCONA = 0x0000; /* deadband units off */    
    
      
     *ACTRA = 0x0006; /* PWM1 pin set active high */
     *COMCONA = 0x8200; /* configure COMCON register */
     *T1CON = 0x0840; /* configure T1CON register */
    
     /* Timer 2: configure to generate a 250ms periodic interrupt */
     *T2CNT = 0x0000; /* clear timer counter */
     *T2PR = timer2_per; /* set timer period */
    
     *T2CON = 0xD740; /* configure T2CON register */
    
     /*** Other setup ***/
     LED_index = 0x0001; /* initialize the LED index */
     /*** Setup the core interrupts ***/
     *IMR = 0x0000; /* clear the IMR register */
     *IFR = 0x003F; /* clear any pending core interrupts */
     *IMR = 0x0002; /* enable desired core interrupts */
    
     /*** Setup the event manager interrupts ***/
     *EVAIFRA = 0xFFFF; /* clear all EVA group A interrupts */
     *EVAIFRB = 0xFFFF; /* clear all EVA group B interrupts */
     *EVAIFRC = 0xFFFF; /* clear all EVA group C interrupts */
     *EVAIMRA = 0x0080; /* enable desired EVA group A interrupts */
     *EVAIMRB = 0x0000; /* enable desired EVA group B interrupts */
     *EVAIMRC = 0x0000; /* enable desired EVA group C interrupts */
    
     *EVBIFRA = 0xFFFF; /* clear all EVB group A interrupts */
     *EVBIFRB = 0xFFFF; /* clear all EVB group B interrupts */
     *EVBIFRC = 0xFFFF; /* clear all EVB group C interrupts */
     *EVBIMRA = 0x0000; /* enable desired EVB group A interrupts */
     *EVBIMRB = 0x0000; /* enable desired EVB group B interrupts */
     *EVBIMRC = 0x0000; /* enable desired EVB group C interrupts */
    
     /*** Enable global interrupts ***/
     asm(" CLRC INTM"); /* enable global interrupts */
      LED = LED_index;
     /*** Proceed with main routine ***/
     while(1); /* endless loop, wait for interrupt */
    
     } /* end of main() */
    
     /********************** INTERRUPT SERVICE ROUTINES *********************/
     
    interrupt void timer1_isr(void)
     { 
     float sine_scaled = 0;  
     *EVAIFRA = *EVAIFRA & 0x0080; /* clear T2PINT flag */
     /*** Sequence the LED bank on the LF2407 EVM ***/
     LED = LED_index; /* light the LEDs */
     LED_index = LED_index << 1; /* left shift LED index */
     if(LED_index == 0x0010) LED_index = 0x0001;
     *PCDATDIR = *PCDATDIR ^ 0x0001;   
      sine_value = *pBank;    
      pBank = pBank+1; 
      if(pBank>(B0+95)) 
      pBank = B0;
      sine_scaled =  sine_value/1000.0;
      *CMPR1 = sine_scaled;   
      asm(" CLRC INTM");  
     
     }
     
     

    I am attaching the file the files..please look into the program.

    Thanks in advance,

    Raghu K