cancel
Showing results for 
Search instead for 
Did you mean: 

(STM32H743IIT6) STM32CubeMX config ADC in wrong for LL Library

Windmill_City
Associate

I found that the ADC sample is wrong when I use LL library, and it is correct when using HAL library.

Windmill_City_0-1732786574606.png

By comparing the registers, I found the code generated for LL library missing a sentence;

 

 

LL_ADC_SetChannelPreSelection(ADC1, LL_ADC_CHANNEL_19);

 

 

And when I config the ADC using DMA to transfer, it doesn't work;

Windmill_City_1-1732786958696.png

I added the following code manually, and it works.

 

 

LL_ADC_REG_SetDataTransferMode(ADC1, LL_ADC_REG_DMA_TRANSFER_UNLIMITED);

 

 

 I configure the VREFBUF to use externel reference, but this seems generate nothing.

Windmill_City_2-1732787054447.png

I added the following code manually, and it works.

 

 

LL_APB4_GRP1_EnableClock(LL_APB4_GRP1_PERIPH_VREF);
SET_BIT(VREFBUF->CSR, VREFBUF_CSR_HIZ);

 

 

Can these bugs get fix?

3 REPLIES 3
STTwo-32
ST Employee

Hello @Windmill_City and welcome to the ST Community.

Are you using the last version of the CubeMX (V6.13.0). If no please try using this version. If you still have the same issue with this product, pelase share your .ioc file.

Best Regards.

STTwo-32 

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.

Already the latest version

Hello @Windmill_City 

First let me thank you for posting.

Concerning the missing line of code 

 

 

 

LL_ADC_SetChannelPreSelection(ADC1, LL_ADC_CHANNEL_19);

 

 

 

Actually , this is a known issue has been tracked by the Ticket 189311 and will be fixed asap.

Concerning the VREFBUF issue , after checking the stm32h7xx_hal_msp.c : the generated code is correct , VREF clock is enabled and 

 

SET_BIT(VREFBUF->CSR, VREFBUF_CSR_HIZ);

 

is done inside the call  

 

  HAL_SYSCFG_VREFBUF_HighImpedanceConfig(SYSCFG_VREFBUF_HIGH_IMPEDANCE_ENABLE);
void HAL_MspInit(void)
{

  /* USER CODE BEGIN MspInit 0 */

  /* USER CODE END MspInit 0 */

  __HAL_RCC_SYSCFG_CLK_ENABLE();

  /* System interrupt init*/

  /** Enable the VREF clock
  */
  __HAL_RCC_VREF_CLK_ENABLE();

  /** Disable the Internal Voltage Reference buffer
  */
  HAL_SYSCFG_DisableVREFBUF();

  /** Configure the internal voltage reference buffer high impedance mode
  */
  HAL_SYSCFG_VREFBUF_HighImpedanceConfig(SYSCFG_VREFBUF_HIGH_IMPEDANCE_ENABLE);

  /* USER CODE BEGIN MspInit 1 */

  /* USER CODE END MspInit 1 */
}

 

Concerning the other issue of missing code 

LL_ADC_REG_SetDataTransferMode(ADC1, LL_ADC_REG_DMA_TRANSFER_UNLIMITED);

a ticket  197360  has been raised to dev team for fix 

THX

Ghofrane