CCS/AM5728: AM5728

Prodigy 100 points

Replies: 4

Views: 49

Part Number: AM5728

Tool/software: Code Composer Studio

PWM interrupt with DSP is not associated with interrupt service routine, so ISR routine is no executed.

The codes as here

Ether in DSP statics or in C file dynamics to create epwmISR :

 

In configure file:

var Hwi = xdc.useModule('ti.sysbios.hal.Hwi');

/* initialize hwiParams to default values */

var hwiParams = new Hwi.Params;

hwiParams.arg = 10; /* Set myIsr5 argument to 10 */

hwiParams.enableInt = false; /* override default setting */

hwiParams.eventId = 75;

/* Create a Hwi object for interrupt number 5

* that invokes myIsr5() with argument 10 */

Hwi.create(5, '&epwmISR', hwiParams);

 

 

Or in C file:

    Hwi_Params hwiParams;

    Hwi_Handle myHwi;

    Error_Block eb;

    /* initialize error block and hwiParams to default values */

    Error_init(&eb);

    Hwi_Params_init(&hwiParams);

    hwiParams.arg = 10;

    hwiParams.enableInt = FALSE;

    myHwi = Hwi_create(5, epwmISR, &hwiParams, &eb);

    if (myHwi == NULL) {

    System_abort("Hwi create failed");

    }

 

And:

 

In C file:

void PWM_InterruptConfig(void)

{

    /*

     * AM57x DSP does not have a default Xbar connection for PWM

     * interrupts, need to use a reserved IRQ Xbar instance for Xbar

     * interrupt configuration

     */

     /* Use reserved XBAR_INST_DSP1_IRQ_75 */

    CSL_xbarIrqConfigure(CSL_XBAR_IRQ_CPU_ID_DSP1, CSL_XBAR_INST_DSP1_IRQ_75, CSL_XBAR_PWMSS2_IRQ_ePWM1INT);

 

    // disables the ePWM Event interrupt.

    CSL_epwmEtIntrDisable(PWM_BASE_ADDRESS);

 

    // Configures the interrupt source and interrupt period.

    // Enable event time-base counter equal to zero.

    // Generate an interrupt on the first event

    CSL_epwmEtIntrCfg(PWM_BASE_ADDRESS, PWMSS_EPWM_ETSEL_INTSEL_CTR_0, PWMSS_EPWM_ETPS_INTPRD_GEN_FIRST_EVT);

 

    // Enables the ePWM Event interrupt.

    CSL_epwmEtIntrEnable(PWM_BASE_ADDRESS);

 

}

 

 

void epwmISR(void)

{

    // disables the ePWM Event interrupt.

     CSL_epwmEtIntrDisable(PWM_BASE_ADDRESS);

 

    isr_count++;

    GPIO_write(GPIO_PIN_TP48, GPIO_PIN_VAL_HIGH);     //For test purpose in Oscillate Scope

    // printf("*                 PWM ISR               *\n");

// Enables the ePWM Event interrupt.

 

    CSL_epwmEtIntrEnable(PWM_BASE_ADDRESS);

}

 

PWM_run()

   PWM_pwmInit();

   PWM_InterruptConfig();

   PWM_pwmConfig(freq, amp);

   GPIO_init();

   GPIO_crossbarInit();

   GPIO_write(GPIO_PIN_TP48, GPIO_PIN_VAL_LOW);

   delay(3);

   PWM_InterruptConfig();

   Hwi_Params hwiParams;

   Hwi_Handle myHwi;

   Error_Block eb;

   /* initialize error block and hwiParams to default values */

   Error_init(&eb);

   Hwi_Params_init(&hwiParams);

   hwiParams.arg = 10;

   hwiParams.enableInt = FALSE;

   myHwi = Hwi_create(5, (ti_sysbios_hal_Hwi_FuncPtr)epwmISR, &hwiParams, &eb);

   if (myHwi == NULL) {

   printf("Hwi create failed\n");

   System_abort("Hwi create failed");

   }

   else

   {

   Hwi_enableInterrupt(5);

   //wiParams.enableInt = TRUE;

 }

 

    PWM_SonicsOn();

    Task_sleep(1);

    PWM_SonicsOff();

    Task_sleep(1);

    PWM_SonicsOn();

    Task_sleep(1);

    GPIO_delay(3);

 

     if(isr_count)

     {

        isr_count = 0;

        printf("\nISR Count %d\n", isr_count);

     }

    /* Start BIOS */

   BIOS_start();

   return (0);

}

Disassembly Vector Table:

          ti_sysbios_family_c64p_Hwi_int5():

8409aca0:   003C54F6            STW.D2T2      B0,*B15--[2]

8409aca4:   0014A35A            MVK.L2        5,B0

8409aca8:   003C22F6            STW.D2T2      B0,*+B15[1]

8409acac:   0056502A            MVK.S2        0xffffaca0,B0

8409acb0:   004204EA            MVKH.S2       0x84090000,B0

8409acb4:   00000362            B.S2          B0

8409acb8:   003C52E6            LDW.D2T2      *++B15[2],B0

8409acbc:   00006000            NOP           4

4 Replies