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.

TMDXIDDK379D: SDFM_TO_SHUNT

Part Number: TMDXIDDK379D
Other Parts Discussed in Thread: AMC1204

Please let me know.
// Scaling factor to bring all current feedbacks to normal scale
// Scaling factor to bring all current feedbacks to normal scale
// Matching with shunt-based measurements
// With shunt, 1.0pu current == 9.945A
//LEM, 1.0pu current == 12A

// SDFM, 0.8pu current == 12A
// SDFM, 0.8906pu current == 12.5A
//
#define LEM_TO_SHUNT 1.206637 // (12.0/9.945)
#define SDFM_TO_SHUNT 1.41131 // (12.5/0.8906)/9.945

How can I calculate the value 9.945A for a 20mΩ shunt resistor?
With the motor's rated phase current, the value of the shunt resistance, and the input full-scale current of 12.5A
I understand that 0.8906 is the probability that the maximum input will be 1.

The schematic says AMC1204/13 The schematic says AMC1204/13.04
I am not sure about the 50mV250mV.
Also, can I assume that the sdfm is unsigned filtered out?

In this case, is it correct to assume that what is being measured is the instantaneous value?

  • Thank you for your answer.
    I have naturally looked at the links you provided.
    Perhaps my question was not clear enough.
    In short
    Q1: Currently, the shunt resistor is set at 20mΩ, but when this is reduced to 15mΩ With shunt 20m OHM, 1.0pu current == 9.945A, how can I calculate this?

    Q2. The SDFM filter output is unsigned, but is there any way to read it as signed?

  • Hi,

    Q1: Currently, the shunt resistor is set at 20mΩ, but when this is reduced to 15mΩ With shunt 20m OHM, 1.0pu current == 9.945A, how can I calculate this?

    I'm not certain how to back calculate this value. I will need to get back to you.

    Q2. The SDFM filter output is unsigned, but is there any way to read it as signed?

    What do you mean by this? The SDFM current output is read, scaled, and offset in the function below:

    //
    // Read motor phase current from shunt resistor using SDFM
    //
    #if((BUILDLEVEL == FCL_LEVEL2) || (CURRENT_SENSE == SD_CURRENT_SENSE))
    static inline void getSDFMCurrent(void)
    {
        currentSenV =
           (float32_t)(((int32_t)SDFM_getFilterData(SDFM1_BASE, IV_SDFM_FILTER)>>16)
                * FCL_params.sdfmScale) - offset_SDFMV;
    
        currentSenW =
           (float32_t)(((int32_t)SDFM_getFilterData(SDFM1_BASE, IW_SDFM_FILTER)>>16)
                * FCL_params.sdfmScale) - offset_SDFMW;
        return;
    }
    #endif  //((BUILDLEVEL == FCL_LEVEL2) || (CURRENT_SENSE == SD_CURRENT_SENSE))

    Best,

    Kevin

  • Someone has made the SDFM filter output casts to signed, but casted signed, and subtracted from zero, she claims so that it reads correctly, and the output range is -32767-3276. 32767-32767, so I said that even if I cast an unsigned integer to a signed integer, the zero point would be wrong, so I had to subtract 16384 from the center. The SDFM filter output is from 0 to Even though I told her that the SDFM filter output is unsigned in the range of 0 to 32768, she said that we have such a setup that it can be read as signed, and even when I looked at the code, he did not understand that it can be read as signed. I don't think it can be read. In the unlikely event that there is a setting that can be read as signed, then I am wrong, but I think she simply do not understand illigal casts. 

    Is there a way to set the SDFM filter output to read signed? 

    Continuing on, please tell me how to find 1.0pu current when 1.0pu current == 9.945A with a shunt resistor of 15mΩ.

  • Function to read SDFM filter output below

    static inline uint32_t
    SDFM_getFilterData(uint32_t base, SDFM_FilterNumber filterNumber)

    The above is from Table 17.3 of SPRUI33D Positive or negative in , why unsigned, why return unsigned value?

  • I think that the idea is to leave it unsigned, which leads to the idea of subtracting the offset, so it is unsigned in this way. I think this is why they are unsigned.
    How much would the zeros be off by if we did not use offsets, but used the unsigned as the signed?

  • Hi,

    I see the SDFM configuration within the TMDXIDDK example matches the below. I'm still not certain about your signed / unsigned question. I'll need to discuss with another colleague.

            // ******************************************************
            // Sinc filter Module
            // ******************************************************
            // Configure Data filter module's filter type, OSR value and enable /
            // disable data filter.
            // 16 bit data representation is chosen for OSR 128 using Sinc3, from
            // the table in the TRM.
            // The max value represented for OSR 128 using sinc 3
            // is +/-2097152 i.e. 2^21.
            // To represent this in 16 bit format where the first bit is
            // sign shift by 6 bits.
            SDFM_enableFilter(SDFM1_BASE, (SDFM_FilterNumber)flt);
            SDFM_setFilterType(SDFM1_BASE, (SDFM_FilterNumber)flt,
                               SDFM_FILTER_SINC_3);
            SDFM_setFilterOverSamplingRatio(SDFM1_BASE, (SDFM_FilterNumber)flt,
                                            (SDFM_OSR - 1));
            SDFM_setOutputDataFormat(SDFM1_BASE, (SDFM_FilterNumber)flt,
                                     SDFM_DATA_FORMAT_16_BIT);
            SDFM_setDataShiftValue(SDFM1_BASE, (SDFM_FilterNumber)flt, 6);

    Best,

    Kevin

  • Hi,

    Continuing on, please tell me how to find 1.0pu current when 1.0pu current == 9.945A with a shunt resistor of 15mΩ.

    Regarding the above question I have the answer and info below:

    We use the maximum sampling current of the low-side shunts as the base current to calculate the other two base currents of LEM and SDFM (i.e. LEM_TO_SHUNT  and SDFM_TO_SHUNT scale factors). You can use the equations below to calculate this current based on the IDDK hardware.

    9.945 (A) = 3.3(V) / 0.02(OHM) / 2 / Gain

    Gain = ((22k*2k)/(22k+2k)) / 221 = 8.2956

    • 3.3V is used in the equation because it’s the full-scale ADC range of the C2000
    • Divide by 2 because it's Bidirectional current, with 1.65V offset voltage

    Also NOTE:

    You just need to change SDFM_TO_SHUNT from 1.41131 to 1.881747169 if wanting to change the 20 mOHM in-line shunt to 15 mOHM, (i.e. multiple scaling factor by 20mOhm/15mOhm = 1.33). But we don’t recommend to change the shunt resistor since the maximum current is selected according to the power module on the IDDK hardware.

    Best,

    Kevin

  • Hello,

    Is there a way to set the SDFM filter output to read signed? 

    The output of the SDFM data filter is always signed. This is mentioned section 17.5 of SPRUI33D, which you already referenced. The fact that SDFM_getFilterData() returns a 32-bit unsigned value is irrelevant since the IDDK code casts this value to a 32-bit signed value then shifts it >> by 16 (note that cast operator has precedence over bitwise shift operator). The shift >> by 16 is done because the SDFM is configured for 16-bit mode as pointed out by Kevin in the SDFM configuration code.

    SDFM_setOutputDataFormat(SDFM1_BASE, (SDFM_FilterNumber)flt,
    SDFM_DATA_FORMAT_16_BIT);

  • Thank you all for your replies.
    What I would like to know is how much the zero would be off if used without measuring the offset.

  • Thanks for letting me know.
    One problem solved.

  • Hi,

    Let me look into the offset calculation and usage further and then get back to you.

                // Offsets in phase current sensing using SDFM are obtained
                // below. The user can use it for their projects using SDFM.
                offset_SDFMV = K1 * offset_SDFMV + K2 *
                (float32_t)(((int32_t)SDFM_getFilterData(SDFM1_BASE, IV_SDFM_FILTER)>>16)
                        * FCL_params.sdfmScale);
    
                offset_SDFMW = K1 * offset_SDFMW + K2 *
                (float32_t)(((int32_t)SDFM_getFilterData(SDFM1_BASE, IW_SDFM_FILTER)>>16)
                        * FCL_params.sdfmScale);

    Best,

    Kevin

  • Some people say they don't use offsets at all and say it's not a problem, so I don't know how to explain it, if it really doesn't shift zero, then it's not a problem, but I'm wondering if it might cause unacceptable shifts. I am fully aware of the use of offset.

  • The data sheet of Amc1305's hardware says that there is an offset of ±150μV
    Is it correct to assume that the same amount of offset is generated after filter processing?
    The calculation suggests that there is an offset of 0.6%.

  • Hi,

    Sorry for the delayed response. This is the right idea for the % error due to the offset and the error depends on the input voltage range.

    For example if we have a AMC1305x25 with a +/- 250mV input range signal and +/- 150uV offset error (MAX), then we'd have the below:

    100% * (150uV / 250mV) = 0.06% error

    Best,

    Kevin

  • Thank you very much.
    Now everything is settled!