TMS320F28386D: Eight gpio interrupts on TMS320F28386D

Part Number: TMS320F28386D
Other Parts Discussed in Thread: C2000WARE

Hello,

I want to use interrupts for 6 GPIO inputs on the TMS320F28386D microcontroller.
I have already used XINT3, XINT4 and XINT5 to determine the position of one BLDC motor (three hall effect sensors).


I want to determine the position of a second motor using three hall effect sensors.
Knowing that there are not enough XINTx resources available for both motors, how can I generate interrupts on the edges of each hall effect sensor of the second motor ?

Note: I work with "Code Composer Studio 11.1.0".

Best Regards,

Christophe BERENGER

  • Hello,

    Thank you for your answer.

    I have read the two threads but no found solution to my problem.

    In my program, I use 3 XINT (for 3 hall sensors) to compute motor position, and 1 eCAP to compute motor speed.

    As I must add a second BLDC motor in my program, I have enought eCAP to compute motor speed, but not enougth XINT to compute motor position.

    So, my question is: Is there another interrupt way than use XINT to compute motor position with 3 hall effect sensors ?

    Can I use eCAP interrupt (for example) to compute motor position ?

    Note: I don't want to use "C2000Ware_MotorControl_SDK".

    Best Regards,

    Christophe

  • Christophe,

    Can I ask why you don't want to use the Motor Control SDK? The Universal Motor Control Lab included in that SDK uses 3 eCAP modules and no external interrupts for speed and angle estimation and is a fantastic resource for this.

    Regards,
    Jason Osborn

  • Hello,

    I'm not against using the Motor Control SDK library, but I just wanted a simple answer to my question about using other interrupts or eCAPs to determine the position of the BLDC motor.

    Knowing that the motor can go clockwise and counterclockwise, the Motor Control SDK library would need to take into account the three signals from the Hall effect sensors to determine the motor position. Depending on the 3 signals, it must be able to determine the direction of rotation, and therefore the correct absolute motor position.

    If the library is capable of this, can you give me an example of use ?

    I will use it in my project.

    Best Regards,

    Christophe

  • Christophe,

    The eCAP implementation in the MCSDK does account for motor direction. In the Motor Control SDK file structure, the source files for the HALL library are located here:

    • {C2000Ware Installation Location}\libraries\observers\hall\include\hall.h
    • {C2000Ware Installation Location}\libraries\observers\hall\source\hall.c

    In hall.h, the HALL_run() function at the bottom of the file is the primary estimator function, called every ISR. HALL_getAngle_rad() and HALL_getSpeed_Hz() return the relevant estimator outputs. There are also functions used during startup and calibration.

    The simplest example of use for all of the above is the Motor Control SDK's Universal Motor Control Lab. I'm about to post quite a bit of information elaborating on this statement.

    These are the relevant settings for HALL in the Universal Lab:

    • MOTOR1_HALL as the only enabled estimator (i.e. MOTOR1_HALL, MOTOR1_FAST_N, MOTOR1_ESMO_N, and MOTOR1_ENC_N in the predefined symbols section of the project properties.
    • DMC_LEVEL_4 used in sys_settings.h
    • Not strictly required, but fantastic for quality of life and large file navigation (not just for the MCSDK!):
      • CCS Window -> Preferences -> Show advanced settings -> type filter text "folding"
      • Check boxes 1, 2, and 3. Check the bottom-most box.
      • Apply and close

    I'll now explain where to find the implementation in your FOC loop. I'm assuming you're already familiar with the FOC concept for this explanation. For any readers who are not familiar with this concept, see the HVAC reference design user's guide (as well as the Universal Motor Control Lab User's Guide in the next/upcoming release).

    Anyway, in the motor1CtrlISR() motor control ISR in motor1_drive.c (assuming you've set the correct predefined symbols as I described):

    • Anything in an if(obj->motorState == ...) statement that is not comparing vs MOTOR_CL_RUNNING or MOTOR_CTRL_RUN is a startup function, either during motor alignment (obj->motorState == MOTOR_ALIGNMENT), the flying start startup routine (obj->motorState == MOTOR_SEEK_POS), or the brief open loop startup period (obj->motorState == MOTOR_OL_START)
      • In other words, if you're only looking for the typical running state of the motor, ignore everything in those startup sections
    • Additionally, please note there is one additional predefine intended for one-time use for HALL sensor calibration (HALL_CAL) which also briefly requires the MOTOR1_FAST predef enabled as well.
      • HALL_CAL usage instructions:

    I understand this was quite a bit of information. Please let me know what specific questions you may have, or what aspects of your questions I didn't explain well!

    Regards,
    Jason Osborn

  • Hello Jason,

    Thank you for your very detailed response.

    I looked at the source files, and it seems to suit my need.
    I can't test this solution right away because the project hasn't started yet.
    For now, I just needed to find a solution to the problem of using two BLDC motors.

    I will contact technical support if necessary when using the “Motor Control SDK” library.

    Best regards,

    Christophe