cancel
Showing results for 
Search instead for 
Did you mean: 

How to switch between "CurrentSensing" hwVariants?

DMeie.2
Senior II

We are working on a custom inverter board based on a B-G431B-ESC1.

As we want to have the option to choose between Single-Shunt and Three-Shunt variant for current sensing, I implemented both features as hwVariants, according to the documentation.

See the following snippet:

        {
          "name": "CurrentSensing",
          "type": "CurrentSensing",
          "tRise": 45,
          "hwVariants": [
            {
              "type": "ThreeShunt_AmplifiedCurrents",
              "help": "DRV8323RS internal current amplifier is used",
              "signals": {
                "CURRENT_AMPL_U": [
                  {
                    "name": "PA1",
                    "help": "",
                    "cost": 0
                  }
                ],
                "CURRENT_AMPL_V": [
                  {
                    "name": "PA7",
                    "help": "",
                    "cost": 0
                  }
                ],
                "CURRENT_AMPL_W": [
                  {
                    "name": "PB0",
                    "help": "",
                    "cost": 0
                  }
                ]
              },
              "shuntResistor": 0.001,
              "amplifyingNetworkImax": 40,
              "amplifyingNetworkVm": 3.3,
              "amplifyingNetworkPrating": 1.4,
              "offsetNetworkAttenuation": 0.571,
              "opAmpGain": 16,
              "polarizationOffset": 2.057
            },
            {
              "type": "SingleShunt_AmplifiedCurrents",
              "help": "DRV8323RS internal current amplifier is used",
              "signals": {
                "CURRENT_AMPL": [
                  {
                    "name": "PA1",
                    "help": "",
                    "cost": 0
                  }
                ]
              },
              "shuntResistor": 0.001,
              "amplifyingNetworkImax": 40,
              "amplifyingNetworkVm": 3.3,
              "amplifyingNetworkPrating": 1.4,
              "opAmpGain": 16,
              "offsetNetworkAttenuation": 0.571,
              "polarizationOffset": 2.057

            }
          ]
        },

 

However, in the MC Workbench Wizard, only the Single-Shunt implementation is showing up.

How do I switch to the Three-Shunt variant?

1 ACCEPTED SOLUTION

Accepted Solutions
cedric H
ST Employee

Hi @DMeie.2 ,

Thank you for your interesting question.

Your description is correct. 

When we use 2 ADCs, to sample the 3 phases, we introduced a limitation consisting of having one phase that can be sampled by the 2 ADCs, this is what we called the shared phase. It is mandatory to be able to always sample simultaneously 2 phases. For instance U,V by ADC1&2 V,W by ADC 1&2, UW by ADC 1&2. In this sequence, U is always sampled by ADC1, W is always sampled by ADC2 and phase V is sometime sampled by ADC2 and sometime by ADC1 (depending on whether we sample it together with U or W).

In your configuration, the shared phase can only be the phase U (connected to ADC1 channel 2 and ADC2 channel 2 through pin PA1).

As we do not have any board with this configuration, we were not able to test it, so we prefer to disable it.

As it is the only possible solution for you, I propose you to remove this limitation.

To do so, you must change the line 138 of the file ConnectionParameters.json in the folder MC_SDK_6.2.1\Utilities\PC_Software\STMCWB\assets : (reference is MCSDK 6.2.1)

 "sharedPhase": ["CURRENT_AMPL_V"],  

into

 "sharedPhase": ["CURRENT_AMPL_U","CURRENT_AMPL_V"],  

Doing so, you allow the solutions using the phase U as a shared phase from the connection algorithm.

As I mentioned before, this is a configuration we were not able to test. In order to provide you a validated answer, I did the test with your code snippet. I can confirm that the project is successfully generated and compile without error nor warning. Now, I would love to hear from you that it is fully functional.

Regards

Cedric

View solution in original post

2 REPLIES 2
cedric H
ST Employee

Hi @DMeie.2 ,

Thank you for your interesting question.

Your description is correct. 

When we use 2 ADCs, to sample the 3 phases, we introduced a limitation consisting of having one phase that can be sampled by the 2 ADCs, this is what we called the shared phase. It is mandatory to be able to always sample simultaneously 2 phases. For instance U,V by ADC1&2 V,W by ADC 1&2, UW by ADC 1&2. In this sequence, U is always sampled by ADC1, W is always sampled by ADC2 and phase V is sometime sampled by ADC2 and sometime by ADC1 (depending on whether we sample it together with U or W).

In your configuration, the shared phase can only be the phase U (connected to ADC1 channel 2 and ADC2 channel 2 through pin PA1).

As we do not have any board with this configuration, we were not able to test it, so we prefer to disable it.

As it is the only possible solution for you, I propose you to remove this limitation.

To do so, you must change the line 138 of the file ConnectionParameters.json in the folder MC_SDK_6.2.1\Utilities\PC_Software\STMCWB\assets : (reference is MCSDK 6.2.1)

 "sharedPhase": ["CURRENT_AMPL_V"],  

into

 "sharedPhase": ["CURRENT_AMPL_U","CURRENT_AMPL_V"],  

Doing so, you allow the solutions using the phase U as a shared phase from the connection algorithm.

As I mentioned before, this is a configuration we were not able to test. In order to provide you a validated answer, I did the test with your code snippet. I can confirm that the project is successfully generated and compile without error nor warning. Now, I would love to hear from you that it is fully functional.

Regards

Cedric

Thanks, this worked as you expected.

I had to create a new project for the change to apply, but now I can switch the "Current reading topology" between one- and three-shunt.

I'll report further if there's any functional issues with this in the future.