cancel
Showing results for 
Search instead for 
Did you mean: 

STM32L476 PE11 stays high even when not driven by input

Adagio Cortez
Associate
Posted on December 05, 2017 at 01:15

I was wondering if there was any explanation for having several Port E pins (10-13) set to Input (00), and pin E11 is staying high even though there is nothing connected to it.  I have tried setting the GPIOE->PUPDR to pull low, but amazingly that does not seem to help.  Pin E10 also occasionally toggles without any input.

Here is the relevant code:

RCC->AHB2ENR |= RCC_AHB2ENR_GPIOEEN; // Enable clock for Port E on GPIO

GPIOE->MODER &= ~(0xFF << (2*10)); // Clear bits Pins [10-13] to set to Input (00)

Checking the debugger, it appears GPIOE->IDR for pin E11 is constantly a 1, so it doesn't appear to be anything code-related.  The only other thing I'm changing on that port is the LED On pin 8.

GPIOE->MODER = ~(3U<<(2*8));

GPIOE->MODER |= 1U<<(2*8); // Output(01)

// GPIO Speed: Low speed (00), Medium speed (01), Fast speed (10), High speed (11)

GPIOE->OSPEEDR &= ~(3U<<(2*8));

GPIOE->OSPEEDR |= 3U<<(2*8); // High speed

// GPIO Output Type: Output push-pull (0, reset), Output open drain (1)

GPIOE->OTYPER &= ~(1U<<8); // Push-pull

// GPIO Push-Pull: No pull-up, pull-down (00), Pull-up (01), Pull-down (10), Reserved (11)

GPIOE->PUPDR &= ~(3U<<(2*8)); // No pull-up, no pull-down

Has anyone run into this problem? Colleagues have run into similar problems with other ports like A.

#gpio-port #stm32l476-discovery-board #gpio-alternate-function-ambiguity
0 REPLIES 0