cancel
Showing results for 
Search instead for 
Did you mean: 

Where to set ADC_REFERENCE_VOLTAGE?

DMeie.2
Senior II

Our project uses an external ADC reference voltage of 3.03V.
This value is properly set up inside the json I use to generate the inital project code ("amplifyingNetworkVm": 3.03, "polarizationOffset": 1.515).

Now I found in the generated code that inside paramters_converison.h, the ADC_REFERENCE_VOLTAGE is set to 3.3V.

Where am I supposed to set up the correct value so that it gets used by the code generator and stays when regenerating the project in CubeMX? Can I just manually set it?

1 ACCEPTED SOLUTION

Accepted Solutions
DBE
ST Employee

Hello DMeie.2,

Currently ADC reference voltage is fixed to 3.3V regardless the settings in your board description. The quickest work around to avoid ADC_REFERENCE_VOLTAGE modification after each cubeMX generation is :

- open the *.ioc file in your project directory with your favorite text editor.

- search MotorControl.ADC_REFERENCE_VOLTAGE and set to the desired value.

- save your *.ioc file

- reload your *.ioc file with cubeMX and generate your project

ADC_REFERENCE_VOLTAGE should be set to the correct value in parameters_conversion.h file.

Please note this work around works only if you regenerate your project with CubeMX. If you regenerate the project with STMCWorkbench, the *.ioc will be overwritten and your modification will be lost.

 

Best regards

 

If you agree with my answer, please consider accepting it by clicking on 'Accept as solution'.

View solution in original post

1 REPLY 1
DBE
ST Employee

Hello DMeie.2,

Currently ADC reference voltage is fixed to 3.3V regardless the settings in your board description. The quickest work around to avoid ADC_REFERENCE_VOLTAGE modification after each cubeMX generation is :

- open the *.ioc file in your project directory with your favorite text editor.

- search MotorControl.ADC_REFERENCE_VOLTAGE and set to the desired value.

- save your *.ioc file

- reload your *.ioc file with cubeMX and generate your project

ADC_REFERENCE_VOLTAGE should be set to the correct value in parameters_conversion.h file.

Please note this work around works only if you regenerate your project with CubeMX. If you regenerate the project with STMCWorkbench, the *.ioc will be overwritten and your modification will be lost.

 

Best regards

 

If you agree with my answer, please consider accepting it by clicking on 'Accept as solution'.