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.

CCS/TMS320F28027F: mainISR running from FLASH

Part Number: TMS320F28027F
Other Parts Discussed in Thread: MOTORWARE

Tool/software: Code Composer Studio

HI,

I'm wondering can we run the mainISR from flash without copying the code into RAM?  Will there be any affection on the motor control ? 

Most of the motorware project example copy mainISR into RAM like the following. Can we get rid of it? Any affection ?

#ifdef FLASH
#pragma CODE_SECTION(mainISR,"ramfuncs");
#endif

In general, the RAM is faster than the FLASH, but since there's very limited RAM memory size, i'm trying to refactor the code and save as much memory as we can. 

  • The difference is that the code execute speed is faster in RAM than in Flash. You have to copy the ISR code from Flash to RAM if the ISR frequency is very high, otherwise will cause ISR time overflow, like more than 10KHz for InstaSPIN-FOC. You don't need to do this if the ISR frequency is less than 5KHz.

  • Yanming, 

    Thanks a lot for the reply.

    1) The current ISR I found is 15KHZ  in the user.h Is  USER_ISR_FREQ_Hz the parameter you mean "more than 10KHZ" ? 

    #define USER_ISR_FREQ_Hz           ((float_t)USER_PWM_FREQ_kHz * 1000.0 / (float_t)USER_NUM_PWM_TICKS_PER_ISR_TICK)

    #define USER_PWM_FREQ_kHz                (15.0)

    #define USER_NUM_PWM_TICKS_PER_ISR_TICK        (1)

    2) Besides the mainISR, in the latest motorware version, it actually have more function copy from FLASH to RAM. 

    Are they all for the reason ("time overflow") has to stay in RAM ? 

    #ifdef FLASH
    #pragma CODE_SECTION(mainISR,"ramfuncs");
    #pragma CODE_SECTION(runSetTrigger,"ramfuncs");
    #pragma CODE_SECTION(runFieldWeakening,"ramfuncs");
    #pragma CODE_SECTION(runCurrentReconstruction,"ramfuncs");
    #pragma CODE_SECTION(angleDelayComp,"ramfuncs");
    #pragma CODE_SECTION(getAbsElecAngle,"ramfuncs");
    #pragma CODE_SECTION(getAbsMechAngle,"ramfuncs");
    #endif

  • 1. Right. All ISR code must be execute in pwm period which is ISR time also.
    2. Right. These function will be called from mainISR and executed in ISR.