cancel
Showing results for 
Search instead for 
Did you mean: 

Not possible to disable ADC InjectedConvMode in newer versions of CubeMX

JHauq.1
Associate

The fields ADC1.InjectedConvMode and ADC2.InjectedConvMode of a .ioc file could contain value "None" in the past. This allowed, at least for the F4 family of chips, to disable the JAUTO feature in the CR1 register of the ADC configuration.

In new versions, the "Injected Conversion Mode" setting only has one valid option: "Auto Injected Mode".

The result of this is that code generation no longer allows one to set AutoInjectedConv of the injected config struct to DISABLE.

I believe this is a bug. Any chance this could be looked at?

Thank you.

3 REPLIES 3
Philippe Cherbonnel
ST Employee

Hi @JHauq.1​ 

I just tried with CubeMX 6.3.0 on target STM32F4, to my point of view it works fine:

  • On the GUI, field "Injected Conversion Mode" has 3 options: None, discontinuous mode, auto injected mode
  • On the .ioc file, by default there is no line about auto injected mode. If we change it, then file is updated with a new line, for example: "ADC1.InjectedConvMode=AutoInjected" or "ADC1.InjectedConvMode=None"
  • On the generated code, by default there is "sConfigInjected.AutoInjectedConv = DISABLE;"

For information, as potential workaround, you can still tune your configuration using LL functions.

For example, to disable auto injected mode:

LL_ADC_INJ_SetTrigAuto(ADC1, LL_ADC_INJ_TRIG_INDEPENDENT);

What is your version of CubeMX ?

Do you try from an old project or start a new project ?

Best regards

Philippe

Hello Philippe,

You're right, it works correctly for ADC1.

I have to further precise that this problem is for ADC2 and ADC3

I am using version 6.4.0 of CubeMX, but some older versions had the same problem.

I am working with an .ioc file made with a much older version of Cube:

MxCube.Version=5.6.1

MxDb.Version=DB.5.0.60

Philippe Cherbonnel
ST Employee

Hello @JHauq.1​ ,

I updated to CubeMX 6.4.0, indeed there are some differences in .ioc file.

But for parameter InjectedConvMode, this is the same.

To make it appear in .ioc file, you have to toggle field "Injected Conversion Mode" in GUI:

  1. Initially, with default config: no line about InjectedConvMode in .ioc file.
  2. Change injected conversion mode to any other setting, then .ioc is updated with new line: ADC2.InjectedConvMode=AutoInjected
  3. Change injected conversion mode back to default value, .ioc content is: ADC2.InjectedConvMode=None

In all cases, generated code is correct, this is the most important.

Best regards

Philippe