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.

TMS320F280041C: Adapting Instaspin labs to a custom design

Part Number: TMS320F280041C
Other Parts Discussed in Thread: LAUNCHXL-F280049C, BOOSTXL-DRV8320RS, C2000WARE, TMS320F280049C

Hello,

I made a custom motor drive design with TMS320F280041CPMS micro and DRV8353RS gate driver. I need to adapt labs that are written for LaunchXL-F280049C + BoostXL-DRV8320RS kit to my custom hardware. The major difference in hardware is that I am using current sense amplifiers that part of gate driver chip vs. PGAs on EVAL kit.

I need to adapt labs 1 to 7 located in the folder C:\ti\c2000\C2000Ware_MotorControl_SDK_3_00_00_00\solutions\common\sensorless_foc\source to verify that my hardware is working correctly and create my final application. I modified GPIO configuration and every place where analog channels are referenced ( since I am using different pins). Digital IOs, I2C, and SCI are working correctly. I used code from examples to verify I2C and SCI. What other changes do I need to make to have a motor spin?

Alex

  • From the motor control side, the using peripherals are ADC for current/voltage sensing, PWM for gate driver, SPI and GPIOs for DRV interface, and CMPSS for over-current protection if you don't need the on-chip PGA. So you just need to change the hal.c, hal.h and user.h according to the inverter board.

    Yes, you might use lab01~ab03 to verify the device configuration and hardware board first.

  • Hi Luo,

    I think I understand what changes I need to make to user.h file. However, I am struggling with changes to hal.h and hal.c files. I need more specifics how to configure peripherals comparators, digital compare, trip zones, dacs if any related to faults. I commented out PGAs, DACs, CMPSSs setup functions and all related to them stuff in the main() function but I left function HAL_setupFaults(halHandle) untouched. I have no idea about the code in that function. I can't understand it. Lab2 seems working fine on my board. I verified SPI communication with the gate driver. I have the gate driver registers setup the same way as in TI labs for DRV8353RS_EVM. This EVAL kit was used with the same motor as I am trying to spin now. However, if I try to spin a motor with Lab7 I am getting overcurrent fault when the motor starts to spin ( 0.2  -1 sec). If you need schematic page or any of the files our TI rep Viktorija Cecil can email them to you. I also prefer if you email any proprietary specifics to Viktorija instead of posting here.

    Alex

  • You might follow the steps in the attached file to change the related functions according to your board, the changes are marked in RED.

    You should use lab02, lab03, and lab04 to verify the device configuration and the hardware board first, and then use lab05 to do the motor parameters identification. You could run the lab07 on your board with the identified motor parameters after running these labs above. 

    HAL module in MotorControlSDK.pdf

  • Hi Yanming,

    Thank you for the detailed response. My motor is spinning now. I have some questions about modifications I would like to make.

    1. Which lines of code in Lab 7 set values for comparators for current protection? As I understand DACs are used to set these values. Correct?
    2. Are there supposed to be any changes to certain files because my micro is F280041C, and not F280049C as in the labs?
      1. Anything in project properties?
      2. in TMS320F280049C_LaunchPad.ccxml?
      3. in files located in src_device folder?

    3. I ran a motor today that has nominal RPM 3400 but it did not go above 2900 RPM without any load. What should be my approach to this problem? What setting should I check that could be wrong? This motor was not made in USA. Is there a way to verify if the motor complies with its spec? I had current limit on a power supply set to 5A. The motor was drawing about half of that at 2900 RPM. Could the current limit on the PS cause RPM limiting?

    Alex

  • 1. You can find the codes below in the is07_speed_control.c, change the motorVars.dacValH and motorVars.dacValL to set the current protection threshold.

            //
            // set internal DAC value for on-chip comparator for current protection
            //
            {
                uint16_t  cmpssCnt;
    
                for(cmpssCnt = 0; cmpssCnt < HAL_NUM_CMPSS_CURRENT; cmpssCnt++)
                {
                    HAL_setCMPSSDACValueHigh(halHandle,
                                             cmpssCnt, motorVars.dacValH);
    
                    HAL_setCMPSSDACValueLow(halHandle,
                                            cmpssCnt, motorVars.dacValL);
                }
            }

    2. Yes, select the right device in TMS320F280049C_LaunchPad.ccxml, and configure the memory map in linker file (.cmd) accordingly.

    If you haven't had a chance to look at the workshop material, I think this will help demystify some of the terminology and architecture as well.

    https://training.ti.com/c2000-mcu-device-workshops

    http://www.ti.com/tool/CCSTUDIO-C2000#supportandcommunity

    3. Please follow the lab guide to lab05 to identify the motor parameters first, and set the right maximum current (USER_MOTOR_MAX_CURRENT_A) in the file of the user.h according to the spec. of the motor.

    1. I wrote different values to motorVars.dacValH and motorVars.dacValL in Expressions window and nothing happened. I guess my current protection is setup incorrectly somewhere. How do I troubleshoot this problem?
    2. I will take a look at these sites when I have time. I have to solve problems first.
    3. I did identify a motor with Lab 5. USER_MOTOR_MAX_CURRENT_A = 15A  in both labs. However, with everything the same the motor goes to 3600 RPM in Lab 5 and only to 3000 RPM in Lab 7. What should I do?

    Alex

  • Hi Yanming,

    Today I discovered a new problem in addition to those in the previous post. When I increase speed reference acceleration starts right away but when I decrease speed reference there is a delay before a motor starts deceleration. Is this how Lab 7 works or it is a bug? Can you point me where should look for a problem?

    Alex

  • For Q3. What's USER_ADC_FULL_SCALE_VOLTAGE_V, USER_NOMINAL_DC_BUS_VOLTAGE_V and USER_MAX_VS_MAG_PU in the user.h? And what's dc bus voltage when the motor is running with high speed? The limitation output voltage of current controllers is different in lab05 and lab07, so the maximum running speed may be different in these two labs.

    I don't think there is any difference or delay between acceleration and deceleration if the same acceleration value (motorVars.accelerationMax_Hzps) is set to the trajectory of speed. You might check if the values in the traj_spd and pi_spd object are correct as your setting in the watch window.

  • Hi Yanming,

    USER_ADC_FULL_SCALE_VOLTAGE_V = ((float32_t)(82.5)), USER_NOMINAL_DC_BUS_VOLTAGE_V = ((float32_t)(48.0)) and USER_MAX_VS_MAG_PU = 0.5. The dc bus voltage when the motor is running with high speed was 48VDC. I was using a regulated PS. Now I switched to an actual battery which is 50VDC but it did not make any difference. I tried to change values in the line below but it did not make any difference either. My project is based on Lab7 so I have to find a way to reach RPM required by my application. Are you available for a conference call? I have a lot of other problems and questions. I will copy my project ( I need to do some cleanup for easy reading) to a cloud and send a link to our TI rep Viktorija so she can forward it to you. Then i will send a meeting invite same way.

    Alex

  • Sorry I forgot to paste the lines I mentioned above:

    //#define USER_MAX_VS_MAG_PU (0.66)
    //#define USER_MAX_VS_MAG_PU (0.57)
    #define USER_MAX_VS_MAG_PU (0.5)


    //! \brief Defines the reference Vs magnitude in per units allowed
    //! \ Set the value equal from 0.5 to 0.95 of the maximum Vs magnitude
    // Alex
    #define USER_VS_REF_MAG_PU ((float32_t)(0.8) * USER_MAX_VS_MAG_PU)
    //#define USER_VS_REF_MAG_PU ((float32_t)(0.95) * USER_MAX_VS_MAG_PU)

    Alex

  • The USER_VS_REF_MAG_PU is for field weakening control at high speed in lab13. You should keep the USER_MAX_VS_MAG_PU  is less than 0.5 if you didn't implement the overmodulation as lab08.

    So you might refer to the lab13 to implement the field weakening control to achieve the high speed running if the dc bus voltage is not enough.

    Let me know if you have further questions.