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 :-(