"Failed to connect to the target" - WiFi/MKR1000 Simulink connection

Hi to everyone!

I am working on "Self-balancing Motorcycle" and I have a problem in section 6.4 Balancing with Straight Motion with the WiFi connection.
The Simulink Model Configuration Parameters of Hardware Implementation (WiFi properties, External mode) are set properly and if I evaluated the firmware version using the apposit sketch on Arduino IDE, the check results "PASSED".
The problem is when I run the Simulink scheme, the build happens correctly but I obtained the follow Diagnostic Viewer errors (also as attachment):

Error occurred while executing External Mode MEX-file 'ext_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.
Component:Simulink | Category:Block diagram error

Unable to connect to the 'Arduino MKR1000' target for 'myNewMoto'.
Component:Simulink | Category:Model error

Do you have any solutions?

Can you try putting the MKR1000 in bootloader mode and then try again?

I had this problem with my ASUS DSL AC68U router (tried many times). I switched to a different one (isp provided one - no idea what model) and it worked fine.

I went into sketch and did a firmware update Wifi101 and that also did not resolve my issue.