I have one more question about the external mode when I use the telemetry to establish the connection.
I have telemetry 1 connect to my PC at COM6,
and telemetry 2 connect to Pixhawk at TELE2(aka Serial 1) which is /dev/ttys1. So in the rc.txt, I set the following command:
px4_simulink_app start #disable automatic starting up of the model
nshterm /dev/ttyS1 & #this will make ttyS1 the serial console
and in the Simulink code generation mex -file augment: 1 6 57600 5
and in the target hardware resource, the Data Exchange Serial Port is ttyACM0, baud rate is 57600
But when I tried to connect the target, it failed. The error message is
Error occurred while executing External Mode MEX-file ‘ext_serial_win32_comm’: Failed to connect to the target. A time-out occurred while waiting for the connection response from the target. Possible reasons for the time-out:
a) The target is not switched on.
b) The target is not connected to your host machine.
c) The application for the model is not running on the target. You might have clicked the Stop button. If the Run button is not dimmed, click it. Otherwise, click the Build button, which downloads and runs your application on the target.
Even when I tried to connect the PC with PX4 with the FTDI cable, same error occurred.
Anything wrong here?