2024-11-05 11:33 PM
Hi all,
I failed to run Nucleo-G431RB board using Simulink "Monitor & Tune" mode via Simulink XCP protocol.
I've got the error message at Simulink,
"Could not connect to target application: XCP internal error: timeout expired, in response to XCP CONNECT command"
There has been no problem for Simulink "Build, Deploy & Start".
I followed an example from the link below.
https://www.mathworks.com/help/ecoder/stmicroelectronicsstm32f4discovery/ug/STM32F4XX-ADC-example.html
I've already changed Simulink model configuration to run Nucleo-G431RB LPUART.
- Hardware board = STM32G4xx Based
- Hardware board settings> Build options> Create> Select hardware = NUCLEO-G431RB
- Connectivity > USART/UART = LPUART1
- Connectivity > Serial port = COM1 (same port for STMicroelectronics STLink Virtual COM Port)
MATLAB related version:
- MATLAB 2023a
- Embedded Coder Support Package for ARM Cortex-M Processors V23.1.0
- Embedded Coder Support Package for STMicroelectronics STM32 Processors V23.1.3
STM32 related version:
- STM32CubeMX V.6.4.0
- STM32Cube_FW_G4_V1.5.1
I've read the similar post below, but couldn't figure out what was the problem.
https://community.st.com/t5/stm32-mcus-products/nucleo-g491re-communication-error-with-matlab-simulink-xcp/td-p/82065
Thank you in advance!
Solved! Go to Solution.
2024-11-05 11:40 PM
Hello @JellyFish and welcome to the ST Community.
For support on MATLAB/Simunlink, i suggest you to use the MATLAB Community https://www.mathworks.com/matlabcentral/content/communities.html.
Best Regards.
STTwo-32
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
2024-11-05 11:39 PM
2024-11-05 11:40 PM
Hello @JellyFish and welcome to the ST Community.
For support on MATLAB/Simunlink, i suggest you to use the MATLAB Community https://www.mathworks.com/matlabcentral/content/communities.html.
Best Regards.
STTwo-32
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
2024-11-11 8:20 PM
Thanks for the reply.
For the others who might go through similar problems,
This issue was solved by changing the order of Generated function call at STM32CubeMX.
"MX_DMA_Init" should be ahead of "MX_LPUART1_UART_Init".
2025-12-28 10:42 PM - edited 2025-12-28 10:42 PM
MATLAB say the same but backwards bro~
Better be helpful and attend your audicence instead of send over and over to other provider, your circus your monkeys pal!
2025-12-28 11:07 PM
I had the same issue with NUCLEO-G474RE trying to make a PIL control. no luck there.
Then I downgrade the project to this one:
It mentioned the use of USARTx tho...
Still not working, so I jumped from MATLAB 2024a to 202b to 2025a. Still the same, changed cables 4 times, uninstalled/instaled the drivers on Device manager (Windoze 11), use/unuse LPUARTx, put in different directories, changed names to be shorter and without spaces in order to Windoze/MATLAB do not protest, then I followed an infinite number of links on MATLAB:
And still not working.
Changed to another board I have (NUCLEO-F334R8), and worked as MATLAB directed.
Again returned to NUCLEO-G474RE, upgraded to the latest firmware for the STLINK-V3E (v3-17-10), still the same with USART1, then I just give it a try again with LPUART1 and it worked.
** As it seems after all these amnipulations, for sure the NUCLEO-F334R8 won't work...ya all know!!~
The lesson here is: try all, ST and MATLAB won't move a finger for something that should be "plug&play" as promoted.
Good luck.