cancel
Showing results for 
Search instead for 
Did you mean: 

STM32G474RE PC13 GPIO configuration

Manu Abraham
Senior

Hi All,

I have been trying to configure PC13 on the STM32G474 as a regular GPIO, but havent been successful yet.

Can someone suggest what could be done ?

Thanks,

Manu

int main(void)
{
	LL_GPIO_InitTypeDef gpio = {0};
 
	LL_APB2_GRP1_EnableClock(LL_APB2_GRP1_PERIPH_SYSCFG);
	LL_APB1_GRP1_EnableClock(LL_APB1_GRP1_PERIPH_PWR);
	NVIC_SetPriorityGrouping(NVIC_PRIORITYGROUP_4);
 
	LL_PWR_DisableDeadBatteryPD();
	SystemClock_Config();
 
 
//
//	PC.13 as regular GPIO
//	OSEL[1:0]=0			LL_RTC_ALARMOUT_DISABLE
//	TAMPOE=0
//	COE=0
//	TAMP1E=0
//	TSE=0
 
	LL_RTC_SetAlarmOutEvent(RTC, LL_RTC_ALARMOUT_DISABLE);	/* OSEL[1:0]=0 */
	LL_RTC_DisableTamperOutput(RTC);			/* TAMPOE=0 */
	LL_RTC_DisableOutput2(RTC);				/* COE=0 */
	LL_RTC_TAMPER_Disable(RTC, LL_RTC_TAMPER_1);		/* TAMP1E=0 */
	LL_RTC_TS_Disable(RTC);					/* TSE */
 
 
	gpio.Pin	= LL_GPIO_PIN_13;			/* PC.13 -> LCD_D/C */
	gpio.Mode	= LL_GPIO_MODE_OUTPUT;			/* Output MODE */
	gpio.Speed	= LL_GPIO_SPEED_FREQ_MEDIUM;
	gpio.OutputType	= LL_GPIO_OUTPUT_PUSHPULL;		/* Push Pull output */
	gpio.Pull	= LL_GPIO_PULL_DOWN;			/* NO pullup */
	LL_GPIO_Init(GPIOC, &gpio);
 
	while (1) {
		LL_GPIO_TogglePin(GPIOC, LL_GPIO_PIN_13);
		LL_mDelay(250);					/* Insert delay 250 ms */
	}
}
 

1 ACCEPTED SOLUTION

Accepted Solutions

Hi waclawek jan,

My head was in knots.

The problem appears to have magically solved .. Weird it is ..

The missing magic was that I forgot to enable the Peripheral clocks. :(

Sorry about the noise.

Thanks for the quick response.

Manu

View solution in original post

2 REPLIES 2

> I have been trying to configure PC13 on the STM32G474 as a regular GPIO, but havent been successful yet.

How do you observe it?

What is your hardware?

Any other pin works?

JW

Hi waclawek jan,

My head was in knots.

The problem appears to have magically solved .. Weird it is ..

The missing magic was that I forgot to enable the Peripheral clocks. :(

Sorry about the noise.

Thanks for the quick response.

Manu