cancel
Showing results for 
Search instead for 
Did you mean: 

STM32H563 DAC1

mccabehm
Associate III

I used CubeMX 6.12 to generate code and DAC output works as intended.

I cloned that project, migrated to CubeMX 6.13 and generated code. DAC output doesn't work. Migration to 6.13 also used FW H5 1.4 instead of 1.3.

Comparing stm32h5xx_hal_msp.c I see the 6.13 generated code lacks

RCC_PeriphCLKInitTypeDef PeriphClkInitStruct = {0};
if(hdac->Instance==DAC1)
{
  /* USER CODE BEGIN DAC1_MspInit 0 */

  /* USER CODE END DAC1_MspInit 0 */

  /** Initializes the peripherals clock
  */
  PeriphClkInitStruct.PeriphClockSelection = RCC_PERIPHCLK_DAC;
  if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInitStruct) != HAL_OK)
  {
      Error_Handler();
  }
}

in HAL_DAC_MspInit(). When I add the above code to stm32h5xx_hal_msp.c in the migrated project, DAC output works as expected.

No significant differences between the IOC files.

Is there a problem with CubeMX 6.13?

Attaching STM32H563VIT6_2.ioc (original, CubeMX 6.12, DAC works) and NGC_HW_Verification_Clone.ioc (cloned, CubeMX 6.13, DAC doesn't work).

9 REPLIES 9
AScha.3
Chief III

What its doing, if you select using FW H5 1.3 again ?

If you feel a post has answered your question, please click "Accept as Solution".

I do not know how to revert a project to an earlier CubeMX and FW version. Using STM32CubeIDE v1.17

go : menu -> help -> configuration tool -> manage embedded...

then:

AScha3_0-1738954668597.png

select (green button) to delete...and select other version -> green = active is the most recent/newest.

So deselect 1.4  on H5.

btw

You see, i still use 1.11.2 H7 - why should i update, if everything i use is working fine ?

Just to find new errors...?

If you feel a post has answered your question, please click "Accept as Solution".
mccabehm
Associate III

I had to update to get correct VREFBUF handling for H563.

Deselecting H5 1.4 won't affect existing project. From what I've seen, this is only used when a project is created. The only H5 1.4 options are Refresh and Remove...

mccabehm_0-1738957252611.png

 

So you need to use v 1.4 ? (as i understand it...)

>From what I've seen, this is only used when a project is created.

try: open Mx view, then generate code . -> compile and check it...

 

If you feel a post has answered your question, please click "Accept as Solution".

Hello @mccabehm ,

First let me thank you for posting.

Your request is under investigation, and I will get back to you ASAP.

Thanks.

Mahmoud

Hello @mccabehm @AScha.3 ,

 

Thank you for reporting this issue.

I am escalating an internal ticket to the concerned Team (ticket number: 202681).

 

Best Regards.

Mahmoud

mccabehm
Associate III

CubeMX 6.13 DAC1 configuration...

mccabehm_4-1739462113340.png

 

CubeMX 6.12 configuration...

mccabehm_5-1739462164100.png

mccabehm
Associate III

Good DAC output...

scope_0.png

 

Bad DAC output...

scope_1.png

Amplitude is ~6v because of an op-amp downstream of the DAC1 channel 1 MCU pin. Scope trace taken at the MCU pin looks the same, except amplitude is ~2.5v.

I am unwilling to supply more information related to this issue. CubeMX 6.12 generates this required initialization code for the DAC

  RCC_PeriphCLKInitTypeDef PeriphClkInitStruct = {0};

  PeriphClkInitStruct.PeriphClockSelection = RCC_PERIPHCLK_DAC;
  if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInitStruct) != HAL_OK)
  {
    Error_Handler();
  }

CubeMX 6.13 does not. The DAC will not work without a clock. If this is not sufficient to identify the problem, I am sorry. I am using the DAC untriggered, probably not normal. My requirement for DAC frequency is very low (< 20 Hz) so I don't need SW or HW triggering yet. This issue is also documented in https://community.st.com/t5/stm32-mcus-products/stm32h563vit6-dac1-output-unexpected/td-p/769306 and presents similar info.