Good evening everyone,
I have a custom board with an STM32G474RE microprocessor that works perfectly when programmed with STM32CubeIDE. Problems arise when I try to use PLECS Coder: I cannot compile or flash the firmware. Not even a simple test to make an LED flash works with PLECS.
The error I see is as follows:
Error in build step #5 (Make): Make process exited with code 2:
“C:/Users/chiar/Documents/Plexim/PLECS 4.8 (64 bit)/tsp_stm32/bin/c2p-gdb/c2p-gdb” load --server-cmd “\“C:/Users/chiar/Documents/Plexim/PLECS 4.8 (64 bit)/tsp_stm32/bin/openocd/bin/openocd\” -s \“C:/Users/chiar/Documents/Plexim/PLECS 4.8 (64 bit)/tsp_stm32/bin/openocd/share/openocd/scripts\” -s \“C:/Users/chiar/Documents/Plexim/PLECS 4.8 (64 bit)/tsp_stm32/templates/openocd\” -f board/st_nucleo_g4.cfg” --server-start-delay 1000 --port 3333 --nvic 0x08000000 ./output_STM32G474RE/led.elf
Architecture: arm
Unable to load binary “./output_STM32G474RE/led.elf”. Unable to erase flash.
Healthy exit.
led.mk:243: recipe for target ‘download’ failed
Open On-Chip Debugger 0.11.0 (2021-12-23-14:02)
Licensed under GNU GPL v2
For bug reports, read
Info : The selected transport took over low-level target control. The results might differ compared to plain JTAG/SWD
srst_only separate srst_nogate srst_open_drain connect_deassert_srst
Info : Listening on port 6666 for tcl connections
Info : Listening on port 4444 for telnet connections
Info : clock speed 2000 kHz
Error: libusb_open() failed with LIBUSB_ERROR_NOT_SUPPORTED
Info : STLINK V3J16M7B5S1 (API v3) VID:PID 0483:374F
Info : Target voltage: 3.261130
Info : stm32g4x.cpu: hardware has 6 breakpoints, 4 watchpoints
Info : starting gdb server for stm32g4x.cpu on 3333
Info : Listening on port 3333 for gdb connections
Info : accepting ‘gdb’ connection on tcp/3333
target halted due to debug-request, current mode: Thread
xPSR: 0x6100cc00 pc: 0x0800072c msp: 0x2001ffd0
Info : device idcode = 0x20036469 (STM32G47/G48xx - Rev ‘unknown’ : 0x2003)
Info : flash size = 512kbytes
Info : flash mode : dual-bank
Info : Unable to match requested speed 2000 kHz, using 1000 kHz
Info : Unable to match requested speed 2000 kHz, using 1000 kHz
Error: timed out while waiting for target halted
TARGET: stm32g4x.cpu - Not halted
in procedure ‘ocd_gdb_restart’
Info : Unable to match requested speed 2000 kHz, using 1000 kHz
Info : Unable to match requested speed 2000 kHz, using 1000 kHz
Error: timed out while waiting for target halted
Error executing event gdb-flash-erase-start on target stm32g4x.cpu:
TARGET: stm32g4x.cpu - Not halted
Error: Target not halted
Error: failed erasing sectors 0 to 4
Error: flash_erase returned -304
Info : dropped ‘gdb’ connection
make: *** [download] Error 1
How can I solve it?