cancel
Showing results for 
Search instead for 
Did you mean: 

Failed to connecting to the target through MATLAB simulink.

Abdulilah Alsulami
Associate II
Posted on October 26, 2017 at 08:07

How I can solve

Failed to connect to the target problem occurred during connecting simulink to STM32F4 board in External Mode?

 

I follow all procedure mentioned on MAT-Target PDF provided by ST, but when I begin connecting my model to the target this error message occurred:

'Error occurred while executing External Mode MEX-file 'ext_comm': Failed to connect to the target. Possible reasons for the failure: 

 

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.

Caused by: Expected 1xN string array for host name'.

 

I checked the three possible errors mentioned above but no result.

Also I attached a snapshot for the error window appearing during connecting process.

So, could any one help me for solving this issue.

I used 2016a MatLab version with STM32F4 nucleo board.

#simulink #stm32-mat/target-matlab
20 REPLIES 20
Posted on January 19, 2018 at 14:16

Thanks for your help,

Please mention where i have to change the heap value in code. please mention that part of code.

Posted on January 19, 2018 at 15:09

Thanks to all

Its working fine..

Posted on January 21, 2018 at 12:31

when you Build your code by the compiler, the program tells you where is the error. By the way the error occurs in assembly file ends with .S  

Posted on January 22, 2018 at 08:18

Thank you,

I build the program but am not getting any error. getting only warnings. any way thanks for your support.

once again thanks to all.

Posted on January 27, 2018 at 05:39

Facing problem during connection with matlab externally

Am not able to read the ADC value externally in simulink scope any one please help me regarding this. Am able to connect successfully externally but am not able to monitor the ADC values in scope.

Am using STM32F407VG discovery board. Other than PWM and  GPIO is working fine in external mode

Please any one help me regarding this. What configuration I have to do to read the ADC value in simulink.

Any configuration (CubeMX and Simulink block) or examples are there is more helpful, 

Here i attached the simulink and cubeMx file

Thank you

Posted on January 31, 2018 at 06:07

Hello

Could you please attach the simulink and cubeMX file?

I will try to solve your problem.

Thanks.

Panuwat

Posted on February 02, 2018 at 05:52

sorry for the delay... I resolved but also have some other doubts regarding

the configuration of ADC in Cubemx.

1. Whatever the program I write it in Matlab after build into a Keil it

works fine in Keil software. But the result is not able to monitor in

Matlab.

2. Now I resolved this by enabling DMA in Cubemx. If we don't enable

this DMA we get only one conversion value in Matlan scope after it will not

show the conversion. But the conversion we can sea in Keil.

3. So, I have doubt on this configuration in Cubemx. Please help me

regarding this what configuration i have to do exactly in Cubemx

4. Last am not able to make out Single, continuous and discontinuous

conversion difference and how to set the delay in Matlab to read the ADC

value. now am not able to set a delay in this.

On Wed, Jan 31, 2018 at 1:01 PM, Aimagin Co., Ltd. <

________________

Attachments :

ADC_PWM.ioc.zip : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006Hy4c&d=%2Fa%2F0X0000000b3f%2FMFUpURAf_QPoXLkBeoEbFbmfrrLyoOWUz47D2vFbdoE&asPdf=false

ADC_PWM.slx.zip : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006Hxyu&d=%2Fa%2F0X0000000b3d%2F4I73PhdDI.4ffXm.X4EPe3Nn0RfnN3xBTH4DqJ0JRGM&asPdf=false

ADC.ioc.zip : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006Hy4X&d=%2Fa%2F0X0000000b3b%2F7O9_yT8zN7JBPEHPm8VC9sIQBOGN6eeEs3vKB11ROqQ&asPdf=false

ADC.slx.zip : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006Hy2h&d=%2Fa%2F0X0000000b3Y%2FrGwYklEwBWSWtSuuinu2_Pr7.TNysd49uQ_OmXp.wvM&asPdf=false
Posted on February 09, 2018 at 11:17

Hi, everyone

External mode require VCP(Virtual Com Port) in the configuration but the

http://www.st.com/en/evaluation-tools/stm32f4discovery.html

's virtual com port are not available. because ST-Link are not connected to the USART of the STM32F407.

ST-Link of old reference doesn?t support VCP at all.

ST-Link of the new ref (

http://www.st.com/en/evaluation-tools/stm32f4discovery.html

) support VCP but is NOT connected to target.

So, if you want to use it must do configuration as shown in below picture.

0690X00000609exQAA.png

Source:

http://www.st.com/content/ccc/resource/technical/document/user_manual/70/fe/4a/3f/e7/e1/4f/7d/DM00039084.pdf/files/DM00039084.pdf/jcr:content/translations/en.DM00039084.pdf

Best regards,

Posted on February 14, 2018 at 07:03

Thanks

Posted on March 12, 2018 at 17:25

Hi Xj Q

I use 2016b Matlab version with STM32F429ZI nucleo board.

I am tring to use External mode with simulink,

I followed

the example and the instructions decribed in 'the MAT/TARGET instruction (Hands On, Rev 2.2, Page 86-105). I follow all procedure mentioned on MAT-Target PDF, but when I begin connecting my model to the target this error message occurred (Picture below):

'Error occurred while executing External Mode MEX-file 'ext_comm': Failed to connect to the target. Possible reasons for the failure: 

 

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.

Any help for solving this issue please ? And how I can use USB Serial Port ?

 

Thanks