cancel
Showing results for 
Search instead for 
Did you mean: 

MATLAB/Simulink XCP protocol via LPUART1

JellyFish
Associate II

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!

1 ACCEPTED SOLUTION

Accepted Solutions
STTwo-32
ST Employee

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.

View solution in original post

3 REPLIES 3
JellyFish
Associate II

Let me attach the ioc and Simulink files.

STTwo-32
ST Employee

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.

JellyFish
Associate II

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".