Setup:
Board: Custom PCB with STM32G431CBT6 (LQFP48)
MATLAB/Simulink R2026a, STM32 Microcontroller Blockset (CubeMX-integrated workflow)
Model reads an SPI absolute encoder (AS5047D) via SPI1, using two chained SPI Controller Transfer blocks (Chip select: "Provided by the SPI peripheral"), then computes angle/speed via Unwrap → Discrete Derivative → Discrete Filter, output to two Outport blocks (angle_count, w).
What works:
Build, Deploy & Start completes successfully every time, no build errors.
A separate hand-written CubeIDE blink test confirms the board, ST-Link, and SWD connection are all healthy.
Problem — Monitor & Tune / Connect fails, but with two different errors depending on the attempt (not simultaneously — one or the other):
On some attempts, I get:
External Mode Open Protocol Connect command failed Caused by: DWARF Parser internal error: Parser::describeSymbol xcpDummyDoubleVariable is not a global variable
On other attempts (after power-cycling the board / rebuilding), I instead get these two together:
Error: External Mode Open Protocol Connect command failed Caused by: Could not connect to target application: XCP internal error: timeout expired, in response to XCP CONNECT command Error: Unable to connect to the ‘STM32G4xx Based’ target for ‘BLDC_HIL’.
Both occur on the same model, same board, same COM port — I haven’t found a consistent trigger for which one shows up on a given attempt. This inconsistency itself feels like a clue, but I haven’t been able to pin down what’s different between attempts that produces one error vs. the other.
Things I’ve already checked/ruled out:
Signal logging is enabled on both Outport signals
Outport blocks are real Simulink Outports (not To Workspace — this was an earlier mistake I already fixed)
USART3 is enabled (Asynchronous mode) with DMA added for USART3_RX, per the CubeMX prompt
COM port in Model Settings matches Device Manager’s actual assigned port (COM9)
No other application (CubeIDE, terminal) is holding the COM port during connect
Checked xcp_ext_common.c — the xcpDummyDoubleVariable dead-code-elimination workaround already exists in my MATLAB install, so that’s not the cause
Problem 2 — Connected IO (tried as an alternative) fails with:
MATLAB System block ‘BLDC_HIL/SPI Controller Transfer’ error occurred when invoking ‘setupImpl’ method of ‘stm32cube.blocks.SPIControllerTransfer’. Caused by: Simulink Connected IO: Error: IO server is not flashed properly. Reconnect the board and try again.
Question: Given the board itself is confirmed healthy (blink test via CubeIDE works fine), what else commonly causes External Mode/XCP and Connected IO to fail specifically on STM32G4-family boards? Is there a known compatibility issue between the STM32 Microcontroller Blockset’s XCP-over-UART implementation and G4-series parts specifically?Setup:
Board: Custom PCB with STM32G431CBT6 (LQFP48)
MATLAB/Simulink R2026a, STM32 Microcontroller Blockset (CubeMX-integrated workflow)
Model reads an SPI absolute encoder (AS5047D) via SPI1, using two chained SPI Controller Transfer blocks (Chip select: "Provided by the SPI peripheral"), then computes angle/speed via Unwrap → Discrete Derivative → Discrete Filter, output to two Outport blocks (angle_count, w).
What works:
Build, Deploy & Start completes successfully every time, no build errors.
A separate hand-written CubeIDE blink test confirms the board, ST-Link, and SWD connection are all healthy.
Problem — Monitor & Tune / Connect fails, but with two different errors depending on the attempt (not simultaneously — one or the other):
On some attempts, I get:
External Mode Open Protocol Connect command failed Caused by: DWARF Parser internal error: Parser::describeSymbol xcpDummyDoubleVariable is not a global variable
On other attempts (after power-cycling the board / rebuilding), I instead get these two together:
Error: External Mode Open Protocol Connect command failed Caused by: Could not connect to target application: XCP internal error: timeout expired, in response to XCP CONNECT command Error: Unable to connect to the ‘STM32G4xx Based’ target for ‘BLDC_HIL’.
Both occur on the same model, same board, same COM port — I haven’t found a consistent trigger for which one shows up on a given attempt. This inconsistency itself feels like a clue, but I haven’t been able to pin down what’s different between attempts that produces one error vs. the other.
Things I’ve already checked/ruled out:
Signal logging is enabled on both Outport signals
Outport blocks are real Simulink Outports (not To Workspace — this was an earlier mistake I already fixed)
USART3 is enabled (Asynchronous mode) with DMA added for USART3_RX, per the CubeMX prompt
COM port in Model Settings matches Device Manager’s actual assigned port (COM9)
No other application (CubeIDE, terminal) is holding the COM port during connect
Checked xcp_ext_common.c — the xcpDummyDoubleVariable dead-code-elimination workaround already exists in my MATLAB install, so that’s not the cause
Problem 2 — Connected IO (tried as an alternative) fails with:
MATLAB System block ‘BLDC_HIL/SPI Controller Transfer’ error occurred when invoking ‘setupImpl’ method of ‘stm32cube.blocks.SPIControllerTransfer’. Caused by: Simulink Connected IO: Error: IO server is not flashed properly. Reconnect the board and try again.
Question: Given the board itself is confirmed healthy (blink test via CubeIDE works fine), what else commonly causes External Mode/XCP and Connected IO to fail specifically on STM32G4-family boards? Is there a known compatibility issue between the STM32 Microcontroller Blockset’s XCP-over-UART implementation and G4-series parts specifically? Setup:
Board: Custom PCB with STM32G431CBT6 (LQFP48)
MATLAB/Simulink R2026a, STM32 Microcontroller Blockset (CubeMX-integrated workflow)
Model reads an SPI absolute encoder (AS5047D) via SPI1, using two chained SPI Controller Transfer blocks (Chip select: "Provided by the SPI peripheral"), then computes angle/speed via Unwrap → Discrete Derivative → Discrete Filter, output to two Outport blocks (angle_count, w).
What works:
Build, Deploy & Start completes successfully every time, no build errors.
A separate hand-written CubeIDE blink test confirms the board, ST-Link, and SWD connection are all healthy.
Problem — Monitor & Tune / Connect fails, but with two different errors depending on the attempt (not simultaneously — one or the other):
On some attempts, I get:
External Mode Open Protocol Connect command failed Caused by: DWARF Parser internal error: Parser::describeSymbol xcpDummyDoubleVariable is not a global variable
On other attempts (after power-cycling the board / rebuilding), I instead get these two together:
Error: External Mode Open Protocol Connect command failed Caused by: Could not connect to target application: XCP internal error: timeout expired, in response to XCP CONNECT command Error: Unable to connect to the ‘STM32G4xx Based’ target for ‘BLDC_HIL’.
Both occur on the same model, same board, same COM port — I haven’t found a consistent trigger for which one shows up on a given attempt. This inconsistency itself feels like a clue, but I haven’t been able to pin down what’s different between attempts that produces one error vs. the other.
Things I’ve already checked/ruled out:
Signal logging is enabled on both Outport signals
Outport blocks are real Simulink Outports (not To Workspace — this was an earlier mistake I already fixed)
USART3 is enabled (Asynchronous mode) with DMA added for USART3_RX, per the CubeMX prompt
COM port in Model Settings matches Device Manager’s actual assigned port (COM9)
No other application (CubeIDE, terminal) is holding the COM port during connect
Checked xcp_ext_common.c — the xcpDummyDoubleVariable dead-code-elimination workaround already exists in my MATLAB install, so that’s not the cause
Problem 2 — Connected IO (tried as an alternative) fails with:
MATLAB System block ‘BLDC_HIL/SPI Controller Transfer’ error occurred when invoking ‘setupImpl’ method of ‘stm32cube.blocks.SPIControllerTransfer’. Caused by: Simulink Connected IO: Error: IO server is not flashed properly. Reconnect the board and try again.
Question: Given the board itself is confirmed healthy (blink test via CubeIDE works fine), what else commonly causes External Mode/XCP and Connected IO to fail specifically on STM32G4-family boards? Is there a known compatibility issue between the STM32 Microcontroller Blockset’s XCP-over-UART implementation and G4-series parts specifically? simulink, stm32, external-mode, xcp, embedded-code MATLAB Answers — New Questions
