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.
I'm using a STM32G431KB Nucleo board (nucleo_g431kb - 170MHz) with PlatformIO & the Arduino framework.
My simple code looks like this:
void setup()
{
pinMode(PA12, INPUT);
pinMode(PA11, 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.
Note: I don't know anything about arduino.
All STM32, work even at boot with no code at all, in that the internal default RC system clock runs. Everything else is disabled including all GPIO's.
I can't see where you have enabled GPIOA ?
Is your OUTPUT, open drain or push pull ?
Your output signal looks like it's AC coupled. It's possible there's a problem with the IO pin configuration and it's not being correctly set as an output. It's also possible that you simply have a hardware problem. It may be worth taking a look at the schematics for the nuclei board, sometimes dev boards likes that will not bring all of the IO pins out to the header but default, there may be a jumper you need to close for that particular pin. You can rule a few things out by simply trying a different pin.
Haven't played with the stm32g family, but if it is like the stm32l and stm32f families, then you can configure the 'speed' of each output pin, which affects the drive strength and thus slew speed.
cheers,
george.
As ajb said, the output looks like it is AC coupled. Are you sure your probe is OK? Maybe try swapping the two probes just to be sure.
Did you have the pinModes in setup() interchanged at first? The code as quoted by techman-001 has them the wrong way around.
As ajb said, the output looks like it is AC coupled. Are you sure your probe is OK? Maybe try swapping the two probes just to be sure.
Did you have the pinModes in setup() interchanged at first? The code as quoted by techman-001 has them the wrong way around.
I quoted the OP's post exactly.
I agree that it's an AC signal however the blue scope channel is set to 500mv/div and has a dc voltage of about one volt on it. I suspect that because the pins concerned are right next to each other and PA-12 (output) is simply picking up the PA-11 (input) signal via the inherent capacitance between the PCB pins/circuit tracks.
Perhaps the MODE of PA12 (and PA11 are still un-configured) and set as inputs ?
Many crazy and less crazy hypotheses thrown around, but it would seem everyone, including the OP, missed the obvious!
Does anyone see something strange in the code below:
pinMode(PA12, INPUT);
[...]
digitalWriteFast(PA_12, HIGH);
and
pinMode(PA11, OUTPUT);
[...]
if (digitalReadFast(PA_11) == HIGH) {
Many crazy and less crazy hypotheses thrown around, but it would seem everyone, including the OP, missed the obvious!
Does anyone see something strange in the code below:
pinMode(PA12, INPUT);
[...]
digitalWriteFast(PA_12, HIGH);
and
pinMode(PA11, OUTPUT);
[...]
if (digitalReadFast(PA_11) == HIGH) {
I did not miss that, nor it seems did OP, as they changed their posted code after techman-001 quoted it (which is why I asked about it).