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.

C2000WARE-MOTORCONTROL-SDK: Integrating HTFS-200P LEM sensor in C2000 Universal Motor control Project.

Part Number: C2000WARE-MOTORCONTROL-SDK
Other Parts Discussed in Thread: BOOSTXL-3PHGANINV

Tool/software:

Hi Everyone,

We are developing 5KW PMSM motor control solution using Ti C2000 Universal Motor control project. We are using F280025C launchpad and BOOSTXL-3PHGANINV inverter board. As current project is using Shunt resistor for current sensing. 

We want to integrate Lem HTFS-200P(datasheet has been attached)current sensor in the Universal motor control project. Kindly suggest me how can we integrate this, What modification need to be done in code and in which part of the code we can modify to add this sensor.

https://www.lem.com/sites/default/files/products_datasheets/htfs_200_800-p.pdf

Best Reagrds,

Pradeep

  • Pradeep,

    First, I recommend going through the universal motor control lab user's guide and the code base itself and becoming familiar with its structure, if you have not already done so. This will allow you to make this adjustment much more smoothly.

    As a current sensor, implementing this is relatively simple. Step 1-4 are preparation and explanation. Step 5-6 is the actual change you need.

    1. Navigate to motor1_drive.c and to the beginning of the motor1CtrlISR(-) function. This is the motor control ISR, where the current sensing outputs are utilized.

    2. Enter the HAL_readMtr1ADCData(-) function. This is located in the hal (Hardware Access Layer) .h file. Ensure you are familiar with the operation of this function in particular- this is where the current sensing is sampled.
    3. If you're using single-shunt sensing, ensure that MOTOR1_DCLINKSS (DC-link Single-shunt) is enabled in your project.
    4. Look at the inputs to the ADC_read function calls. Open the declaration for these #defined symbols. This will take you somewhere else in the hal.h file.
      1. You should be somewhere that looks like this, or at least similar to this:
    5. These inputs correspond to the physical ADC pins of the C2000.
      1. Change the pins to the correct pins for your new current sensors.

    6. Navigate to the user_mtr1.h file
      1. The following #define symbols may or may not need changing, depending on your system. See the Universal Motor Control User's Guide for more information on what these variables correspond to.
        1. USER_M1_ADC_FULL_SCALE_CURRENT_A
        2. USER_M1_SIGN_CURRENT_SF
        3. USER_M1_IDC_x
          1. Predefined symbols beginning with USER_MTR1_IDC_ are typically only relevant for single-shunt or two-shunt projects.
        4. USER_M1_Ix
          1. Predefined symbols beginning with this and not covered by (C) are typically only relevant for 3-shunt projects.

    Again, review the UMCL User's Guide for additional information- this may not be all-encompassing.

    Regards,
    Jason Osborn

  • Hi Jason,

    Sorry i missed to add that, I am not using shunt based current sensor. I am using two HTFS-200 P hall based current sensor. I have already seen the above details and gone throught the UMCL User's guide. And as per my understanding current is being calculated as following in UMCL project 

    And further it is passed to  collectRMSData(motorHandle_M1), function to convert current into the RMS.

    As i am using HTFS-200P hall based current sensor, which senses the phase current (inline sensing) directly as following.

    As per htfs-200 P datasheet we can calculate the phase current as following.

    (https://www.lem.com/sites/default/files/products_datasheets/htfs_200_800-p.pdf)

     I can implement this formula in the code as well, But i have few doubts?

    1) How the universal motor control project decides whether phase current is +ve or -ve, in the code. 

    2) To integrate this htfs-200P current sensor, do we need to make any other changes in the code. 

    Best Regards,

    Pradeep

  • Pradeep,

    1. On all of our reference boards that have 3-phase voltage sensing, you'll find a circuit that generates a 1.5V offset applied to the sensor reading, allowing for negative values to be read without any issues. This is reliant on the functionality of the shunt resistor. If the sensor you're using is capable of negative values, then this should require no additional adjustment.
      1. If we look at the value of USER_M1_Ix_OFFSET_AD (where 'x' is A, B, or C), you will see a value that is very close to 2048.
      2. The ADCs of the C2000 are 12-bit. 2^12 = 4096.
      3. If the current is 0A, then the ADC will read 1.5V due to the generated offset, which corresponds to an ADC value of 2048.
      4. Offset correction in the PPB results in an ADC reading of 0A on the C2000.

    2. If the output of the sensor is analog and bidirectional, then the existing code is likely functional. The c2000 is looking for an analog input representing the current- how that signal is generated is generated more-or-less doesn't matter to the firmware.

    Regards,
    Jason Osborn

  • Hi Jason,

    Thanks for the quick reply! 

    We are using 2- current sensors in 2-phases only, will this work with the existing UMCL project? Or we must have to add 3- current sensor for all the 3-phases?

    Best Regards,

    Pradeep

  • Hi Jason,

    Waiting for your reply?

  • Hello Pradeep,

    Apologies for the delay! I had written out a response, but apparently had neglected to actually send it, my apologies.

    As-written, the code does not support 2-shunt. However, it does support single-shunt, which can be used as a starting point for any code alterations you may decide to make!

    Regards,
    Jason Osborn

  • Hi Jason,

    Our 5KW hardware is ready and we have given provision for 2 current sensors on 2 phases, So how can we make changes in the code for 2 current sensors.

    As we know that sum of phase currents

           IA+IB+IC = 0

         so IC = - (IA+IB)

    Can we use this directly or we need to make any other changes? What do you suggest?

    Best Regards,

    Pradeep.

  • Pradeep,

    It is my understanding that the timing of the measurements for the 2 phases is important. If you're starting from the single-shunt build configuration, that timing has already been accounted for. Beyond that, I cannot think of any other changes that are required in the logic.

    Regards,
    Jason Osborn