cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F091RC DAC PINA4 PINA5 not working

roboticsdev
Associate II

I have been following mastering stm32 book for a while now and checking out the tutorials from the st channel.

I was following the dac tutorial and I had a problem with outputting analog signals in pin A4.

I use eclipse IDE and i am imporing cube-mx files to the default stm project created in eclipse with a tool called CubeMXImporter.

So far, i didn't have any problem with the tool so I really don't know the reason.

my main.c file and hal_msp file is attached below if you would like to take a look.

 

include "main.h"

/* Private includes ----------------------------------------------------------*/
/* USER CODE BEGIN Includes */

/* USER CODE END Includes */

/* Private typedef -----------------------------------------------------------*/
/* USER CODE BEGIN PTD */

/* USER CODE END PTD */

/* Private define ------------------------------------------------------------*/
/* USER CODE BEGIN PD */
/* USER CODE END PD */

/* Private macro -------------------------------------------------------------*/
/* USER CODE BEGIN PM */

/* USER CODE END PM */

/* Private variables ---------------------------------------------------------*/
DAC_HandleTypeDef hdac;

UART_HandleTypeDef huart2;

/* USER CODE BEGIN PV */
uint16_t dac_value = 0;
/* USER CODE END PV */

/* Private function prototypes -----------------------------------------------*/
void SystemClock_Config(void);
static void MX_GPIO_Init(void);
static void MX_DAC_Init(void);
static void MX_USART2_UART_Init(void);
/* USER CODE BEGIN PFP */

/* USER CODE END PFP */

/* Private user code ---------------------------------------------------------*/
/* USER CODE BEGIN 0 */

/* USER CODE END 0 */

/**
  * @brief  The application entry point.
  * @retval int
  */
int main(void)
{
  /* USER CODE BEGIN 1 */


  /* USER CODE END 1 */

  /* MCU Configuration--------------------------------------------------------*/

  /* Reset of all peripherals, Initializes the Flash interface and the Systick. */
  HAL_Init();

  /* USER CODE BEGIN Init */

  /* USER CODE END Init */

  /* Configure the system clock */
  SystemClock_Config();

  /* USER CODE BEGIN SysInit */

  /* USER CODE END SysInit */

  /* Initialize all configured peripherals */
  MX_GPIO_Init();
  MX_DAC_Init();
  MX_USART2_UART_Init();
  /* USER CODE BEGIN 2 */

  HAL_DAC_Init(&hdac);

  HAL_DAC_Start(&hdac, DAC_CHANNEL_2);
  /* USER CODE END 2 */
/*

  volatile uint32_t *GPIOC_MODER = 0x00, *GPIOC_ODR = 0x00;

  volatile uint32_t *GPIOB_MODER = 0X00, *GPIOB_ODR = 0x00;

  GPIOC_MODER = (uint32_t*)0x48000800; // address of the GPIOC MOder register

  GPIOC_ODR = (uint32_t*)(0x48000800 + 0x14); // address of the GPIOc->odr register


  GPIOB_MODER = (uint32_t*)0x48000400;

  GPIOB_ODR = (uint32_t*)(0x48000400 + 0x14);


  //__HAL_RCC_GPIOC_CLK_ENABLE();
  __HAL_RCC_GPIOB_CLK_ENABLE();



  *GPIOC_MODER = *GPIOC_MODER | 0x00000040; // setting c3 as output

  *GPIOB_MODER = *GPIOB_MODER | 0x00004000;


  *GPIOC_ODR = *GPIOC_ODR | 0x08;
*/
  while (1)
  {
	  HAL_DAC_SetValue(&hdac, DAC_CHANNEL_2, DAC_ALIGN_12B_R, dac_value);

	  if(dac_value < 4095)
	  {
		  dac_value++;
	  }
	  else
	  {
		  dac_value = 0;
	  }

	HAL_Delay(1);
  }
}

/**
  * @brief System Clock Configuration
  * @retval None
  */
