cancel
Showing results for 
Search instead for 
Did you mean: 

Bug in LL_ADC_REG_SetSequencerRanks() at stm32h7xx_ll_adc.h

FBaev.1
Associate II

For Channel=5 and Rank=1 the result is ADC_SQR1=0xA (incorrect).

Should be 0x140.

1 ACCEPTED SOLUTION

Accepted Solutions
FBaev.1
Associate II

Dear Kaouthar,

Thank you for your support.

The issue was on my side.

Of course, I modified the structure element (in main.c) by hand and did not realize that the Rank=1 corresponds to:

sConfig.Rank = ADC_REGULAR_RANK_1;

but not:

sConfig.Rank = 1;

Best regards,

Fedor

View solution in original post

8 REPLIES 8
KDJEM.1
ST Employee

Hello @FBaev.1​ and welcome to the community 😊,

Could you please provide more details on the issue:

  • Which device/board and Cube firmware version are you using?
  • Which STM32CubeMX and STM32CubeIDE versions are you using?

Make sure to use latest release of tools and last STM32Cube FW_H7 V1.11.0 firmware package.

Thank you.

Kaouthar

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.

FBaev.1
Associate II

Hello Kaouthar,

Thank you for the reply.

I'm using the STM32CubeIDE Version: 1.12.0 and STM32Cube_FW_H7_V1.11.0.

The board is a proprietary one based on the STM32H743ZGT6.

The issue can be observed on any evaluation board.

Possible software example is "LwIP_HTTP_Server_Raw" for STM32H743I-EVAL board.

Best regards,

Fedor

KDJEM.1
ST Employee

Hello @FBaev.1​ ,

Thank you for this clarification.

I made some tests with Nucleo-H723ZG and I didn't find any issue and I get ADC_SQR1=0x140.

0693W00000aItJ3QAK.pngI will check again with Eval board and I will get back to you as soon as possible. 

Thank you.

Kaouthar

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.

FBaev.1
Associate II

Hello Kaouthar,

You wrote:

> I made some tests with Nucleo-H723ZG

How exactly you obtained the ADC_SQR1=0x140?

What is the MODIFY_REG formulae in the LL_ADC_REG_SetSequencerRanks() in your test project?

Thank you,

Fedor

KDJEM.1
ST Employee

Hi @FBaev.1​ ,

> How exactly you obtained the ADC_SQR1=0x140?

  • Enable the ADC1 with Channel=5 and Rank=1 with STM32CubeMx6.7.0 version.

0693W00000aItV9QAK.png 

  • Generate the code with LL using STM32CubeIDE 1.12.0.
  • Debug project and execute the code step by step.
  • Check the ADC_SQR1 register value in the SFRs. In this case the ADC_SQR1 =0x140.

The MODIFY_REG formula in the LL_ADC_REG_SetSequencerRanks() is

MODIFY_REG(*preg, ADC_CHANNEL_ID_NUMBER_MASK_POSBIT0 << (Rank & ADC_REG_RANK_ID_SQRX_MASK), ((Channel & ADC_CHANNEL_ID_NUMBER_MASK) >> ADC_CHANNEL_ID_NUMBER_BITOFFSET_POS) << (Rank ADC_REG_RANK_ID_SQRX_MASK));

Also with the STM32H757I-Eval board, with Channel=5 and Rank=1, the ADC_SQR1=0x140.

I hope this help you to solve the issue 🙂 !

Kaouthar

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.

FBaev.1
Associate II

I performed the same steps - i.e.

  • Generate the code with LL using STM32CubeIDE 1.12.0.
  • Debug project and execute the code step by step.
  • Check the ADC_SQR1 register value in the SFRs.

and see that ADC_SQR1=0xA .

Still not clear how:

((Channel & ADC_CHANNEL_ID_NUMBER_MASK) >> ADC_CHANNEL_ID_NUMBER_BITOFFSET_POS) << (Rank & ADC_REG_RANK_ID_SQRX_MASK)

can be evaluated for 0x140 for Channel=5 and Rank=1.

FBaev.1
Associate II

Dear Kaouthar,

Thank you for your support.

The issue was on my side.

Of course, I modified the structure element (in main.c) by hand and did not realize that the Rank=1 corresponds to:

sConfig.Rank = ADC_REGULAR_RANK_1;

but not:

sConfig.Rank = 1;

Best regards,

Fedor

KDJEM.1
ST Employee

Hello @FBaev.1​ ,

Glad to know that the issue is already fixed.

Thank you for your contribution in STCommunity 🙂 .

Kaouthar

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.