Skip to main content
Visitor II
March 2, 2022
Solved

GPIO output level consistency issue

  • March 2, 2022
  • 3 replies
  • 1715 views

Hello,

I have three GPIOs output configured. I'm having some strangeness on two of these that I don't quite understand.

I'm using a nucleo STM32L432KC, and I have some custom circuitry attached to the GPIOs (detailed below)

The situation I am experiencing is as follow.

When I set the 3 GPIOs like so, I have expected results.

HAL_GPIO_WritePin(GPIOB, GPIO_PIN_7, GPIO_PIN_RESET);
HAL_GPIO_WritePin(GPIOA, GPIO_PIN_5, GPIO_PIN_RESET);
HAL_GPIO_WritePin(GPIOA, GPIO_PIN_6, GPIO_PIN_SET);

0693W00000Kb8SbQAJ.pngPB7,PA5 are low and PA6 is high.

The next condition I test:

HAL_GPIO_WritePin(GPIOB, GPIO_PIN_7, GPIO_PIN_RESET);
HAL_GPIO_WritePin(GPIOA, GPIO_PIN_5, GPIO_PIN_SET);
HAL_GPIO_WritePin(GPIOA, GPIO_PIN_6, GPIO_PIN_RESET);

Should show PB7 low, PA5 high ad PA low.

But instead I see this:

0693W00000Kb8UDQAZ.pngPA5 appears to be bouncing all over the place, and once in a awhile PB7 does as well.

(This is short sample, of like 5 seconds)

Finally, when I do this:

HAL_GPIO_WritePin(GPIOB, GPIO_PIN_7, GPIO_PIN_SET);
HAL_GPIO_WritePin(GPIOA, GPIO_PIN_5, GPIO_PIN_RESET);
HAL_GPIO_WritePin(GPIOA, GPIO_PIN_6, GPIO_PIN_RESET);

I see these results:

0693W00000Kb8V1QAJ.pngBoth PB7 and PA5 are high, and steady.

Each circuit is tied to a 10k pulldown resistor.

PA6

0693W00000Kb8WEQAZ.pngPA5

0693W00000Kb8WJQAZ.pngPB7

0693W00000Kb8WKQAZ.png 

I don't quite understand a) why won't PA5 stay up, and how is PB7 somehow tied to PA5.

If anyone has some ides, I'd appreciate it.

    This topic has been closed for replies.
    Best answer by jgauthier

    Thanks! I finally figured it out,

    PA and PB7 are directly connected through solder bridge on the Nucleo. I removed the bridge.

    0693W00000KbBF6QAN.png

    3 replies

    Technical Moderator
    March 2, 2022

    The npn bipolar transistors are current driven and emitter followers, so you'd need some load connected to them. What is connected at the outputs?

    Regards

    /Peter

    jgauthierAuthor
    Visitor II
    March 2, 2022

    I didn't have a load, actually. But I attached my intended load. Which are 2 24V solenoids (relays not pictured)

    The behavior is the same regardless. So, I am still hunting - maybe it's hardware issue.

    Graduate II
    March 2, 2022

    1) Check output voltages by oscilloscope (or multimeter). Probably there are "analog" values.

    2) Check your GPIO settings (are GPIOs outputs ? in push-pull mode ?)

    3) Check HW for short circuits (bad soldering)

    jgauthierAuthorAnswer
    Visitor II
    March 2, 2022

    Thanks! I finally figured it out,

    PA and PB7 are directly connected through solder bridge on the Nucleo. I removed the bridge.

    0693W00000KbBF6QAN.png