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.

DRV8301: When does InstaBLDC enter the interrupt program

Part Number: DRV8301
Other Parts Discussed in Thread: INSTASPIN-BLDC

Hi Team,

In the Insta-PM_sensorless routine of DRV8301, the following code is written:

// Enable CNT_zero interrupt using EPWM1 Time-base
EPwm1Regs.ETSEL.bit.INTEN = 1; // Enable EPWM1INT generation
EPwm1Regs.ETSEL.bit.INTSEL = 1; // Enable interrupt CNT_zero event
EPwm1Regs.ETPS.bit.INTPRD = 1; // Generate interrupt on the 1st event
EPwm1Regs.ETCLR.bit.INT = 1; // Enable more interrupts

At this point, the actual wave generation mode of the EPWM module is UPDOWN mode. Can it be understood that each control cycle triggers an interrupt, and the moment it enters the interrupt corresponds to the moment when the Time Base module sends out a triangular carrier wave to reset?

In InstaeBLDC, there is no such code, and instead, the code related to interrupt settings is:

/ Reassign ISRs.
// Reassign the PIE vector for TINT0 to point to a different
// ISR then the shell routine found in DSP280x_DefaultIsr.c.
// This is done if the user does not want to use the shell ISR routine
// but instead wants to use their own ISR.

EALLOW; // This is needed to write to EALLOW protected registers
PieVectTable.ADCINT1 = &MainISR;
EDIS; // This is needed to disable write to EALLOW protected registers

// Enable global Interrupts and higher priority real-time debug events:
EINT; // Enable Global interrupt INTM
ERTM; // Enable Global realtime interrupt DBGM

In this routine, the setting of EPWM is

Initialization constant for the F280X Time-Base Control Registers for PWM Generation.
Sets up the timer to run free upon emulation suspend, count up mode
prescaler 1.

#define PWM_CNTL_INIT_STATE ( FREE_RUN_FLAG + \
PRDLD_SHADOW + \
TIMER_CNT_UPDN + \
HSPCLKDIV_PRESCALE_X_1 + \
CLKDIV_PRESCALE_X_1 + \
PHSDIR_CNT_UP + \
CNTLD_DISABLE )                      The customer pointed out that this is a TI error. The code is written as TIMER-CNT_UPDN, but the comment says it is a count up mode.

The customer's question is: Does the moment of entering ISR in the INsta-bldc routine correspond to the moment of resetting the triangular carrier wave? Or at some other time? This is important for him to control torque and reduce torque ripple.

Regards,

Annie

  • Hi Annie,

    I'm going to have to reassign your questions to our C2000 team, please give them adequate time to respond to your question.

    Regards,

    Yara

  • In the Insta-PM_sensorless routine of DRV8301, the following code is written:

    There is no such example as you mentioned above fo

    Insta-PM_sensorles.

    Can it be understood that each control cycle triggers an interrupt, and the moment it enters the interrupt corresponds to the moment when the Time Base module sends out a triangular carrier wave to reset?

    Yes. Correct.

    The customer's question is: Does the moment of entering ISR in the INsta-bldc routine correspond to the moment of resetting the triangular carrier wave? Or at some other time? This is important for him to control torque and reduce torque ripple.

    Can you provide more details? I can't fully understand your questions. Can you ask your customer to take a look at the application notes first? And then he may understand the example workflow and ask his questions after that.

  • Hi Yanming,

    The following is the customer's response:

    the interrupt of the PM_sensorless example code is triggered by the CNT_zero event. Nonetheless, for Insta_BLDC example code, there is no such code or comments which is indicating that the interrupt is triggered by the same event. So, I just want to know: In Insta_BLDC, is Main Interrupt triggered by  CNT_zero event (same as PM_sensorless) or it is triggered by some other events? 

    The two examples are: DRV830x-HC-C2-KIT_v105\PM_Sensorless and DRV830x-HC-C2-KIT_v105\InstaSPIN_BLDC.

    Regards,

    Annie

  • So, I just want to know: In Insta_BLDC, is Main Interrupt triggered by  CNT_zero event (same as PM_sensorless) or it is triggered by some other events?

    Yes. It's the same interrupt triggered by PWM.

  • Hi Yanming,

    How can this be seen from the example code? There is no similar code in Insta_BLDC. Also customer wants to confirm:

    nitialization constant for the F280X Time-Base Control Registers for PWM Generation.
    Sets up the timer to run free upon emulation suspend, count up mode
    prescaler 1.

    #define PWM_CNTL_INIT_STATE ( FREE_RUN_FLAG + \
    PRDLD_SHADOW + \
    TIMER_CNT_UPDN + \
    HSPCLKDIV_PRESCALE_X_1 + \
    CLKDIV_PRESCALE_X_1 + \
    PHSDIR_CNT_UP + \
    CNTLD_DISABLE )

    TI's comment here is wrong, it should be Count updown mode, not Count up mode.

  • How can this be seen from the example code?

    I am not fully understanding your question. What do you want to change and get in the example code? And why do you need to change the example code?

  • Hi Yanming,

    This may be misunderstood. The customer is not trying to change the example code. He wanted to know that the interrupt triggering routine in the InstaSPIN_BLDC code was not as obvious as in the PM_sensorless code.

    Regards,

    Annie

  • As below, InstaSPIN-BLDC uses PWM event trigger ADC SOC, the ADC EOC will trigger the ADC interrupt.

    EALLOW; // This is needed to write to EALLOW protected registers
    PieVectTable.ADCINT1 = &MainISR;
    EDIS; // This is needed to disable write to EALLOW protected registers

    PM-sensorles uses the PWM event to trigger the PWM interrupt directly. These could be found in the example code.

  • Hi Yanming,

    Customer was aware that ADC interrupt is triggered by the PWM zero event. His question is: What is the PWM interrupt of InstaSPIN_BLDC triggered by? Is it also triggered by zero event like PM_sensorless?

    Regards,

    Annie

  • It could be clear in f2803xidc_vemf.h, the SOCB (TBCNTR = CMPB) to trigger the ADC and its interrupt. Please take a look at the code. If customer doesn't want to change the code, they don't need to care this setting, just need to their own codes in background loop or ISR.