Page 1 of 1

Black STM32F407ZG Board and LEDs

Posted: Fri Apr 02, 2021 5:28 pm
by mklengel
I use this board:

STM32F407ZGT6 STM32 System ARM Core Board STM32F407 Development Board F407 Cortex-M4 Single-Chip Learning Board
https://www.aliexpress.com/item/4001089 ... 4c4dICMrQ7

Schematics
https://github.com/mcauser/BLACK_F407ZG ... matics.pdf

Image

Using VS Code and PlatformIO this seems to be the right board:
https://docs.platformio.org/en/v5.1.1/b ... 407zg.html

Flashing with a ST-Link V2 works without problems, but the typical Blinky program doesn't work as expected.
Instead of LED_D1 the LED_D2 blinks and vice versa. I don't understand what's wrong?! Any idea?

The LEDs are LED D1 (PF9) active low and LED D2 (PF10) active low.
LED_D1 and PF9 are connected, checked with impedance measurement.

main.cpp

Code: Select all

#include <Arduino.h>

void setup()
{
    // initialize LED digital pin as an output.
    pinMode(LED_D1, OUTPUT);
    //pinMode(LED_D2, OUTPUT);
}

void loop()
{
    // turn the LED off by making the voltage HIGH (active low)
    digitalWrite(LED_D1, HIGH);
    //digitalWrite(LED_D2, HIGH);

    delay(3000);

    // turn the LED on by making the voltage LOW (active low)
    digitalWrite(LED_D1, LOW);
    //digitalWrite(LED_D2, LOW);

    delay(1000);
}

Re: Black STM32F407ZG Board and LEDs

Posted: Fri Apr 02, 2021 8:50 pm
by GonzoG
It might be this board but there are few manufacturers that make them and there might be some differences.
LED_D1 and LED_D2 are just defined in board file as PF9 and PF10, it might be situation that when they wrote files for this board, they had different version, or just switched those 2 LEDs.

Re: Black STM32F407ZG Board and LEDs

Posted: Fri Apr 02, 2021 11:14 pm
by mklengel
I thought about that, so I measured the connections between LED_D1 and PF9 and also LED_D2 and PF10.
They are connected exactly as in the attached screenshot (extract of the schematics in my first post).

LED_D3 is permanently on, showing power.
LED_D2 is attached to PF10 via R16 (I measured 510 Ω)
LED_D1 is attached to PF9 via R14 (I measured 510 Ω)
Bildschirmfoto 2021-04-03 um 00.23.01.png
Bildschirmfoto 2021-04-03 um 00.23.01.png (33.3 KiB) Viewed 11380 times
In addition the connection between the

PF9 header pin to the PF9 pin of the STM32F407ZGT6 and
PF10 header pin to the PF10 pin of the STM32F407ZGT6

can be seen in the following screenshot
Bildschirmfoto 2021-04-03 um 01.03.35.jpg
Bildschirmfoto 2021-04-03 um 01.03.35.jpg (53.36 KiB) Viewed 11380 times
and this picture shows the pinout of the STM32F407ZGT6
Bildschirmfoto 2021-04-03 um 01.04.21.jpg
Bildschirmfoto 2021-04-03 um 01.04.21.jpg (63.09 KiB) Viewed 11377 times
I measured the connections between the PF9 header pin and the PF9 pin and also the PF10 header pin to the PF10 pin of the STM32F407ZGT6. They seem to be correct (difficult to measure because the pins are very small).

I simply don't understand why LED_D2 is blinking in my Blinky example, it should be LED_D1.

Re: Black STM32F407ZG Board and LEDs

Posted: Sat Apr 03, 2021 11:00 am
by mlundin
If you look in variant.cpp for this board at line 161, PF_10 is entered before PF_9 into the digtalPin[] array.
On the other hand in variant.h PF9 is declared before PF10, and after that LED_D1 and LED_D2 are declared as PF9 and PF10.

So the end effect is that LED_D1 = PF9 = 94 maps to digitalPin[94] = PF_10,
and LED_D2 = PF10 = 95 maps to digitalPin[95] = PF_9.

Re: Black STM32F407ZG Board and LEDs

Posted: Sat Apr 03, 2021 1:23 pm
by fpiSTM
Good catch @mlundin
We will fix that.

Re: Black STM32F407ZG Board and LEDs

Posted: Sat Apr 03, 2021 5:52 pm
by mklengel
@mlundin: great! You have a sharp eye :-) Thx for the solution.

To give it a try: I changed the order of the lines 245 and 246 in
~/.platformio/packages/framework-arduinoststm32/variants/BLACK_F407XX/variant.cpp

Code: Select all

 PF_9,
 PF_10, // PF_10: LED D2, PF_9: LED D1 (active low)
and the correct LED_D1 is blinking.

For a similar board BLACK STM32F407VE the LEDs (LED_D2 and LED_D3) worked as expected.
In the same file as above ~/.platformio/packages/framework-arduinoststm32/variants/BLACK_F407XX/variant.cpp
the important lines 117 and 118 are in the right order

Code: Select all

PA_6,
PA_7, // PA_6: LED D2, PA_7: LED D3 (active LOW)
Regards
Michael

Re: Black STM32F407ZG Board and LEDs

Posted: Tue Mar 29, 2022 7:03 am
by gervasd
It seems to me that LEDs everywhere add a little style and some beauty. What model of LEDs did you use to install on your computer? Unfortunately, I am not strong in electronics and physics to fully understand the circuits you described.
However, I know how to install LED strips. Last week I ordered a monochrome model on https://www.vont.com/product/smart-stri ... ip-lights/ and placed it in his office. I think that additional lighting would add some comfort to the room.
By the way, I haven't seen the board you described anywhere. Maybe it's some old model. Where can I buy it?