cancel
Showing results for 
Search instead for 
Did you mean: 

STM32H747I-DISCO board simple programming question

imarz.1
Associate III

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.

10 REPLIES 10

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.