cancel
Showing results for 
Search instead for 
Did you mean: 

STM32Cube - BUG report : bug in ADC1 injected channels and bad code generation

st239955_stm1
Associate II
Posted on June 07, 2014 at 14:35

Hi,

I'm using STM32CubeMX for a STM32F205 MCU.

There is a problem with the use of the ADC1 configuration, regarding Injected Groups.

 1/ when I choose the number of injected conversions, lots of intrusive 'ranks' display on the frame (normally, you should have the same number of visible ranks than the chosen number of conversions). I join a screenshot. Note that the generation of the code is consistent with the display - but then it generates a wrong code, that doesn't work, and that need to be manually changed. 

 2/ the number of injected conversions is missing at the code generation, and then the configuration of the ADC1 is wrong, the register JSQR is not filled, and it doesn't work. You must add it manually too.  ''sConfigInjected.InjectedNbrOfConversion = 1...4''.

Idem for ADC2.

3/   the JAUTO mode is missing at the code generation, and then the configuration of the ADC1 is wrong (I don't even know why JAUTO is set without doing anything!) and it doesn't work. You must add it manually too.  ''sConfigInjected.AutoInjectedConv = DISABLE;''.  

Idem for ADC2.

4/ in the configuration tab (of ADC1), when pushing on 'Apply' or 'OK' button, CubeMX crashes often. I'm on Windows7 pro 64. 

Can the ST team : 

 - confirm that it is a bug ?

 - let us know when it will be fixed ?

 - let us know when is planned the next update ? 

Thanks,

0690X00000605XFQAY.png

#bug #adc #st32cubemx #injected #!bug #adc #cubemx
26 REPLIES 26
st239955_stm1
Associate II
Posted on January 28, 2015 at 11:15

Hi,

I use the version v4.6.0 and there is still a problem with ADC2 and ADC3.

When you start a new config of the ADC, there is no problem to put 0 to 4 injected channels.

Problem : when I save the config, and open it again later, the config is still correct but the number of injected channel is reset to 0 ! Then a bad code is generated.. and if I want to set again the number of channels, the old config does not disappear and if you do that several times, it becomes a real mess. (cfr screenshot)

Can the ST team :

- confirm that it is a bug ?

- let us know when it will be fixed ?

- let us know when is planned the next update ?

________________

Attachments :

adc3Bug.png : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006HzRh&d=%2Fa%2F0X0000000bM1%2FJSUJCqcejiLxUwggfnPLzXniAJpzjQNenkQppueMAew&asPdf=false
raptorhal2
Lead
Posted on February 12, 2015 at 01:14

The problem also occurs in CubeMX for STM32L1. MX seems to want to generate 11 ranks, no matter what. I entered 15 ranks & 4 were dropped, and one rank was reassigned.

For issue #1 its also present in ver 4.5.

 

 

I saw a work around that if you lower the ''number of conversion'' to 1 and then increase it back to the number that you want, it will fix the issue. 

 

 

Good luck.

That fixed the issue for me, but the channel assignments and sampling time had to be reentered.

Cheers, Hal

st239955_stm1
Associate II
Posted on March 13, 2015 at 10:17

Hi,

It's still not OK. Even with your workaround.

Note that I use a .ioc file that was created 9 months ago.

Please find attach my .ioc file, where it's impossible to generate right config for ADCs injected channels.

It's a very annoying problem, since whathever the config you save, when you close then open again the file, the number of injected conversion is reset to 0...

Can the ST team :

- confirm that it is a bug ?

- let us know when it will be fixed ?

- let us know when is planned the next update ?

________________

Attachments :

badADC.ioc : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006HzK0&d=%2Fa%2F0X0000000bM0%2FLzl81wGyN6Q6viaVwc3nl7M2sw9Om7x4MBvBr56Hkig&asPdf=false
Amel NASRI
ST Employee
Posted on March 17, 2015 at 11:54

Hi Stivy,

Is it possible for you to create a new project from scratch (not based on old .ioc file which should have been created with an old CubeMX version containing some bugs).

Now use the CubeMX 4.6.

I know, this is not aligned with CubeMX purpose & you may loose some time to re-do configuration, but this way should be cleaner.

-Mayla-

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

Posted on March 17, 2015 at 16:44

Perhaps someone at ST should undertake that task, and do a diff on the output, so they fully understand the issue, and can perhaps provide a script or other method to cleanup and fix bad files, or provide an ''import'' function that can recover enough pertinent detail from the original file?

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
st239955_stm1
Associate II
Posted on March 26, 2015 at 17:40

Hi,

I've just created a new project with the latest version of cube. 

The problem is still the same with ADC2 ! When I configure the injected channels the first time it is OK. But when I close then relaunch Cube, the number of injected conversions is reset to 0 ! And when I try to put the right number, the channels are added but the old previous ones stay there and it is a mess. 

The only workaround is to accept that the number of injected conversion is still 0 and change it manually in the main.c ; but it is lost for further code generation. 

Please, can someone solve really this problem ? 

st239955_stm1
Associate II
Posted on September 22, 2015 at 10:01

Hi there,

It's been 6 month and still no bugfix. Can the ST team handle this ?

Thanks a lot,

Posted on September 22, 2015 at 15:22

Hi Stivy,

Which version of CubeMx are you using?

I am using CubeMx 4.10.0, I  generated a code for ADC2 and I set a number for injected conversion mode. If I close CubeMx and reload the *.ioc file, the generated number for injected conversion mode still the same and is not reset to 0.

-Shahrzad-

st239955_stm1
Associate II
Posted on March 25, 2016 at 11:07

Hi,

Indeed, it has been a long time and lots of bugfixes have been done since my post.

It seems to be ok now. 

We can close this bu and mark this topic as solved 🙂

Thanks.

John Smith
Associate II
Posted on May 04, 2016 at 09:48

Hi. I have similar problem with STM32L152RBT6.

Generated code is

/**Configures for the selected ADC injected channel its corresponding rank in the sequencer and its sample time 
*/
sConfigInjected.InjectedChannel = ADC_CHANNEL_0;
sConfigInjected.InjectedRank = 1;
sConfigInjected.InjectedSamplingTime = ADC_SAMPLETIME_4CYCLES;
sConfigInjected.InjectedOffset = 0;
sConfigInjected.ExternalTrigInjecConvEdge = ADC_EXTERNALTRIGINJECCONV_EDGE_NONE;
HAL_ADCEx_InjectedConfigChannel(&hadc, &sConfigInjected);

But this strings are missed:

sConfigInjected.ExternalTrigInjecConv = ADC_INJECTED_SOFTWARE_START;
sConfigInjected.InjectedNbrOfConversion = 4;

This is adc configuration window 0690X00000603N8QAI.jpg I'm using STM32CubeMX 4.0 Firmware Package Name and Version : STM32Cube FW_L1 V1.5.0