Simulink - STM32 - PIL test communication error
17 次查看(过去 30 天)
显示 更早的评论
I have a Simulink model that contain an algorithm block. I built the generated c code succesfully to STM32F4-discovery board. (I read that from diagnostic viewer.) I used SIL/PIL Manager App to make PIL test. I selected serial communication at configuration panel. When I run the PIL simulation I get this error:
The timeout of 10 seconds for receiving data from the rtiostream interface has been exceeded. There might be multiple reasons for this communications failure. You should:
(a) Check that the target hardware configuration is correct, for example, check that the byte ordering is correct.
(b) Confirm that the target application is running on the target hardware.
(c) Consider the possibility of application run-time failures (e.g. divide by zero exceptions, incorrect custom code integration, etc.).
Note (c): To identify possible reasons for the run-time failure, consider using SIL, which supports signal handlers and debugging. If you cannot find a solution, consider using the method setTimeoutRecvSecs of rtw.connectivity.RtIOStreamHostCommunicator to increase the timeout value.
This is my example model:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/578367/image.png)
This is the diagnostic viewer outputs:
### Connectivity configuration for "C:\Users\atakan\Desktop\milpilsil\mult_ert_rtw": STM32F4-Discovery (Serial) ###
### Using toolchain: GNU Tools for ARM Embedded Processors
### 'C:\Users\atakan\Desktop\milpilsil\mult_ert_rtw\pil\mult.mk' is up to date
### Building 'mult': "D:\MATLAB\bin\win64\gmake" -f mult.mk all MW_GNU_ARM_TOOLS_PATH = C:/PROGRA~3/MATLAB/SUPPOR~1/R2020b/3P778C~1.INS/GNUARM~1.INS/win/bin C:\Users\atakan\Desktop\milpilsil\mult_ert_rtw\pil>cd . C:\Users\atakan\Desktop\milpilsil\mult_ert_rtw\pil>if "" == "" ("D:\MATLAB\bin\win64\gmake" -f mult.mk all ) else ("D:\MATLAB\bin\win64\gmake" -f mult.mk )
"### Invoking postbuild tool "Binary Converter" ..." "C:/PROGRA~3/MATLAB/SUPPOR~1/R2020b/3P778C~1.INS/GNUARM~1.INS/win/bin/arm-none-eabi-objcopy" -O binary ./mult.elf ../../mult.bin
"### Done invoking postbuild tool."
"### Invoking postbuild tool "Hex Converter" ..." "C:/PROGRA~3/MATLAB/SUPPOR~1/R2020b/3P778C~1.INS/GNUARM~1.INS/win/bin/arm-none-eabi-objcopy" -O ihex ./mult.elf ../../mult.hex
"### Done invoking postbuild tool."
"### Invoking postbuild tool "Executable Size" ..." "C:/PROGRA~3/MATLAB/SUPPOR~1/R2020b/3P778C~1.INS/GNUARM~1.INS/win/bin/arm-none-eabi-size" ./mult.elf text data bss dec hex filename 16748 160 12016 28924 70fc ./mult.elf
"### Done invoking postbuild tool."
"### Successfully generated all binary outputs." C:\Users\atakan\Desktop\milpilsil\mult_ert_rtw\pil>exit 0
### Starting application: 'mult_ert_rtw\pil\mult.elf'
### Started new OpenOCD process with PID 19356.
### Terminated OpenOCD process with PID 19356.
The timeout of 10 seconds for receiving data from the rtiostream interface has been exceeded. There might be multiple reasons for this communications failure. You should: (a) Check that the target hardware configuration is correct, for example, check that the byte ordering is correct. (b) Confirm that the target application is running on the target hardware. (c) Consider the possibility of application run-time failures (e.g. divide by zero exceptions, incorrect custom code integration, etc.). Note (c): To identify possible reasons for the run-time failure, consider using SIL, which supports signal handlers and debugging. If you cannot find a solution, consider using the method setTimeoutRecvSecs of rtw.connectivity.RtIOStreamHostCommunicator to increase the timeout value.
How can I fix this?
2 个评论
回答(1 个)
Asim
2024-7-12
Hello Atakan,
The timeout error during your PIL simulation can be due to several reasons. Here are some steps to troubleshoot and resolve the issue:
1. Verify Target Hardware Configuration
- Serial Communication Settings: Ensure the serial port settings (baud rate, COM port) in Simulink match those of the STM32F4-Discovery board.
- Byte Ordering: Confirm the byte ordering is set to "Little Endian."
2. Confirm Target Application is Running
- Flash the Firmware: Verify the firmware is successfully flashed onto the board.
- Reset the Board: Reset the board to ensure the application starts running.
3. Check for Run-Time Failures
- Divide by Zero: Ensure no divide-by-zero operations or other exceptions in your code.
- Custom Code Integration: Verify custom code is correctly implemented.
- Debugging: Use SIL simulation to debug and identify issues.
4. Increase Timeout Value
Increase the timeout value for receiving data:
rtw.connectivity.RtIOStreamHostCommunicator.setTimeoutRecvSecs(20);
I hope this helps,
Best Regards,
Asim Asrar
0 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!