void SystemClock_Config(void)
{
  RCC_OscInitTypeDef RCC_OscInitStruct = {0};
  RCC_ClkInitTypeDef RCC_ClkInitStruct = {0};
  RCC_PeriphCLKInitTypeDef PeriphClkInit = {0};

  /** Initializes the CPU, AHB and APB busses clocks 
  */
  RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI;
  RCC_OscInitStruct.HSIState = RCC_HSI_ON;
  RCC_OscInitStruct.HSICalibrationValue = RCC_HSICALIBRATION_DEFAULT;
  RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
  RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSI;
  RCC_OscInitStruct.PLL.PLLMUL = RCC_PLL_MUL12;
  RCC_OscInitStruct.PLL.PREDIV = RCC_PREDIV_DIV2;
  if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK)
  {
    Error_Handler();
  }
  /** Initializes the CPU, AHB and APB busses clocks 
  */
  RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK
                              |RCC_CLOCKTYPE_PCLK1;
  RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK;
  RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1;
  RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV1;

  if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_1) != HAL_OK)
  {
    Error_Handler();
  }
  PeriphClkInit.PeriphClockSelection = RCC_PERIPHCLK_USART2;
  PeriphClkInit.Usart2ClockSelection = RCC_USART2CLKSOURCE_PCLK1;
  if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInit) != HAL_OK)
  {
    Error_Handler();
  }
}

/**
  * @brief DAC Initialization Function
  * @PAram None
  * @retval None
  */
static void MX_DAC_Init(void)
{

  /* USER CODE BEGIN DAC_Init 0 */

  /* USER CODE END DAC_Init 0 */

  DAC_ChannelConfTypeDef sConfig = {0};
  /* USER CODE BEGIN DAC_Init 1 */




  /* USER CODE END DAC_Init 1 */
  /** DAC Initialization 
  */
  hdac.Instance = DAC;
  if (HAL_DAC_Init(&hdac) != HAL_OK)
  {
    Error_Handler();
  }
  /** DAC channel OUT2 config 
  */
  sConfig.DAC_Trigger = DAC_TRIGGER_NONE;
  sConfig.DAC_OutputBuffer = DAC_OUTPUTBUFFER_ENABLE;
  if (HAL_DAC_ConfigChannel(&hdac, &sConfig, DAC_CHANNEL_2) != HAL_OK)
  {
    Error_Handler();
  }
  /* USER CODE BEGIN DAC_Init 2 */
 /* USER CODE END DAC_Init 2 */

}

/**
  * @brief USART2 Initialization Function
  * @PAram None
  * @retval None
  */
static void MX_USART2_UART_Init(void)
{

  /* USER CODE BEGIN USART2_Init 0 */

  /* USER CODE END USART2_Init 0 */

  /* USER CODE BEGIN USART2_Init 1 */

  /* USER CODE END USART2_Init 1 */
  huart2.Instance = USART2;
  huart2.Init.BaudRate = 115200;
  huart2.Init.WordLength = UART_WORDLENGTH_8B;
  huart2.Init.StopBits = UART_STOPBITS_1;
  huart2.Init.Parity = UART_PARITY_NONE;
  huart2.Init.Mode = UART_MODE_TX_RX;
  huart2.Init.HwFlowCtl = UART_HWCONTROL_NONE;
  huart2.Init.OverSampling = UART_OVERSAMPLING_16;
  huart2.Init.OneBitSampling = UART_ONE_BIT_SAMPLE_DISABLE;
  huart2.AdvancedInit.AdvFeatureInit = UART_ADVFEATURE_NO_INIT;
  if (HAL_UART_Init(&huart2) != HAL_OK)
  {
    Error_Handler();
  }
  /* USER CODE BEGIN USART2_Init 2 */

  /* USER CODE END USART2_Init 2 */

}

/**
  * @brief GPIO Initialization Function
  * @PAram None
  * @retval None
  */
static void MX_GPIO_Init(void)
{
  GPIO_InitTypeDef GPIO_InitStruct = {0};

  /* GPIO Ports Clock Enable */
  __HAL_RCC_GPIOC_CLK_ENABLE();
  __HAL_RCC_GPIOF_CLK_ENABLE();
  __HAL_RCC_GPIOA_CLK_ENABLE();
/*
  /*Configure GPIO pin : B1_Pinj*/


  GPIO_InitStruct.Pin = B1_Pin;
  GPIO_InitStruct.Mode = GPIO_MODE_IT_FALLING;
  GPIO_InitStruct.Pull = GPIO_NOPULL;
  HAL_GPIO_Init(B1_GPIO_Port, &GPIO_InitStruct);
}

