MATLAB: Does ‘xpctargetping’ (‘slrtpingtarget’) fail

slrtslrtpingtargetxpctargetping

Why does my 'xpctargetping' command fail after I boot and connect to my target PC?

Best Answer

The command 'xpctargetping' (or 'slrtpingtarget') can fail for various reasons as it involves the full connection chain of the host PC, Ethernet cable, and the target PC. Malfunctioning of anything along this pipeline, at either software and hardware levels, can lead to the failure of 'xpctargetping'.
Below are some common issues and countermeasures:
--- Hardware Connection ---
0. Hardware setup. Make sure to use a working Ethernet cable. Make sure the Ethernet cards connected are recognized Ethernet cards on the host PC and the target PC, respectively. There are cases when a target PC has more than one Ethernet card and the Ethernet controller is choosing the wrong one. Timeout can happen if things are not correctly setup and fail the 'xpctargetping' test. This documentation page talks about multiple Ethernet cards.
--- Target PC Settings ---
1. Bad target boot kernel. With a bad target boot kernel, the connection fails in general.
2. Target settings, such as IP, subnet mask, index, etc. In this case, one can retrieve the target hardware information following this documentation and make sure the settings match between the target object and the actual target hardware.
--- Host PC Settings ---
3. Firewall. Make sure to add Simulink Real-Time related processes to the exception list of the host PC's firewall, such as 'xpcbootpserver' and 'xpctftpserver'.
4. The 'xpctargetping' command is using a different port other than the one set in the target setting. For example, if the target setting uses port 22222 for host-target communication, 'xpctargetping' may use 22223 for pinging. If the port being used for 'xpctargetping' on the target is not functioning correctly, 'xpctargetping' will fail, and hence leading to auto build and download failure since 'xpctargetping' needs to pass before the model is downloaded to the target PC. In this case, the following workaround may help:
  • Download the attached modified targetping.p file which is attempting to connect to target in a slightly different way
  • Start MATLAB in administration mode
  • Type cd([xpcroot,'\xpc\+xpctarget\@xpc'])
  • Rename the existing targetping.p to targetpingOLD.p as a backup
  • Copy the downloaded targetping.p file to that directory
  • Execute 'rehash toolbox'
  • Try 'xpctargetping' several times and there is a good chance it will succeed.