I’m trying to run Arduino code on a VESC 4.12 which uses an STM32F405RG. I am using the genericSTM32F405RG board option. Here is the hardware schematic: https://github.com/vedderb/bldc-hardware/blob/master/design/BLDC_4.pdf?raw=true I am using an ST-Link v2 for uploading and debugging.
I haven’t been able to achieve anything that demonstrates my code is running, though it uploads without error. A blink program using either PC4 or PC5, where LEDs are connected, does not blink LEDs, and running with the PIO_FRAMEWORK_ARDUINO_ENABLE_CDC build flag does not cause USB to enumerate. When I try to debug either one of two issues occur. 1) the program seems to start running and then stops on one instruction and PC doesn’t seem to increment, or 2) I get the error “openocd: /Host/home/ilg/Work/openocd-0.10.0-13/openocd.git/src/flash/nor/stm32f2x.c:1205: stm32x_probe: Assertion `(bank->size >> 10) == flash_size_in_kb’ failed.” when it tries to launch the debugging session. I’m not sure why stm32f2x.c is being used as the project is for an f4x. I’m not sure why that assertion fails sometimes and not others. Here is the full output from the debug console:
Processing genericSTM32F405RG (platform: ststm32; board: genericSTM32F405RG; framework: arduino) -------------------------------------------------------------------------------- Verbose mode can be enabled via `-v, --verbose` option CONFIGURATION: https://docs.platformio.org/page/boards/ststm32/genericSTM32F405RG.html PLATFORM: ST STM32 7.0.0 > STM32F405RG (128k RAM. 1024k Flash) HARDWARE: STM32F405RG 168MHz, 128KB RAM, 1MB Flash DEBUG: Current (stlink) External (blackmagic, jlink, stlink) PACKAGES: - framework-arduinoststm32 4.10900.200602 (1.9.0) - framework-cmsis 2.50501.200527 (5.5.1) - toolchain-gccarmnoneeabi 1.90201.191206 (9.2.1) LDF: Library Dependency Finder -> http://bit.ly/configure-pio-ldf LDF Modes: Finder ~ chain, Compatibility ~ soft Found 15 compatible libraries Scanning dependencies... No dependencies Building in debug mode Checking size .pio/build/genericSTM32F405RG/firmware.elf Advanced Memory Usage is available via "PlatformIO Home > Project Inspect" RAM: [ ] 0.7% (used 856 bytes from 131072 bytes) Flash: [ ] 0.8% (used 8820 bytes from 1048576 bytes) ========================= [SUCCESS] Took 3.61 seconds ========================= Reading symbols from /home/levi/Documents/PlatformIO/Projects/vesc_test/.pio/build/genericSTM32F405RG/firmware.elf... PlatformIO Unified Debugger -> http://bit.ly/pio-debug PlatformIO: debug_tool = stlink PlatformIO: Initializing remote target... xPack OpenOCD, 64-bit Open On-Chip Debugger 0.10.0+dev (2019-07-17-11:25) 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 V2J37S7 (API v2) VID:PID 0483:3748 Info : Target voltage: 3.163636 Info : stm32f4x.cpu: hardware has 6 breakpoints, 4 watchpoints Info : accepting 'gdb' connection from pipe Info : device id = 0x10076413 Info : flash size = 8194 kbytes openocd: /Host/home/ilg/Work/openocd-0.10.0-13/openocd.git/src/flash/nor/stm32f2x.c:1205: stm32x_probe: Assertion `(bank->size >> 10) == flash_size_in_kb' failed. Aborted (core dumped) .pioinit:13: Error in sourced command file: Remote connection closed
Here is my platformio.ini:
[env:genericSTM32F405RG] platform = ststm32 board = genericSTM32F405RG framework = arduino upload_protocol = stlink debug_tool = stlink
I updated the firmware on my ST-Link. Any ideas what the issue is? Any help is appreciated. Thanks.