2020-07-28 06:57 AM
Hi,
I’m working on a board with an STM32L072RZ. I have and external clock source connected to PH0. And I want to use PH1 as GPIO. According to the Reference Manual RM0376 at section 9.3.13 this should be possible. But in section 7.2.1, the document also says that “the OSC_OUT pin should be left hi-Z (see Figure 40).�?. But in Figure 40 there’s written GPIO in OSC_OUT. I’ve tried to use PH1 both as output and input but it doen’t work.
The initialitation is made with STM32CubeMX v5.6.1.
I checked RCC_CR register and bit HSEBYP and HSEON are being SET.
When I use PH1 as output and I set it HIGH in main(), I can see that bit OD1 of GPIOH_ODR register is correctly set. But the pin remains LOW (oscilloscope).
When I use PH1 as input, even if I pull the pin HIGH, the ID1 bit in GPIOH_IDR register does not change.
I also tried to use the internal clock and PH1 works so it’s not broken.
Any ideas? Thank you very much for the support.
Aléxandros
2020-07-28 09:03 AM
I know of a board where this was tried and didn't work. Would not recommend.
2020-07-28 10:21 AM
Have you GPIOH port clock enabled?
2020-07-28 11:38 PM
Yes,
__HAL_RCC_GPIOH_CLK_ENABLE();