How to debug a simulink model running on a raspberry pi

2 views (last 30 days)
Hello guys..
I have developed a simple image processing model using the raspberry pi toolkit on simulink. The image is captured using the V4L2 camera, processed and controls the on board Leds. I am looking for support on how can i get debug information on the raspberry pi to see if my model is working as expected. for example, using dmesg on the linux terminal to get information on the working of the simulink model. As a first level debug, i ran my model on my desktop (attached camera to the desktop and used scope to validate the output), and it works perfectly fine. But if i deploy it on the rpi, my output is not as expected. [i did check the gpio levels using cat /sys/kernel/debug/gpio and the values are not as per my expected output]
Thankyou for reading through & helping me out.
-Sajo

Answers (1)

Murat Belge
Murat Belge on 9 Dec 2013
After simulating your model on the host computer, you should run the model in "External Mode". In this mode, the model actually runs on the Raspberry Pi but you view the signals in your Simulink model on your host computer. By this way, you can attach scopes to the GPIO Write blocks etc. and also view the results of your algorithm. Look at the Raspberry Pi demos to learn how to run a model in External Mode.
  1 Comment
Sajo
Sajo on 13 Dec 2013
I do understand the procedure to run the Simulink model on RPi using the External Mode. To validate RPi GPIO responsiveness from the Simulink, i made a test Model to turn ON/OFF 3 leds connected via the GPIO pin using the a simple simulink model.This works perfectly fine. My issue is related to the system developed. This is a step by step procedure of the work 1. The model --> Built in camera module (a) Image processing toolkit b) V4L2 from RPi toolkit) --> Model to process the image --> Controls (either Scope or GPIOs)
2. Connect webcam to desktop. Run on desktop.use scope to validate the image being processed. Works perfect
3. Connect webcam to RPi. [use v4l2 block]. Run in external mode. Use either scope for validation, or GPIO controls.. both methods, the result is not as expected.
The only noticable changes between 2 and 3 are (a) Webcam connected to RPi (b)run mode. I have checked the image being captured by webcam during 2 and 3 and the resolutions are same.
My question is: what is the possible step forward to debug this issue which shows up only when running on the target hardware. ?
Thank You for reading through the long text but i only wanted to get my problem statement clear. :-)

Sign in to comment.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!