/* USER CODE BEGIN 4 */

/* USER CODE END 4 */

/**
  * @brief  This function is executed in case of error occurrence.
  * @retval None
  */
void Error_Handler(void)
{
  /* USER CODE BEGIN Error_Handler_Debug */
  /* User can add his own implementation to report the HAL error return state */

  /* USER CODE END Error_Handler_Debug */
}

#ifdef  USE_FULL_ASSERT
/**
  * @brief  Reports the name of the source file and the source line number
  *         where the assert_param error has occurred.
  * @PAram  file: pointer to the source file name
  * @PAram  line: assert_param error line source number
  * @retval None
  */
void assert_failed(uint8_t *file, uint32_t line)
{ 
  /* USER CODE BEGIN 6 */
  /* User can add his own implementation to report the file name and line number,
     tex: printf("Wrong parameters value: file %s on line %d\r\n", file, line) */
  /* USER CODE END 6 */
}
#endif /* USE_FULL_ASSERT */

/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

 

hal_msp file

/* USER CODE BEGIN Header */
/**
  ******************************************************************************
  * File Name          : stm32f0xx_hal_msp.c
  * Description        : This file provides code for the MSP Initialization 
  *                      and de-Initialization codes.
  ******************************************************************************
  * @attention
  *
  * <h2><center>&copy; Copyright (c) 2023 STMicroelectronics.
  * All rights reserved.</center></h2>
  *
  * This software component is licensed by ST under BSD 3-Clause license,
  * the "License"; You may not use this file except in compliance with the
  * License. You may obtain a copy of the License at:
  *                        opensource.org/licenses/BSD-3-Clause
  *
  ******************************************************************************
  */
/* USER CODE END Header */

/* Includes ------------------------------------------------------------------*/
#include "main.h"
/* USER CODE BEGIN Includes */

/* USER CODE END Includes */

/* Private typedef -----------------------------------------------------------*/
/* USER CODE BEGIN TD */

/* USER CODE END TD */

/* Private define ------------------------------------------------------------*/
/* USER CODE BEGIN Define */
 
/* USER CODE END Define */

/* Private macro -------------------------------------------------------------*/
/* USER CODE BEGIN Macro */

/* USER CODE END Macro */

/* Private variables ---------------------------------------------------------*/
/* USER CODE BEGIN PV */

/* USER CODE END PV */

/* Private function prototypes -----------------------------------------------*/
/* USER CODE BEGIN PFP */

/* USER CODE END PFP */

/* External functions --------------------------------------------------------*/
/* USER CODE BEGIN ExternalFunctions */

/* USER CODE END ExternalFunctions */

/* USER CODE BEGIN 0 */

/* USER CODE END 0 */
/**
  * Initializes the Global MSP.
  */
void HAL_MspInit(void)
{
  /* USER CODE BEGIN MspInit 0 */

  /* USER CODE END MspInit 0 */

  __HAL_RCC_SYSCFG_CLK_ENABLE();
  __HAL_RCC_PWR_CLK_ENABLE();

  /* System interrupt init*/

  /* USER CODE BEGIN MspInit 1 */

  /* USER CODE END MspInit 1 */
}

/**
* @brief DAC MSP Initialization
* This function configures the hardware resources used in this example
* @PAram hdac: DAC handle pointer
* @retval None
*/
void HAL_DAC_MspInit(DAC_HandleTypeDef* hdac)
{
  GPIO_InitTypeDef GPIO_InitStruct = {0};
  if(hdac->Instance==DAC)
  {
  /* USER CODE BEGIN DAC_MspInit 0 */

  /* USER CODE END DAC_MspInit 0 */
    /* Peripheral clock enable */
    __HAL_RCC_DAC1_CLK_ENABLE();


    __HAL_RCC_GPIOA_CLK_ENABLE();
    /**DAC GPIO Configuration    
    PA5     ------> DAC_OUT2 
    */
    GPIO_InitStruct.Pin = GPIO_PIN_4;
    GPIO_InitStruct.Mode = GPIO_MODE_ANALOG;
    GPIO_InitStruct.Pull = GPIO_NOPULL;
    HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);

  /* USER CODE BEGIN DAC_MspInit 1 */

  /* USER CODE END DAC_MspInit 1 */
  }

}

