Meanwhile I tried using the STM32CubeProgrammer to flash the file. Flashing works, behaviour is the same.
Here the Debugger of the angle control example:
Processing nucleo_g474re (platform: ststm32; board: nucleo_g474re; framework: arduino)
--------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/ststm32/nucleo_g474re.html
PLATFORM: ST STM32 (17.5.0) > Nucleo G474RE
HARDWARE: STM32G474RET6 170MHz, 128KB RAM, 512KB Flash
DEBUG: Current (stlink) On-board (stlink) External (blackmagic, cmsis-dap, jlink)
PACKAGES:
- framework-arduinoststm32 @ 4.20801.240815 (2.8.1)
- framework-cmsis @ 2.50900.0 (5.9.0)
- toolchain-gccarmnoneeabi @ 1.120301.0 (12.3.1)
Converting angle_control.ino
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 16 compatible libraries
Scanning dependencies...
Dependency Graph
|-- Simple FOC @ 2.3.4
Building in debug mode
Compiling [... so much compiling ...]
Archiving .pio\build\nucleo_g474re\libFrameworkArduino.a
Linking .pio\build\nucleo_g474re\firmware.elf
Checking size .pio\build\nucleo_g474re\firmware.elf
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM: [ ] 2.7% (used 3564 bytes from 131072 bytes)
Flash: [= ] 14.8% (used 77568 bytes from 524288 bytes)
Building .pio\build\nucleo_g474re\firmware.bin
========================= [SUCCESS] Took 19.24 seconds =========================
Reading symbols from d:\PlatformIO Projekte\sFOC_stm32\.pio\build\nucleo_g474re\firmware.elf...
Warning: 'set target-async', an alias for the command 'set mi-async', is deprecated.
Use 'set mi-async'.
PlatformIO Unified Debugger -> https://bit.ly/pio-debug
PlatformIO: debug_tool = stlink
PlatformIO: Initializing remote target...
xPack Open On-Chip Debugger 0.12.0-01004-g9ea7f3d64-dirty (2023-01-30-15:04)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
hla_swd
Info : The selected transport took over low-level target control. The results might differ compared to plain JTAG/SWD
Info : tcl server disabled
Info : telnet server disabled
Info : clock speed 2000 kHz
Info : STLINK V3J9M3 (API v3) VID:PID 0483:374E
Info : Target voltage: 3.277932
Info : [stm32g4x.cpu] Cortex-M4 r0p1 processor detected
Info : [stm32g4x.cpu] target has 6 breakpoints, 4 watchpoints
Info : starting gdb server for stm32g4x.cpu on pipe
Info : accepting 'gdb' connection from pipe
[stm32g4x.cpu] halted due to debug-request, current mode: Thread
xPSR: 0x81000000 pc: 0x08007e04 msp: 0x2001ff68
Info : device idcode = 0x20036469 (STM32G47/G48xx - Rev 'unknown' : 0x2003)
Info : RDP level 0 (0xAA)
Info : flash size = 512 KiB
Info : flash mode : dual-bank
Info : device idcode = 0x20036469 (STM32G47/G48xx - Rev 'unknown' : 0x2003)
Info : RDP level 0 (0xAA)
Info : OTP size is 1024 bytes, base address is 0x1fff7000
Warn : keep_alive() was not invoked in the 1000 ms timelimit. GDB alive packet not sent! (1036 ms). Workaround: increase "set remotetimeout" in GDB
//vv INTERESTING TIMER.C ISSUE
0x08007e04 in getTimerUpIrq (tim=0x22) at C:\Users\Tyandriel\.platformio\packages\framework-arduinoststm32\libraries\SrcWrapper\src\stm32\timer.c:371
371 switch ((uint32_t)tim) {
//^^
2
Info : Unable to match requested speed 2000 kHz, using 1000 kHz
[stm32g4x.cpu] halted due to debug-request, current mode: Thread
xPSR: 0x01000000 pc: 0x0800bde4 msp: 0x20020000
Loading section .isr_vector, size 0x1d8 lma 0x8000000
Loading section .text, size 0x113b0 lma 0x80001e0
Loading section .rodata, size 0x1764 lma 0x8011590
Loading section .ARM, size 0x8 lma 0x8012cf4
Loading section .init_array, size 0x20 lma 0x8012cfc
Loading section .fini_array, size 0xc lma 0x8012d1c
Loading section .data, size 0x3ec lma 0x8012d28
Info : Padding image section 0 at 0x080001d8 with 8 bytes
Info : Padding image section 1 at 0x08013114 with 4 bytes (bank write end alignment)
2
Info : Unable to match requested speed 2000 kHz, using 1000 kHz
[stm32g4x.cpu] halted due to debug-request, current mode: Thread
xPSR: 0x01000000 pc: 0x0800dfc8 msp: 0x20020000
Start address 0x0800dfc8, load size 78092
Transfer rate: 32 KB/sec, 7099 bytes/write.
2
Info : Unable to match requested speed 2000 kHz, using 1000 kHz
2
Unable to match requested speed 2000 kHz, using 1000 kHz
[stm32g4x.cpu] halted due to debug-request, current mode: Thread
xPSR: 0x01000000 pc: 0x0800dfc8 msp: 0x20020000
[stm32g4x.cpu] halted due to debug-request, current mode: Thread
xPSR: 0x01000000 pc: 0x0800dfc8 msp: 0x20020000
Temporary breakpoint 1 at 0x800df80: file C:\Users\Tyandriel\.platformio\packages\framework-arduinoststm32\cores\arduino\main.cpp, line 50.
Note: automatically using hardware breakpoints for read-only addresses.
PlatformIO: Initialization completed
PlatformIO: Resume the execution to `debug_init_break = tbreak main`
PlatformIO: More configuration options -> https://bit.ly/pio-debug
Temporary breakpoint 1, main () at C:\Users\Tyandriel\.platformio\packages\framework-arduinoststm32\cores\arduino\main.cpp:50
50 initVariant();
This is the script it points to
/*
main.cpp - Main loop for Arduino sketches
Copyright (c) 2005-2013 Arduino Team. All right reserved.
[snip]
*/
#define ARDUINO_MAIN
#include "Arduino.h"
// Force init to be called *first*, i.e. before static object allocation.
// Otherwise, statically allocated objects that need HAL may fail.
__attribute__((constructor(101))) void premain() // <-- ### THE MENTIONED CONSTRUCTOR ###
{
// Required by FreeRTOS, see http://www.freertos.org/RTOS-Cortex-M3-M4.html
#ifdef NVIC_PRIORITYGROUP_4
HAL_NVIC_SetPriorityGrouping(NVIC_PRIORITYGROUP_4);
#endif
#if (__CORTEX_M == 0x07U)
// Defined in CMSIS core_cm7.h
#ifndef I_CACHE_DISABLED
SCB_EnableICache();
#endif
#ifndef D_CACHE_DISABLED
SCB_EnableDCache();
#endif
#endif
init();
}
/*
* \brief Main entry point of Arduino application
*/
int main(void) // <-- ### LINE 50 ###
{
initVariant();
setup();
for (;;) {
#if defined(CORE_CALLBACK)
CoreCallback();
#endif
loop();
serialEventRun();
}
return 0;
}
Maybe somebody has an idea, where I could begin poking to find a solution. My patience has run out for now.
Edit:
same behaviour with Arduino UNO. Never thought it could be the shield. Unfortunately, they´re out-of-stock again… postponed.