Closed joelsa closed 1 year ago
Hi @joelsa ! I don't see where any of the configured pins is toggled to HIGH DigitalWrite(PB0, HIGH);
Hi @joelsa ! I don't see where any of the configured pins is toggled to HIGH
DigitalWrite(PB0, HIGH);
Hi, the LEDs are active low, so turning the GPIO to LOW turns the LED on.
Here is an image displaying the wiring:
I see you already have a configured debugger in place. Have you tried running a debug session to figure out where the board gets stuck?
Hi, looks like the code is getting stuck at line tickstart = HAL_GetTick();
inside the function HAL_RCCEx_PeriphCLKConfig
in file stm32f4xx_hal_rcc_ex.c
, which is being called from SystemClock_Config()
I have added a Clock configuration like this:
This works well. I still think this is a bug, because in my opinion the generic STM32F446 target should be configured to use the internal oscillator.
The error might be here: https://github.com/stm32duino/Arduino_Core_STM32/blob/17fd01f9ff569cc55de975da6a5742a8aab6d004/variants/Generic_F446Rx/variant.cpp
Should I close this issue and open an issue there, since this issue is obviously not with PlatformIO?
Submit an issue. I thought I've removed all those kind of clock config. Do not hesitate to provide a PR.
Okay, will do!
I've checked and it seems you have an old version of the stm32 core, 1.9.0. Since this one lot of changes have been done and the system core clock config already been reworked.
I think my core is 2.4.0, for some reason I just opened an old commit in GitHub, so the link above is wrong. Sorry for the confusion.
I have made some progress debugging this further and it works on a Nucleo Board perfectly, it just doesn't work on my hardware.
I think the PLL might not be stable and/or the brownout detection is triggering.
I will probe some more with an oscilloscope, but I am 99.9% sure this isn't a software bug.
I have identified and solved the problem, Vcap was not connected and the PLL power source was unstable. Adding 10u solved all problems completely, and I can use the external HSE.
The problem with the initial clock config was simply, that I could not use the PLL at that frequencies but with Vcap (at 4u7 low ESR per Datasheet) in place, it is working perfectly.
I have troubles trying to turn on a simple led and I think this might be related to a bug in platformio.
I can turn the led on using several other framworks (such as stm32-rs, modm-io or using the ST-HAL without platformio), so the wiring is correct, even though this is a custom board.
General information: Host OS: Ubuntu 22.04.1 with Kernel 5.19.0-35 PlatformIO Version: PlatformIO Core, version 6.1.7a4 st-stm32 version: 15.6.0 Microcontroller: STM32F446RE Upload interface: J-LINK V11 OpenOCD version: 0.11.0 stm32duino version: 1.0.1 VSCode version: 1.76.2
Here is my main.cpp:
main.cpp
```cpp #includeHere is my platformio.ini:
platformio.ini
```ini [env:genericSTM32F446RE] platform = ststm32 board = genericSTM32F446RE framework = arduino debug_tool = jlink ; SWD interface upload_protocol = jlink ```Here is the
pio run -t upload --verbose
output:verbose output
```text Processing genericSTM32F446RE (platform: ststm32; board: genericSTM32F446RE; framework: arduino; debug_tool: jlink; board_upload.maximum_ram_size: 98304; upload_protocol: jlink; upload_resetmethod: none separate) ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- CONFIGURATION: https://docs.platformio.org/page/boards/ststm32/genericSTM32F446RE.html PLATFORM: ST STM32 (15.6.0) > STM32F446RE (128k RAM. 512k Flash) HARDWARE: STM32F446RET6 180MHz, 96KB RAM, 512KB Flash DEBUG: Current (jlink) External (blackmagic, jlink, stlink) PACKAGES: - framework-arduinoststm32 @ 4.20400.0 (2.4.0) - framework-cmsis @ 2.50700.210515 (5.7.0) - tool-dfuutil @ 1.11.0 - tool-jlink @ 1.77001.0 (7.70.1) - tool-openocd @ 2.1100.211028 (11.0) - tool-stm32duino @ 1.0.1 - toolchain-gccarmnoneeabi @ 1.90201.191206 (9.2.1) LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf LDF Modes: Finder ~ chain, Compatibility ~ soft Found 13 compatible libraries Scanning dependencies... No dependencies Building in release mode MethodWrapper(["checkprogsize"], [".pio/build/genericSTM32F446RE/firmware.elf"]) Advanced Memory Usage is available via "PlatformIO Home > Project Inspect" RAM: [ ] 0.9% (used 920 bytes from 98304 bytes) Flash: [ ] 2.7% (used 14324 bytes from 524288 bytes) .pio/build/genericSTM32F446RE/firmware.elf : section size addr .isr_vector 452 134217728 .text 12712 134218180 .rodata 1456 134230892 .ARM.extab 0 134232348 .ARM 8 134232348 .preinit_array 0 134232356 .init_array 16 134232356 .fini_array 8 134232372 .data 156 536870912 .bss 764 536871068 .noinit 0 536871832 ._user_heap_stack 1536 536871832 .ARM.attributes 48 0 .comment 102 0 .debug_frame 1360 0 Total 18618Compiling and uploading works well, but nothing happens. I can also flash it with
openocd -f interface/jlink.cfg -c "transport select swd" -f target/stm32f4x.cfg -c "program .pio/build/genericSTM32F446RE/firmware.elf"
.Is there an obvious problem or a hint where the problem may be?