/**
* @brief DAC MSP De-Initialization
* This function freeze the hardware resources used in this example
* @PAram hdac: DAC handle pointer
* @retval None
*/
void HAL_DAC_MspDeInit(DAC_HandleTypeDef* hdac)
{
  if(hdac->Instance==DAC)
  {
  /* USER CODE BEGIN DAC_MspDeInit 0 */

  /* USER CODE END DAC_MspDeInit 0 */
    /* Peripheral clock disable */
    __HAL_RCC_DAC1_CLK_DISABLE();
  
    /**DAC GPIO Configuration    
    PA5     ------> DAC_OUT2 
    */
    HAL_GPIO_DeInit(GPIOA, GPIO_PIN_4);

  /* USER CODE BEGIN DAC_MspDeInit 1 */

  /* USER CODE END DAC_MspDeInit 1 */
  }

}

/**
* @brief UART MSP Initialization
* This function configures the hardware resources used in this example
* @PAram huart: UART handle pointer
* @retval None
*/
void HAL_UART_MspInit(UART_HandleTypeDef* huart)
{
  GPIO_InitTypeDef GPIO_InitStruct = {0};
  if(huart->Instance==USART2)
  {
  /* USER CODE BEGIN USART2_MspInit 0 */

  /* USER CODE END USART2_MspInit 0 */
    /* Peripheral clock enable */
    __HAL_RCC_USART2_CLK_ENABLE();
  
    __HAL_RCC_GPIOA_CLK_ENABLE();
    /**USART2 GPIO Configuration    
    PA2     ------> USART2_TX
    PA3     ------> USART2_RX 
    */
    GPIO_InitStruct.Pin = USART_TX_Pin|USART_RX_Pin;
    GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
    GPIO_InitStruct.Pull = GPIO_NOPULL;
    GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
    GPIO_InitStruct.Alternate = GPIO_AF1_USART2;
    HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);

  /* USER CODE BEGIN USART2_MspInit 1 */

  /* USER CODE END USART2_MspInit 1 */
  }

}

/**
* @brief UART MSP De-Initialization
* This function freeze the hardware resources used in this example
* @PAram huart: UART handle pointer
* @retval None
*/
void HAL_UART_MspDeInit(UART_HandleTypeDef* huart)
{
  if(huart->Instance==USART2)
  {
  /* USER CODE BEGIN USART2_MspDeInit 0 */

  /* USER CODE END USART2_MspDeInit 0 */
    /* Peripheral clock disable */
    __HAL_RCC_USART2_CLK_DISABLE();
  
    /**USART2 GPIO Configuration    
    PA2     ------> USART2_TX
    PA3     ------> USART2_RX 
    */
    HAL_GPIO_DeInit(GPIOA, USART_TX_Pin|USART_RX_Pin);

  /* USER CODE BEGIN USART2_MspDeInit 1 */

  /* USER CODE END USART2_MspDeInit 1 */
  }

}

/* USER CODE BEGIN 1 */

/* USER CODE END 1 */

/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

 

1 ACCEPTED SOLUTION

Accepted Solutions
roboticsdev
Associate II

Well, turns out that PA5 is actually connected to PD13 and the signal is outputted in that pin. But I really don't know why PA5 pin doesn't show it up.

View solution in original post

11 REPLIES 11
roboticsdev
Associate II

When i have debug the code, i realized that the execution stucks at

__weak uint32_t HAL_GetTick(void)

{

return uwTick;

}

i really don't know whats happening since i am a beginner.

Hello @roboticsdev 

I think it can be a clock configuration problem. Can you share your .ioc file.

Also, is going to be better if you start your project from one of those two ready to use DAC exemples. Than, you can add other parts (UART,...).

Best regards.

II

Hello, I searched my project directory with
find . -name *.ioc  but i couldn't find any file with .ioc extension .

by the way, my project format is sw4stm32 and i am using the last version of MX that supports this.

 

 

 

