2022-03-22 08:01 AM
Hello,
I got the demo board: STM32H747I-DISCO.
I am seeing something that does not seem right. All I am trying to do is to programmatically turn ON/OFF the four user LEDs.
Here is code:
// Init LED IO ports
GPIO_InitTypeDef myLed = {0};
myLed.Pin = GPIO_PIN_12 | GPIO_PIN_13 | GPIO_PIN_14 | GPIO_PIN_15;
myLed.Mode = GPIO_MODE_OUTPUT_PP;
myLed.Pull = GPIO_NOPULL;
HAL_GPIO_Init(GPIOI, &myLed);
HAL_Delay(1000);
// Turn OFF all LEDs
HAL_GPIO_WritePin(GPIOI, GPIO_PIN_12 | GPIO_PIN_13 | GPIO_PIN_14 | GPIO_PIN_15, GPIO_PIN_RESET);
// Result: Initially all LEDs turn ON, then LEDs 2(orange), and 4 (blue) turn OFF.
// Turn ON all LEDs
HAL_GPIO_WritePin(GPIOI, GPIO_PIN_12 | GPIO_PIN_13 | GPIO_PIN_14 | GPIO_PIN_15, GPIO_PIN_SET);
// Result: All LEDs are OFF
Now, two questions:
1- Why the logic is reversed (GPIO_PIN_SET turns OFF LEDs while GPIO_PIN_RESET turns ON LEDs).
2- Why LEDs 2, and 4 don't stay ON. I looked at schematics, and it does not seem like any LED is tied to anything.
Thanks.
2022-03-23 10:30 AM
This is why forums must have a "dislike" button. A company employee without even the basic understanding of electronics giving an "advice", which is wrong, misleading and uselessly increases the current consumption.