MATLAB Answers

0

Error while running simulink model connecting to raspberry pi with a webcam for real time image processing

Asked by mehmet öztürk on 22 Apr 2014
Latest activity Answered by Ajay Joseph on 29 Nov 2018
I'm trying to connect raspberry pi to simulink for capturing images from a webcam on raspberry pi. When I run the simulink model, some errors occur. Is there anyone to help me to solve this problem? Thanks for answers...
1) Error occurred while executing External Mode MEX-file 'ext_comm': ExtTargetPktPending() call failed while checking for target pkt
2) Error occurred while executing External Mode MEX-file 'ext_comm': ExtSetTargetPkt() call failed on CLOSE. Ensure target is still running
On matlab command window, it is written::"### Generated code for 'raspberrypi_inversion' is up to date because no structural, parameter or code replacement library changes were found."

  0 Comments

Sign in to comment.

4 Answers

Answer by Murat Belge on 23 Apr 2014

Is the webcam you are using in the supported USB webcams list? Check your webcam against the table in the following link: http://elinux.org/RPi_VerifiedPeripherals#USB_Webcams.
From the description, it looks like the Simulink application is not starting at all or exited because of an error. Are you executing one of the demo models?

  1 Comment

ı use logitech e2500. I can't understand exactly what do you mean with demo model?

Sign in to comment.


Answer by Pavel Roslovets on 13 Jan 2016

Seems like you are trying to send a too big amount of data from Raspberry to MATLAB in External Mode, so you get lost connection to target.
You can check this proposition. When the error occures go to Code->External Mode Control Panel in your Simulink model window and press the Connect button (see the picture 1 below).
If after this action simulation will continue press the Arm Trigger button to continue recieve signals from target.
To solve your problem and get rid of error press Disarm Trigger to stop recieve signals and then press Signal & triggering... button and in window that appears turn off redundant signals (picture 2).
Also a good practice is to slightly change your model. Use Rate Transition blocks before Scopes that you use to collect data from target with a view to enlarge signal sample time and decrease the load on your data channel.
And the last advice is to close all your Scopes when starting simulation in External Mode because an open Scope window can slow down your simulation that cause a loss of connection to the target. Also you can change Solver settings in Model Configuration Parameters to speed up a simulation.
Picture 1
Picture 2

  0 Comments

Sign in to comment.


Answer by Myles Joseph on 24 Jan 2018

I am having this issue, and it is largely due to the amount of data being send over in external mode. The time step of the system is not so important, so I can wait. is it possible to increase the timeout for this?

  0 Comments

Sign in to comment.


Answer by Ajay Joseph on 29 Nov 2018

Try disabling the firewall. I wasn't getting the exact error but it was similar.

  0 Comments

Sign in to comment.