Skip to main content
gil_dobjanschi
Associate III
June 17, 2026
Question

assert when DAC output pin is initialized (using HAL 2.1.0)

  • June 17, 2026
  • 1 reply
  • 35 views

Hello,

 

I started using HAL 2.1.0 which was available as a Pack download in MX2. I recompiled my application and I observed an assert during the DAC initialization in mx_dac1_init when HAL_GPIO_Init is called.

  hal_gpio_config_t  gpio_config;

/**
[GPIO Pin] ------> [Signal Name] ------> [Labels]

PA4 ------> DAC1_OUT1 ------> PA4
**/
gpio_config.mode = HAL_GPIO_MODE_ANALOG;
HAL_GPIO_Init(PA4_PORT, PA4_PIN, &gpio_config);

Inside the HAL_GPIO_Init the assert occurs due to an incorrect pull mode.

    if ((mode != LL_GPIO_MODE_ANALOG) || ((mode == LL_GPIO_MODE_ANALOG) && (p_config->pull != HAL_GPIO_PULL_UP)))
{
// I commented out this line
//ASSERT_DBG_PARAM(IS_GPIO_PULL(p_config->pull));

LL_GPIO_SetPinPull(p_gpio, io_msk, (uint32_t)p_config->pull);
}

I checked the MX2 configuration of the DAC output pin and the pull field is empty and cannot be changed (see screenshot). I attached the ioc2 file for reference.

The code was working without issues in HAL 2.0.0.

Regards,

-Gil

1 reply

ST Technical Moderator
June 17, 2026

Hello ​@gil_dobjanschi 

I used your .ioc2 file to generate the code and ran it on the NUCLEO-C562RE board. There were no assertion issues.
The pull mode was set to HAL_GPIO_PULL_DOWN.

 

In order to give better visibility on the answered topics, please click on 'Best answer' on the reply which solved your issue or answered your question. Saket_Om
gil_dobjanschi
Associate III
June 17, 2026

That’s strange, in my case it is different.

 

 

I wish I can set the pull value but the field in MX2 is disabled. I don’t understand why the MX2 generated code that initializes the gpio_config does not set the ‘pull’ value to a particular value if it is later checked by the assert.

 

Regards,

-Gil

ST Technical Moderator
June 17, 2026

Hello ​@gil_dobjanschi 

I reported this internally.

Internal ticket number: CDM0063599 (This is an internal tracking number and is not accessible or usable by customers).

In order to give better visibility on the answered topics, please click on 'Best answer' on the reply which solved your issue or answered your question. Saket_Om