0
\$\begingroup\$

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

\$\endgroup\$
  • \$\begingroup\$ Now you have cornered the issue to software alone. \$\endgroup\$ – Umar Jun 27 '18 at 14:25
0
\$\begingroup\$

I don't see any obvious reason. The Nucleo board doesn't seem to be doing anything special with those pins.

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?


Another idea is that the output driver is fried for that pin. When you used the second Nucleo (without attaching your custom board), was it "fresh" or might they both have been similarly damaged in the past?

\$\endgroup\$
  • \$\begingroup\$ I'm not using an FMC. About "eventout" signal, I how do I check that? I'm not doing much - hopefully mbed-os is not doing much either \$\endgroup\$ – K.Mulier May 2 '17 at 19:51
  • \$\begingroup\$ @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! \$\endgroup\$ – bitsmack May 2 '17 at 20:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.