# PG2 GPIO output on Nucleo-F767ZI doesn't function

I have made a board on which I plug the Nucleo-F767ZI microcontroller board. There is one GPIO pin that I cannot get to function as a digital output: PG2.

This is my code in mbed-os:

static DigitalOut myPin_A(PG_2);
static DigitalOut myPin_B(PG_3);

...

static void someFunction()
{
myPin_A.write(1);    // <- This one doesn't work :-(
myPin_B.write(1);    // <- But this one works!
}


I thought: "Perhaps this problem has to do with mbed-os". So I have tried the ST HAL:

static void someFunction()
{
GPIO_InitTypeDef GPIO_InitStruct;

GPIO_InitStruct.Pin = GPIO_PIN_2;
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
HAL_GPIO_Init(GPIOG, &GPIO_InitStruct);

GPIO_InitStruct.Pin = GPIO_PIN_3;
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
HAL_GPIO_Init(GPIOG, &GPIO_InitStruct);

HAL_GPIO_WritePin(GPIOG, GPIO_PIN_2, GPIO_PIN_SET); // <- This one doesn't work :-(
HAL_GPIO_WritePin(GPIOG, GPIO_PIN_3, GPIO_PIN_SET); // <- But this one works!
}


As you can see, I get exactly the same result. I've tried another Nucleo-F767ZI board standalone - I don't plug it into my custom board to reassure myself that the PG2 pin isn't affected by anything outside the Nucleo - but still got the same result.

EDIT I have generated a new project from scratch with CubeMX. As you know, CubeMX does not support mbed-os, but freeRTOS instead. When using freeRTOS, the pin PG_2 works, using the code given above.
Why don't I get it working when mbed-os is running? This is so strange :-(

• Now you have cornered the issue to software alone. – User323693 Jun 27 '18 at 14:25

Each of these specific pins have a couple of alternate functions. Are you using the FMC module? Or might you have PG2 configured as an EVENTOUT signal?
• @K.Mulier EVENTOUT is a feature of the ARM core. There is some information about it here. However, if you aren't using it intentionally it probably isn't getting used. Hopefully someone can give you a more helpful answer! – bitsmack May 2 '17 at 20:06