What I'm asking for is the CubeMX configuration of your project.

Best regards.

II

#MicroXplorer Configuration settings - do not modify
Mcu.Family=STM32F0
ProjectManager.MainLocation=Src
SH.COMP_DAC1_group.0=DAC_OUT1,DAC_OUT1
PA2.GPIO_PuPd=GPIO_NOPULL
RCC.I2SFreq_Value=48000000
RCC.MCOFreq_Value=48000000
RCC.USART1Freq_Value=48000000
ProjectManager.ProjectFileName=dac_pin5_out.ioc
USART2.IPParameters=VirtualMode,VirtualMode-Asynchronous
ProjectManager.KeepUserCode=true
Mcu.UserName=STM32F091RCTx
Mcu.PinsNb=10
ProjectManager.NoMain=false
PC15OSC32_OUT.Locked=true
PC15OSC32_OUT.Signal=RCC_OSC32_OUT
RCC.PLLCLKFreq_Value=48000000
PA14.GPIO_Label=TCK
PA3.GPIO_PuPd=GPIO_NOPULL
ProjectManager.functionlistsort=1-MX_GPIO_Init-GPIO-false-HAL-true,2-SystemClock_Config-RCC-false-HAL-false,3-MX_DAC_Init-DAC-false-HAL-true,4-MX_USART2_UART_Init-USART2-false-HAL-true
PA2.GPIO_Speed=GPIO_SPEED_FREQ_LOW
PA3.GPIOParameters=GPIO_Speed,GPIO_PuPd,GPIO_Label,GPIO_Mode
ProjectManager.DefaultFWLocation=true
RCC.USART2Freq_Value=48000000
NVIC.SVC_IRQn=true\:0\:0\:false\:false\:true\:false\:false
ProjectManager.DeletePrevious=true
PF1-OSC_OUT.Locked=true
PC15OSC32_OUT.Mode=LSE-External-Oscillator
PA3.GPIO_Speed=GPIO_SPEED_FREQ_LOW
boardIOC=true
PA2.GPIOParameters=GPIO_Speed,GPIO_PuPd,GPIO_Label,GPIO_Mode
PinOutPanel.RotationAngle=0
RCC.FamilyName=M
RCC.SYSCLKSource=RCC_SYSCLKSOURCE_PLLCLK
ProjectManager.StackSize=0x400
PC14OSC32_IN.Locked=true
PA3.Mode=Asynchronous
PA13.Signal=SYS_SWDIO
Mcu.IP4=USART2
RCC.FCLKCortexFreq_Value=48000000
Mcu.IP2=RCC
Mcu.IP3=SYS
Mcu.IP0=DAC
Mcu.IP1=NVIC
Mcu.UserConstants=
ProjectManager.TargetToolchain=SW4STM32
Mcu.ThirdPartyNb=0
PA3.GPIO_Mode=GPIO_MODE_AF_PP
RCC.HCLKFreq_Value=48000000
Mcu.IPNb=5
ProjectManager.PreviousToolchain=SW4STM32
Mcu.Pin6=PA4
RCC.PLLDivider=RCC_PREDIV_DIV2
Mcu.Pin7=PA13
Mcu.Pin8=PA14
Mcu.Pin9=VP_SYS_VS_Systick
RCC.AHBFreq_Value=48000000
Mcu.Pin0=PC14OSC32_IN
Mcu.Pin1=PC15OSC32_OUT
PF0-OSC_IN.Mode=HSE-External-Clock-Source
GPIO.groupedBy=Group By Peripherals
Mcu.Pin2=PF0-OSC_IN
RCC.PREFETCH_ENABLE-AdvancedSettings=1
Mcu.Pin3=PF1-OSC_OUT
RCC.USART3Freq_Value=48000000
Mcu.Pin4=PA2
Mcu.Pin5=PA3
ProjectManager.ProjectBuild=false
board=NUCLEO-F091RC
USART2.VirtualMode-Asynchronous=VM_ASYNC
NVIC.SysTick_IRQn=true\:0\:0\:true\:false\:true\:true\:true
ProjectManager.LastFirmware=true
RCC.PLLMUL=RCC_PLL_MUL12
ProjectManager.FirmwarePackage=STM32Cube FW_F0 V1.11.3
MxDb.Version=DB.5.0.60
ProjectManager.BackupPrevious=false
MxCube.Version=5.6.1
PA14.Mode=Serial_Wire
PF0-OSC_IN.Locked=true
File.Version=6
VP_SYS_VS_Systick.Mode=SysTick
NVIC.NonMaskableInt_IRQn=true\:0\:0\:false\:false\:true\:false\:false
NVIC.PendSV_IRQn=true\:0\:0\:false\:false\:true\:false\:false
PA13.Mode=Serial_Wire
ProjectManager.FreePins=false
RCC.IPParameters=AHBFreq_Value,APB1Freq_Value,APB1TimFreq_Value,CECFreq_Value,FCLKCortexFreq_Value,FLatency-AdvancedSettings,FamilyName,HCLKFreq_Value,HSICECFreq_Value,I2SFreq_Value,MCOFreq_Value,PLLCLKFreq_Value,PLLDivider,PLLMCOFreq_Value,PLLMUL,PREFETCH_ENABLE-AdvancedSettings,SYSCLKFreq_VALUE,SYSCLKSource,TimSysFreq_Value,USART1Freq_Value,USART2Freq_Value,USART3Freq_Value
ProjectManager.AskForMigrate=true
Mcu.Name=STM32F091R(B-C)Tx
ProjectManager.HalAssertFull=false
PA2.Signal=USART2_TX
PA13.GPIO_Label=TMS
ProjectManager.ProjectName=dac_pin5_out
ProjectManager.UnderRoot=true
RCC.FLatency-AdvancedSettings=FLASH_LATENCY_1
RCC.HSICECFreq_Value=32786.88524590164
PA13.GPIOParameters=GPIO_Label
RCC.PLLMCOFreq_Value=48000000
ProjectManager.CoupleFile=false
PC14OSC32_IN.Mode=LSE-External-Oscillator
PA4.Signal=COMP_DAC1_group
RCC.SYSCLKFreq_VALUE=48000000
Mcu.Package=LQFP64
RCC.TimSysFreq_Value=48000000
PA3.Locked=true
NVIC.ForceEnableDMAVector=true
KeepUserPlacement=false
USART2.VirtualMode=VM_ASYNC
SH.COMP_DAC1_group.ConfNb=1
PA14.GPIOParameters=GPIO_Label
PA14.Locked=true
PA13.Locked=true
ProjectManager.CompilerOptimize=6
ProjectManager.ToolChainLocation=
PA2.GPIO_Label=USART_TX
VP_SYS_VS_Systick.Signal=SYS_VS_Systick
PA14.Signal=SYS_SWCLK
ProjectManager.HeapSize=0x200
NVIC.HardFault_IRQn=true\:0\:0\:false\:false\:true\:false\:false
ProjectManager.ComputerToolchain=false
RCC.CECFreq_Value=32786.88524590164
RCC.APB1TimFreq_Value=48000000
PA2.Mode=Asynchronous
PF0-OSC_IN.Signal=RCC_OSC_IN
RCC.APB1Freq_Value=48000000
ProjectManager.CustomerFirmwarePackage=
ProjectManager.DeviceId=STM32F091RCTx
PF1-OSC_OUT.Signal=RCC_OSC_OUT
ProjectManager.LibraryCopy=1
PC14OSC32_IN.Signal=RCC_OSC32_IN
PA3.GPIO_Label=USART_RX
PA3.Signal=USART2_RX
PA2.GPIO_Mode=GPIO_MODE_AF_PP
PA2.Locked=true

the same codes, except, pin_a5 is set as the output channel in this example, it also doesn't work like pa4.

By the way, I suggest you to use ST tools ( CubeMX and CubeIDE). To migrate your project from SW4STM32 to CubeIDE, you can refer to the UM2579.

Best regards.

II

roboticsdev
Associate II

Hello, thanks for the help really, i really don't know the reason, but PA2 pin show the output in DAC and not PA5 , I really don't know why.
Screenshot from 2023-09-23 21-12-28.png

does this output mean that i have a problem with my board ? because PA5 and PA2 are not connected in any way from the schematics.
Screenshot from 2023-09-23 21-21-36.png