2024-06-13 02:52 AM - last edited on 2024-06-13 03:12 AM by SofLit
Hello,
Am working on STM32L412RBT6.
We made a custom PCB for our product and Am trying to PD2 as digital output as toggle function.
I can't able to find any high output at PD2. The pin PD2 is always remains low.
Please help me on this
Solved! Go to Solution.
2024-06-16 11:19 PM
Yeah Sure
2024-06-13 03:09 AM
Insufficient information!
Are you able to toggle any other pins?
Are you sure that your code to toggle the pin is actually getting executed?
Have you checked for hardware faults/errors on the board?
You'll need to show your board schematic, and a minimum but complete code example which demonstrates the problem.
Please use this button to properly post source code:
2024-06-13 03:10 AM - edited 2024-06-13 03:12 AM
Hello and welcome to the community.
Could you please share the schematics?
Could you please share the code that toggles PD2?
Are you sure that PD2 is not connected to anything else on your HW and forcing the IO to low?
2024-06-13 06:56 AM
/* USER CODE BEGIN Header */
/**
******************************************************************************
* @file stm32l4xx_it.c
* @brief Interrupt Service Routines.
******************************************************************************
* @attention
*
* Copyright (c) 2024 STMicroelectronics.
* All rights reserved.
*
* This software is licensed under terms that can be found in the LICENSE file
* in the root directory of this software component.
* If no LICENSE file comes with this software, it is provided AS-IS.
*
******************************************************************************
*/
/* USER CODE END Header */
/* Includes ------------------------------------------------------------------*/
#include "main.h"
#include "stm32l4xx_it.h"
/* Private includes ----------------------------------------------------------*/
/* USER CODE BEGIN Includes */
#include "SoftStart.h"
#include "SinePWM.h"
/* USER CODE END Includes */
/* Private typedef -----------------------------------------------------------*/
/* USER CODE BEGIN TD */
/* USER CODE END TD */
/* Private define ------------------------------------------------------------*/
/* USER CODE BEGIN PD */
/* USER CODE END PD */
/* Private macro -------------------------------------------------------------*/
/* USER CODE BEGIN PM */
/* USER CODE END PM */
/* Private variables ---------------------------------------------------------*/
/* USER CODE BEGIN PV */
/* USER CODE END PV */
/* Private function prototypes -----------------------------------------------*/
/* USER CODE BEGIN PFP */
/* USER CODE END PFP */
/* Private user code ---------------------------------------------------------*/
/* USER CODE BEGIN 0 */
/* USER CODE END 0 */
/* External variables --------------------------------------------------------*/
extern TIM_HandleTypeDef htim2;
/* USER CODE BEGIN EV */
/* USER CODE END EV */
/******************************************************************************/
/* Cortex-M4 Processor Interruption and Exception Handlers */
/******************************************************************************/
/**
* @brief This function handles Non maskable interrupt.
*/
void NMI_Handler(void)
{
/* USER CODE BEGIN NonMaskableInt_IRQn 0 */
/* USER CODE END NonMaskableInt_IRQn 0 */
/* USER CODE BEGIN NonMaskableInt_IRQn 1 */
while (1) {
}
/* USER CODE END NonMaskableInt_IRQn 1 */
}
/**
* @brief This function handles Hard fault interrupt.
*/
void HardFault_Handler(void)
{
/* USER CODE BEGIN HardFault_IRQn 0 */
/* USER CODE END HardFault_IRQn 0 */
while (1)
{
/* USER CODE BEGIN W1_HardFault_IRQn 0 */
/* USER CODE END W1_HardFault_IRQn 0 */
}
}
/**
* @brief This function handles Memory management fault.
*/
void MemManage_Handler(void)
{
/* USER CODE BEGIN MemoryManagement_IRQn 0 */
/* USER CODE END MemoryManagement_IRQn 0 */
while (1)
{
/* USER CODE BEGIN W1_MemoryManagement_IRQn 0 */
/* USER CODE END W1_MemoryManagement_IRQn 0 */
}
}
/**
* @brief This function handles Prefetch fault, memory access fault.
*/
void BusFault_Handler(void)
{
/* USER CODE BEGIN BusFault_IRQn 0 */
/* USER CODE END BusFault_IRQn 0 */
while (1)
{
/* USER CODE BEGIN W1_BusFault_IRQn 0 */
/* USER CODE END W1_BusFault_IRQn 0 */
}
}
/**
* @brief This function handles Undefined instruction or illegal state.
*/
void UsageFault_Handler(void)
{
/* USER CODE BEGIN UsageFault_IRQn 0 */
/* USER CODE END UsageFault_IRQn 0 */
while (1)
{
/* USER CODE BEGIN W1_UsageFault_IRQn 0 */
/* USER CODE END W1_UsageFault_IRQn 0 */
}
}
/**
* @brief This function handles System service call via SWI instruction.
*/
void SVC_Handler(void)
{
/* USER CODE BEGIN SVCall_IRQn 0 */
/* USER CODE END SVCall_IRQn 0 */
/* USER CODE BEGIN SVCall_IRQn 1 */
/* USER CODE END SVCall_IRQn 1 */
}
/**
* @brief This function handles Debug monitor.
*/
void DebugMon_Handler(void)
{
/* USER CODE BEGIN DebugMonitor_IRQn 0 */
/* USER CODE END DebugMonitor_IRQn 0 */
/* USER CODE BEGIN DebugMonitor_IRQn 1 */
/* USER CODE END DebugMonitor_IRQn 1 */
}
/**
* @brief This function handles Pendable request for system service.
*/
void PendSV_Handler(void)
{
/* USER CODE BEGIN PendSV_IRQn 0 */
/* USER CODE END PendSV_IRQn 0 */
/* USER CODE BEGIN PendSV_IRQn 1 */
/* USER CODE END PendSV_IRQn 1 */
}
/**
* @brief This function handles System tick timer.
*/
void SysTick_Handler(void)
{
/* USER CODE BEGIN SysTick_IRQn 0 */
/* USER CODE END SysTick_IRQn 0 */
HAL_IncTick();
/* USER CODE BEGIN SysTick_IRQn 1 */
/* USER CODE END SysTick_IRQn 1 */
}
/******************************************************************************/
/* STM32L4xx Peripheral Interrupt Handlers */
/* Add here the Interrupt Handlers for the used peripherals. */
/* For the available peripheral interrupt handler names, */
/* please refer to the startup file (startup_stm32l4xx.s). */
/******************************************************************************/
/**
* @brief This function handles TIM2 global interrupt.
*/
void TIM2_IRQHandler(void)
{
/* USER CODE BEGIN TIM2_IRQn 0 */
/* USER CODE END TIM2_IRQn 0 */
HAL_TIM_IRQHandler(&htim2);
/* USER CODE BEGIN TIM2_IRQn 1 */
SoftStart();
HAL_GPIO_WritePin(GPIOH, GPIO_PIN_0, HIGH);
#ifdef SINEPWM
SinePWM();
#endif
#ifdef TOTEM_POLE_PWM
TotemPolePWM();
#endif
// HAL_GPIO_TogglePin(OC_Reset_GPIO_Port, OC_Reset_Pin);
// HAL_GPIO_TogglePin(RS485_TX_CNTRL_GPIO_Port, RS485_TX_CNTRL_Pin);
// HAL_GPIO_TogglePin(LCD_D7_GPIO_Port, LCD_D7_Pin);
// HAL_GPIO_TogglePin(LCD_RS_GPIO_Port, LCD_RS_Pin);
// HAL_GPIO_TogglePin(STS_PWR_ON_GPIO_Port, STS_PWR_ON_Pin);
// HAL_GPIO_TogglePin(ORANGE_LED_GPIO_Port, ORANGE_LED_Pin);
// HAL_GPIO_TogglePin(GREEN_LED_GPIO_Port, GREEN_LED_Pin);
// HAL_GPIO_TogglePin(RED_LED_GPIO_Port, RED_LED_Pin);
// HAL_GPIO_TogglePin(LCD_EN_GPIO_Port, LCD_EN_Pin);
// HAL_GPIO_TogglePin(LCD_D4_GPIO_Port, LCD_D4_Pin);
// HAL_GPIO_TogglePin(LCD_D5_GPIO_Port, LCD_D5_Pin);
HAL_GPIO_TogglePin(LCD_D6_GPIO_Port, LCD_D6_Pin);
// HAL_GPIO_TogglePin(RJ11_OVERLOAD_STS_GPIO_Port, RJ11_OVERLOAD_STS_Pin);
// HAL_GPIO_TogglePin(RJ11_OVERTEMP_STS_GPIO_Port, RJ11_OVERTEMP_STS_Pin);
HAL_GPIO_TogglePin(FAN_ON_OFF_GPIO_Port, FAN_ON_OFF_Pin);
HAL_GPIO_WritePin(GPIOH, GPIO_PIN_0, LOW);
/* USER CODE END TIM2_IRQn 1 */
}
/* USER CODE BEGIN 1 */
/* USER CODE END 1 */
/* USER CODE BEGIN Header */
/**
******************************************************************************
* @file : main.h
* @brief : Header for main.c file.
* This file contains the common defines of the application.
******************************************************************************
* @attention
*
* Copyright (c) 2024 STMicroelectronics.
* All rights reserved.
*
* This software is licensed under terms that can be found in the LICENSE file
* in the root directory of this software component.
* If no LICENSE file comes with this software, it is provided AS-IS.
*
******************************************************************************
*/
/* USER CODE END Header */
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __MAIN_H
#define __MAIN_H
#ifdef __cplusplus
extern "C" {
#endif
/* Includes ------------------------------------------------------------------*/
#include "stm32l4xx_hal.h"
/* Private includes ----------------------------------------------------------*/
/* USER CODE BEGIN Includes */
/* USER CODE END Includes */
/* Exported types ------------------------------------------------------------*/
/* USER CODE BEGIN ET */
/* USER CODE END ET */
/* Exported constants --------------------------------------------------------*/
/* USER CODE BEGIN EC */
/* USER CODE END EC */
/* Exported macro ------------------------------------------------------------*/
/* USER CODE BEGIN EM */
#define CPU_FREQ 80000000
#define PWM_FREQ 50000
#define PWMPeriodValue (( (uint32_t) CPU_FREQ / PWM_FREQ) / 2)
#define HIGH 1
#define LOW 0
//#define SINE_PWM
#define TOTEM_POLE_PWM
/* USER CODE END EM */
void HAL_TIM_MspPostInit(TIM_HandleTypeDef *htim);
/* Exported functions prototypes ---------------------------------------------*/
void Error_Handler(void);
/* USER CODE BEGIN EFP */
/* USER CODE END EFP */
/* Private defines -----------------------------------------------------------*/
#define DC_DC_Enable_Pin GPIO_PIN_13
#define DC_DC_Enable_GPIO_Port GPIOC
#define OC_Reset_Pin GPIO_PIN_14
#define OC_Reset_GPIO_Port GPIOC
#define AC_OC_Pin GPIO_PIN_15
#define AC_OC_GPIO_Port GPIOC
#define OC_DETECT_Pin GPIO_PIN_1
#define OC_DETECT_GPIO_Port GPIOH
#define EXT_SUP_Pin GPIO_PIN_5
#define EXT_SUP_GPIO_Port GPIOA
#define EXT_CNTRL_Pin GPIO_PIN_6
#define EXT_CNTRL_GPIO_Port GPIOA
#define OP_FREQ_SELECT_Pin GPIO_PIN_2
#define OP_FREQ_SELECT_GPIO_Port GPIOB
#define RS485_TX_CNTRL_Pin GPIO_PIN_10
#define RS485_TX_CNTRL_GPIO_Port GPIOB
#define LCD_D7_Pin GPIO_PIN_11
#define LCD_D7_GPIO_Port GPIOB
#define LCD_RS_Pin GPIO_PIN_13
#define LCD_RS_GPIO_Port GPIOB
#define RJ11_PWR_ON_STS_Pin GPIO_PIN_14
#define RJ11_PWR_ON_STS_GPIO_Port GPIOB
#define ORANGE_LED_Pin GPIO_PIN_15
#define ORANGE_LED_GPIO_Port GPIOB
#define RJ11_ENABLE_Pin GPIO_PIN_7
#define RJ11_ENABLE_GPIO_Port GPIOC
#define RJ11_DETECT_Pin GPIO_PIN_8
#define RJ11_DETECT_GPIO_Port GPIOC
#define DC_BUS_OK_Pin GPIO_PIN_9
#define DC_BUS_OK_GPIO_Port GPIOC
#define GREEN_LED_Pin GPIO_PIN_11
#define GREEN_LED_GPIO_Port GPIOA
#define RED_LED_Pin GPIO_PIN_12
#define RED_LED_GPIO_Port GPIOA
#define LCD_EN_Pin GPIO_PIN_10
#define LCD_EN_GPIO_Port GPIOC
#define LCD_D4_Pin GPIO_PIN_11
#define LCD_D4_GPIO_Port GPIOC
#define LCD_D5_Pin GPIO_PIN_12
#define LCD_D5_GPIO_Port GPIOC
#define LCD_D6_Pin GPIO_PIN_2
#define LCD_D6_GPIO_Port GPIOD
#define RJ11_OVERLOAD_STS_Pin GPIO_PIN_5
#define RJ11_OVERLOAD_STS_GPIO_Port GPIOB
#define RJ11_OVERTEMP_STS_Pin GPIO_PIN_7
#define RJ11_OVERTEMP_STS_GPIO_Port GPIOB
#define FAN_ON_OFF_Pin GPIO_PIN_8
#define FAN_ON_OFF_GPIO_Port GPIOB
/* USER CODE BEGIN Private defines */
/* USER CODE END Private defines */
#ifdef __cplusplus
}
#endif
#endif /* __MAIN_H */
Please refer the code. All other GPIO pins are working fine, except PD2.
I can't share my custom board schematic. it is confidential. PD2 is connected with LED through a resistor. Nothing is connecting with PD2.
We referred the NUCLEO-L412RB schematic. I have attached that also here.
2024-06-13 06:58 AM
/* USER CODE BEGIN Header */
/**
******************************************************************************
* @file stm32l4xx_it.c
* @brief Interrupt Service Routines.
******************************************************************************
* @attention
*
* Copyright (c) 2024 STMicroelectronics.
* All rights reserved.
*
* This software is licensed under terms that can be found in the LICENSE file
* in the root directory of this software component.
* If no LICENSE file comes with this software, it is provided AS-IS.
*
******************************************************************************
*/
/* USER CODE END Header */
/* Includes ------------------------------------------------------------------*/
#include "main.h"
#include "stm32l4xx_it.h"
/* Private includes ----------------------------------------------------------*/
/* USER CODE BEGIN Includes */
#include "SoftStart.h"
#include "SinePWM.h"
/* USER CODE END Includes */
/* Private typedef -----------------------------------------------------------*/
/* USER CODE BEGIN TD */
/* USER CODE END TD */
/* Private define ------------------------------------------------------------*/
/* USER CODE BEGIN PD */
/* USER CODE END PD */
/* Private macro -------------------------------------------------------------*/
/* USER CODE BEGIN PM */
/* USER CODE END PM */
/* Private variables ---------------------------------------------------------*/
/* USER CODE BEGIN PV */
/* USER CODE END PV */
/* Private function prototypes -----------------------------------------------*/
/* USER CODE BEGIN PFP */
/* USER CODE END PFP */
/* Private user code ---------------------------------------------------------*/
/* USER CODE BEGIN 0 */
/* USER CODE END 0 */
/* External variables --------------------------------------------------------*/
extern TIM_HandleTypeDef htim2;
/* USER CODE BEGIN EV */
/* USER CODE END EV */
/******************************************************************************/
/* Cortex-M4 Processor Interruption and Exception Handlers */
/******************************************************************************/
/**
* @brief This function handles Non maskable interrupt.
*/
void NMI_Handler(void)
{
/* USER CODE BEGIN NonMaskableInt_IRQn 0 */
/* USER CODE END NonMaskableInt_IRQn 0 */
/* USER CODE BEGIN NonMaskableInt_IRQn 1 */
while (1) {
}
/* USER CODE END NonMaskableInt_IRQn 1 */
}
/**
* @brief This function handles Hard fault interrupt.
*/
void HardFault_Handler(void)
{
/* USER CODE BEGIN HardFault_IRQn 0 */
/* USER CODE END HardFault_IRQn 0 */
while (1)
{
/* USER CODE BEGIN W1_HardFault_IRQn 0 */
/* USER CODE END W1_HardFault_IRQn 0 */
}
}
/**
* @brief This function handles Memory management fault.
*/
void MemManage_Handler(void)
{
/* USER CODE BEGIN MemoryManagement_IRQn 0 */
/* USER CODE END MemoryManagement_IRQn 0 */
while (1)
{
/* USER CODE BEGIN W1_MemoryManagement_IRQn 0 */
/* USER CODE END W1_MemoryManagement_IRQn 0 */
}
}
/**
* @brief This function handles Prefetch fault, memory access fault.
*/
void BusFault_Handler(void)
{
/* USER CODE BEGIN BusFault_IRQn 0 */
/* USER CODE END BusFault_IRQn 0 */
while (1)
{
/* USER CODE BEGIN W1_BusFault_IRQn 0 */
/* USER CODE END W1_BusFault_IRQn 0 */
}
}
/**
* @brief This function handles Undefined instruction or illegal state.
*/
void UsageFault_Handler(void)
{
/* USER CODE BEGIN UsageFault_IRQn 0 */
/* USER CODE END UsageFault_IRQn 0 */
while (1)
{
/* USER CODE BEGIN W1_UsageFault_IRQn 0 */
/* USER CODE END W1_UsageFault_IRQn 0 */
}
}
/**
* @brief This function handles System service call via SWI instruction.
*/
void SVC_Handler(void)
{
/* USER CODE BEGIN SVCall_IRQn 0 */
/* USER CODE END SVCall_IRQn 0 */
/* USER CODE BEGIN SVCall_IRQn 1 */
/* USER CODE END SVCall_IRQn 1 */
}
/**
* @brief This function handles Debug monitor.
*/
void DebugMon_Handler(void)
{
/* USER CODE BEGIN DebugMonitor_IRQn 0 */
/* USER CODE END DebugMonitor_IRQn 0 */
/* USER CODE BEGIN DebugMonitor_IRQn 1 */
/* USER CODE END DebugMonitor_IRQn 1 */
}
/**
* @brief This function handles Pendable request for system service.
*/
void PendSV_Handler(void)
{
/* USER CODE BEGIN PendSV_IRQn 0 */
/* USER CODE END PendSV_IRQn 0 */
/* USER CODE BEGIN PendSV_IRQn 1 */
/* USER CODE END PendSV_IRQn 1 */
}
/**
* @brief This function handles System tick timer.
*/
void SysTick_Handler(void)
{
/* USER CODE BEGIN SysTick_IRQn 0 */
/* USER CODE END SysTick_IRQn 0 */
HAL_IncTick();
/* USER CODE BEGIN SysTick_IRQn 1 */
/* USER CODE END SysTick_IRQn 1 */
}
/******************************************************************************/
/* STM32L4xx Peripheral Interrupt Handlers */
/* Add here the Interrupt Handlers for the used peripherals. */
/* For the available peripheral interrupt handler names, */
/* please refer to the startup file (startup_stm32l4xx.s). */
/******************************************************************************/
/**
* @brief This function handles TIM2 global interrupt.
*/
void TIM2_IRQHandler(void)
{
/* USER CODE BEGIN TIM2_IRQn 0 */
/* USER CODE END TIM2_IRQn 0 */
HAL_TIM_IRQHandler(&htim2);
/* USER CODE BEGIN TIM2_IRQn 1 */
SoftStart();
HAL_GPIO_WritePin(GPIOH, GPIO_PIN_0, HIGH);
#ifdef SINEPWM
SinePWM();
#endif
#ifdef TOTEM_POLE_PWM
TotemPolePWM();
#endif
// HAL_GPIO_TogglePin(OC_Reset_GPIO_Port, OC_Reset_Pin);
// HAL_GPIO_TogglePin(RS485_TX_CNTRL_GPIO_Port, RS485_TX_CNTRL_Pin);
// HAL_GPIO_TogglePin(LCD_D7_GPIO_Port, LCD_D7_Pin);
// HAL_GPIO_TogglePin(LCD_RS_GPIO_Port, LCD_RS_Pin);
// HAL_GPIO_TogglePin(STS_PWR_ON_GPIO_Port, STS_PWR_ON_Pin);
// HAL_GPIO_TogglePin(ORANGE_LED_GPIO_Port, ORANGE_LED_Pin);
// HAL_GPIO_TogglePin(GREEN_LED_GPIO_Port, GREEN_LED_Pin);
// HAL_GPIO_TogglePin(RED_LED_GPIO_Port, RED_LED_Pin);
// HAL_GPIO_TogglePin(LCD_EN_GPIO_Port, LCD_EN_Pin);
// HAL_GPIO_TogglePin(LCD_D4_GPIO_Port, LCD_D4_Pin);
// HAL_GPIO_TogglePin(LCD_D5_GPIO_Port, LCD_D5_Pin);
HAL_GPIO_TogglePin(LCD_D6_GPIO_Port, LCD_D6_Pin);
// HAL_GPIO_TogglePin(RJ11_OVERLOAD_STS_GPIO_Port, RJ11_OVERLOAD_STS_Pin);
// HAL_GPIO_TogglePin(RJ11_OVERTEMP_STS_GPIO_Port, RJ11_OVERTEMP_STS_Pin);
HAL_GPIO_TogglePin(FAN_ON_OFF_GPIO_Port, FAN_ON_OFF_Pin);
HAL_GPIO_WritePin(GPIOH, GPIO_PIN_0, LOW);
/* USER CODE END TIM2_IRQn 1 */
}
/* USER CODE BEGIN 1 */
/* USER CODE END 1 */
/* USER CODE BEGIN Header */
/**
******************************************************************************
* @file : main.h
* @brief : Header for main.c file.
* This file contains the common defines of the application.
******************************************************************************
* @attention
*
* Copyright (c) 2024 STMicroelectronics.
* All rights reserved.
*
* This software is licensed under terms that can be found in the LICENSE file
* in the root directory of this software component.
* If no LICENSE file comes with this software, it is provided AS-IS.
*
******************************************************************************
*/
/* USER CODE END Header */
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __MAIN_H
#define __MAIN_H
#ifdef __cplusplus
extern "C" {
#endif
/* Includes ------------------------------------------------------------------*/
#include "stm32l4xx_hal.h"
/* Private includes ----------------------------------------------------------*/
/* USER CODE BEGIN Includes */
/* USER CODE END Includes */
/* Exported types ------------------------------------------------------------*/
/* USER CODE BEGIN ET */
/* USER CODE END ET */
/* Exported constants --------------------------------------------------------*/
/* USER CODE BEGIN EC */
/* USER CODE END EC */
/* Exported macro ------------------------------------------------------------*/
/* USER CODE BEGIN EM */
#define CPU_FREQ 80000000
#define PWM_FREQ 50000
#define PWMPeriodValue (( (uint32_t) CPU_FREQ / PWM_FREQ) / 2)
#define HIGH 1
#define LOW 0
//#define SINE_PWM
#define TOTEM_POLE_PWM
/* USER CODE END EM */
void HAL_TIM_MspPostInit(TIM_HandleTypeDef *htim);
/* Exported functions prototypes ---------------------------------------------*/
void Error_Handler(void);
/* USER CODE BEGIN EFP */
/* USER CODE END EFP */
/* Private defines -----------------------------------------------------------*/
#define DC_DC_Enable_Pin GPIO_PIN_13
#define DC_DC_Enable_GPIO_Port GPIOC
#define OC_Reset_Pin GPIO_PIN_14
#define OC_Reset_GPIO_Port GPIOC
#define AC_OC_Pin GPIO_PIN_15
#define AC_OC_GPIO_Port GPIOC
#define OC_DETECT_Pin GPIO_PIN_1
#define OC_DETECT_GPIO_Port GPIOH
#define EXT_SUP_Pin GPIO_PIN_5
#define EXT_SUP_GPIO_Port GPIOA
#define EXT_CNTRL_Pin GPIO_PIN_6
#define EXT_CNTRL_GPIO_Port GPIOA
#define OP_FREQ_SELECT_Pin GPIO_PIN_2
#define OP_FREQ_SELECT_GPIO_Port GPIOB
#define RS485_TX_CNTRL_Pin GPIO_PIN_10
#define RS485_TX_CNTRL_GPIO_Port GPIOB
#define LCD_D7_Pin GPIO_PIN_11
#define LCD_D7_GPIO_Port GPIOB
#define LCD_RS_Pin GPIO_PIN_13
#define LCD_RS_GPIO_Port GPIOB
#define RJ11_PWR_ON_STS_Pin GPIO_PIN_14
#define RJ11_PWR_ON_STS_GPIO_Port GPIOB
#define ORANGE_LED_Pin GPIO_PIN_15
#define ORANGE_LED_GPIO_Port GPIOB
#define RJ11_ENABLE_Pin GPIO_PIN_7
#define RJ11_ENABLE_GPIO_Port GPIOC
#define RJ11_DETECT_Pin GPIO_PIN_8
#define RJ11_DETECT_GPIO_Port GPIOC
#define DC_BUS_OK_Pin GPIO_PIN_9
#define DC_BUS_OK_GPIO_Port GPIOC
#define GREEN_LED_Pin GPIO_PIN_11
#define GREEN_LED_GPIO_Port GPIOA
#define RED_LED_Pin GPIO_PIN_12
#define RED_LED_GPIO_Port GPIOA
#define LCD_EN_Pin GPIO_PIN_10
#define LCD_EN_GPIO_Port GPIOC
#define LCD_D4_Pin GPIO_PIN_11
#define LCD_D4_GPIO_Port GPIOC
#define LCD_D5_Pin GPIO_PIN_12
#define LCD_D5_GPIO_Port GPIOC
#define LCD_D6_Pin GPIO_PIN_2
#define LCD_D6_GPIO_Port GPIOD
#define RJ11_OVERLOAD_STS_Pin GPIO_PIN_5
#define RJ11_OVERLOAD_STS_GPIO_Port GPIOB
#define RJ11_OVERTEMP_STS_Pin GPIO_PIN_7
#define RJ11_OVERTEMP_STS_GPIO_Port GPIOB
#define FAN_ON_OFF_Pin GPIO_PIN_8
#define FAN_ON_OFF_GPIO_Port GPIOB
/* USER CODE BEGIN Private defines */
/* USER CODE END Private defines */
#ifdef __cplusplus
}
#endif
#endif /* __MAIN_H */
Please refer the code. All other GPIO pins are working fine, except PD2.
I can't share my custom board schematic. it is confidential. PD2 is connected with LED through a resistor. Nothing is connecting with PD2.
We referred the NUCLEO-L412RB schematic. I have attached that also here.
2024-06-13 07:05 AM
@VasuManiV wrote:PD2 is connected with LED through a resistor. .
Are you sure that the LED is mounted the correct way round?
Are you sure that the resistor is the correct value, and all components are well soldered?
@VasuManiV wrote:I can't able to find any high output at PD2. The pin PD2 is always remains low
How did you check that - just be observing the LED, or did you measure voltage?
@VasuManiV wrote:Nothing is connecting with PD2.
I presume you mean nothing other than the LED ?
Have you checked for short-circuits, and open-circuits?
2024-06-13 07:10 AM - edited 2024-06-13 07:11 AM
+ What @Andrew Neil said, are you sure PD2 is not broken? do you have another board on which you can run the same test and check?
2024-06-13 07:48 AM
1. we are using the correct resistor value and LED is placed correctly. Initially i have checked the LED and resistor. Then i removed the resistor. So LED is isolated from the controller pin.
2. Am using oscilloscope to verify the pulses from the controller pin. I have the probed at 54th pin that is PD2.
3. I have verified that there is no short-circuit.
2024-06-13 07:50 AM
Yes @SofLit we have a nucleo board to evaluate our code. Even i have tested with that. Am getting low at that pin always. Even i have tried to make that pin high instead of toggling.
2024-06-13 08:05 AM
@VasuManiV wrote:Yes @SofLit we have a nucleo board to evaluate our code.
I think the question was do you have another one of your custom boards on which to test?