[STM32] input !== output signal - why?

I'm using a STM32G431KB Nucleo board (nucleo_g431kb - 170MHz) with PlatformIO & the Arduino framework.

My simple code looks like this:

void setup()
{
  pinMode(PA11, INPUT);
  pinMode(PA12, OUTPUT);
}

void loop()
{
  if (digitalReadFast(PA_11) == HIGH) {
    digitalWriteFast(PA_12, HIGH);
  }
  else {
    digitalWriteFast(PA_12, LOW);
  }
}

On pin 11 I got a well defined input signal like shown in the picture below (yellow signal). The blue signal in the picture is the one from the STM32 (pin 12).

Now the blue signal is not that defined like the yellow one. In theory, they both should be identical, shouldn't they? How do I get the output signal mirroring the input signal? The chip should have enough power. I tried a pull-down resistor, but it didn't change anything. I guess, I'm simply stupi.

It looks odd. Do you get the same result when you swap the probes measuring pins 11 and pins 12? Can you lower the frequency of the input signal to see if there is a point where the performance is as expected? What happens if you use the non-fast variants of the digital read and write statements?

Are “PA12” and “PA_12” and whatever you have the scope attached to actually the same pin? (Eww!)

That is what I'd expect to see if channel 2 of the oscilloscope were set to AC instead of DC.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.