cancel
Showing results for 
Search instead for 
Did you mean: 

GPIOH Pin1 as normal GPIO

megahercas6
Senior
Posted on October 27, 2014 at 10:17

Hello, since i used all other pins inside STM32F415RG, i decided to use GPIOH pin1 as my mux enable for ADC frontedend channel selection. GPIOH pin0 is used as 25MHz CLK in from TCXO CMOS clock source.

For some reason, GPIOH pin1 is inactive, and i can't do any toggling . My original suspicion is that somewhere is is used as clk clock input for crystal, but i can't found where. code of GPIOH pin1 init:

GPIO_InitTypeDef GPIO_InitStructure;
RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOH, ENABLE);
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_1;// ENABLE_MUX
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT;
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_2MHz;
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_DOWN;
GPIO_Init(GPIOH, &GPIO_InitStructure);
// set/reset quick functions
GPIOH->BSRRH=GPIO_Pin_1; 
GPIOH->BSRRL=GPIO_Pin_1;

Any idea how i can fix this ? ( at least is good that this pin is logic high, if that be low, i would be in a lot of trouble)
6 REPLIES 6
Posted on October 27, 2014 at 10:31

> My original suspicion is that somewhere is is used as clk clock input for crystal, but i can't found where.

In your program, which includes the stuff you did not write just linked in without paying attention to it.

This is a deserved punishment for using the ''library'' without studying thoroughly and understanding its sources. The related RCC registers tend to be manipulated in system_stm32f4xx.c.

And read the manual, RM0090 rev.7 ch.8.3.14, plus the HSE-related issues in RCC chapter.

JW

Posted on October 27, 2014 at 11:22

Make sure to configure HSE in BYPASS mode.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Posted on October 27, 2014 at 11:54

> Make sure to configure HSE in BYPASS mode.

NO!

HSE must be completely OFF for PH0/PH1 to be usable as GPIO (i.e. HSEON in RCC_CR must be 0).

If HSE is ON, even in BYPASS mode, HSE_OSCOUT (= PH1) MUST be left floating (see RM0090 rev.7, ch.6.2.1, and the chapter I referred to above).

One more gotcha is, that OSC_IN and OSC_OUT pins are NOT 5V-tolerant while in oscillator mode.

JW

megahercas6
Senior
Posted on October 27, 2014 at 12:56

Yes, while reading programming manual it does state that it should be left in HiZ mode, and it's not exactly possible to do any software toggling on this pin.

Well, by the luck it is always in pull-up mode with some noise on this pin and i still can do multiplexing to adc, only problem is i can't disconnect MUX from my analog part.

Anyway, only few pins was left unused in my design, and i could not used other pin.

RCC->CR = ((uint32_t)RCC_CR_HSEON|RCC_CR_HSEBYP);

this declaration did not helped.

Posted on October 27, 2014 at 13:01

NO!

Fair play, but it will stop the pin from oscillating, and most CMOS TCXO aren't rail-to-rail either, so not being 5V tolerant hardly seems like a real burden.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
megahercas6
Senior
Posted on October 27, 2014 at 13:10

In any design i try to check if everything is ok, but i used STM32CubeMX to see if i have any conflicts, and i had none, since it was possible to select RCC_IN as CMOS clock source, and PH1 pin as GPIO_Output.

Next time i will try to read more reference manual

0690X00000602ygQAA.jpg