3.55556

3.6 | 9 ratings Rate this file 482 Downloads (last 30 days) File Size: 15.3 KB File ID: #40313
image thumbnail

Simulink Support Package for Raspberry Pi Hardware

by

 

07 Mar 2013 (Updated )

Credit-card sized, low-cost, single-board computer with audio and video input/output

Editor's Notes:

This file was selected as MATLAB Central Pick of the Week

| Watch this File

File Information
Description

Installer file for Simulink Support Package for Raspberry Pi Hardware. For more details on capabilities for this support package, please visit:

www.mathworks.com/hardware-support/raspberry-pi.html

Opening the .mlpkginstall file from your operating system or from within MATLAB will initiate the installation process for this Hardware Support Package and acquire the latest support package available for the release you have.

This .mlpkginstall file is functional for R2013a and beyond.

If you are having issues with network connection to the Raspberry Pi, please see this Support Solution and related PDF document: http://www.mathworks.com/support/solutions/en/data/1-LTA2JJ/

Required Products Simulink
MATLAB
MATLAB release MATLAB 8.1 (R2013a)
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (48)
18 Apr 2014 Dan Lluch

@J - this is available for R2013a and beyond only - that is why it isn't showing up.

17 Apr 2014 J

I have matlab R2012a that I downloaded through school's license. I'm trying to install the simulink pkg for raspberry pi and i'm having trouble fining the pkg.

When you run the targetInstaller and access install or update from the internet, I only see arduinos, beagleboard and legomindstorm.

When I try to access the pkg that i downloaded by using the 'folder' method it says it can't be found.

Any suggestions?

19 Mar 2014 Murat Belge

For those who are interested in using the Raspberry Pi camera board, the R2014a MATLAB Support Package for Raspberry Pi hardware provides a command line interface to capture images from the camera.

19 Feb 2014 Murat Belge

For those who want to use Raspberry Pi Camera Board with Simulink:

The latest release of the Raspbian Wheezy image has V4L2 drivers for the Camera Board. This means that you can use the V4L2 Video Capture block in the Simulink block library for Raspberry Pi to capture images from the Raspberry Pi Camera Board. Here are the instructions:

1. Upgrade your Raspbian image to the latest to get the official V4L2 driver for Camera Board:

# sudo apt-get update
# sudo apt-get dist-upgrade
# sudo rpi-update

2. Reboot

# sudo reboot

3. After reboot, execute the following command to load the V4L2 driver for the Raspberry Pi Camera:

# sudo modprobe bcm2835-v4l2

After this step, you should see a /dev/video0 device (check by "ls -al /dev/vid*") that corresponds to the Camera Board. Now use the V4L2 Video Capture Block to capture images from this video device.

Note that you need to perform step 3 above every time you reboot your board. You can incorporate the command in step 3 into "/etc/rc.local" to automatically load the V4L2 driver at boot time.

17 Feb 2014 Neil

Hello, I've finally figured it out. All of the source files are native to the Pi on it's ext file system. You can implement linux commands on the RPi using the h=raspberrypi; connection object.

Also there are third party programs such as WinSCP which will allow you to establish a connection with the RPi to give you a windows explorer-like interface where you can drag and drop files.

Once I figured this out, I've come to realize how powerful this is. We get the native flexibility of the RPi with the added power of loading SIMULINK models. Thank you.

16 Feb 2014 Neil  
14 Feb 2014 Neil

Hi, I was wondering, does anyone know where the headers are located? I looked in all the source directories and they don't have any of the .h or .c files the RPi is able to call.

10 Jan 2014 Murat Belge

We are looking into Linux/Mac support.

25 Dec 2013 Marcin Majda

Without Linux support it's useless. Is there plans to publish *nix version?

24 Dec 2013 Francesco Caminiti

Thanks Murat Belge you were right, I had to start Matlab on "administrator mode", I finally installed the support package ;) thanks again =)

23 Dec 2013 Murat Belge

Francesco: Can you start MATLAB in "Administrator" mode and try the firmware update portion of the targetinstaller again? Your problem looks like an issue with permissions to query the removable drives.

20 Dec 2013 Francesco Caminiti

Hi guys! I have a problem when I try to install support package for my Raspberry. I have installed on my Windows 7 (64bit) laptop Matlab R2013a: on Matlab command window I wrote " targetinstaller " and I followed all steps, but after I updated the firmware I get an error in the " Configure Network " step. I chose " Local area or home Network ", "next" after this I get this error " Error while querying removable drives ". At this time do I have to turn on the board and connect it with ethernet cable? I have a new SD card (8 GB Sandisk) for this support package so it's empty. Please I need help ;)

14 Nov 2013 Kyler

Not useful if this can't be used on Mac/Linux.

14 Oct 2013 Brian McKay

Zhao, try looking at this File Exchange entry which provides a receipe for adding additional IO to support packages?
http://www.mathworks.com/matlabcentral/fileexchange/39354-device-drivers

12 Oct 2013 Zhao

this package includes ten functions that has no serial io function,how to add it to the package

05 Oct 2013 Simon

Is there any news on when the RPi support will arrive for Mac/Linux?

26 Aug 2013 Murat Belge

Just double click on it. If you have a MATLAB installed it should be opened by MATLAB.

Another way to install the Raspberry Pi support package is to start MATLAB in administrator mode and run "targetinstaller" on the MATLAB command line.

22 Aug 2013 Sebastian D'Amico

Sorry for the stupid question guys... but I don't know how to open the raspberrypi.mlpkginstall file within the zip file. Could you help me pls?
Thank

07 Aug 2013 Murat Belge

RAJ: Is the download location for the firmware a UNC path? Try donwloading the firmware to a location in your local drive. Example: "C:\raspberrypi\firmware". Can you post what your download path was set to?

06 Aug 2013 RAJ VIGNESH

When I try to download the firmware for raspberry pi, it gives an error telling "Firmware decompression error: Could not find the path specified". But the download completed properly. Please help.

30 Jun 2013 RED STONE  
13 Jun 2013 Hugo

Sorry for the answer delay Murat. I will see if I can show you the model because is a university project and I dont know if my team allows it. If yes I will contact you ;) thanks

I want to have output sounds by GPIO but I think that will be impossible due to my sample time of 48000. I test the ports with a simple square at that frequency wave and a oscilloscope, and the PINS coul not output a steady frequency. :\

Another thing that I do not understand was the input audio block. If the raspberry does not have input sound ports how simulink have an input sound block? I think that for beginners the documentation could be better...

11 Jun 2013 Murat Belge

Hugo: Can I have your Simulink model? This looks like a bug. I'd like to make sure it is fixed.

08 Jun 2013 Hugo

I figure it out the problem about the sound. I fix it and the sound is now quite nice :D However, through other outputs the sound could be better? Like HDMI?

Another point, in my model I have 3 sounds outputs. I wanna that this 3 data sets go to the GPIO pins to control each one individualy. I try a simple model including a sine wave, a relay, a data conversion to boolean and a GPIO pin. No problem, I sent the model to raspberry.

When I test with my model an error occured and said to contact Mathworks. The error was: "Unexpected or internal error encountered in "in CGIR: b:\matlab\src\cg_ir\util_cg\cg_sanity_checker.cpp line 411: sanityCheckLValue: expression producing non-pointer type used in L-value context
". Please report this to MathWorks if you can cause it to recur".

Erro print from my workspace: https://feupload.fe.up.pt/get/nHLDjoC8w5137mK

My output is a vector with 32 samples from -1 to 1. I use the following blocks to peform the conversion to GPIO pin: relay, data conversion to boolean and a unbuffer. Could you help me Murat? :\

Thanks again

08 Jun 2013 Hugo

Murat:

this sample rate, in fact little fast, is the output of a much complex system that I have been working. I simply passed to raspberry and after some time the sound simply stop. I had not thought about the sample rate but it solves my problem regarding the sound stop and noisy! And thanks for the tip of speed/work improvement :D

Yes you are correct, the range is 2^15. I put it wrong.

Now I need to improve the sound quality. In my system I work always with a sample time of 48000 so I cannot improve more to obatin more precision on the output wave. The wave is also a combination of many frequencies. Another option could be improve inside the raspberry. With the conversion to 16 bits, the sound quality, which is normal, is not so good. So I search for a while and I can use the sound either by, 3.5mm jack, HDMI or a output sound card via USB. Using another port is possible to have better sound quality or the ALSA block and its 16bits limit me to the sound that I have now? I wanna try if I can have a similar sound like I listen when I run my model on my PC.

Thank you Murat for your help, really! ;)

07 Jun 2013 Murat Belge

Hugo:

I think the crackling / popping sound is originating from the fact that the sample rate of the model (32/48e3) is too fast for the Linux OS to keep up. It is strange that the ALSA driver itself does not report any underruns. In any case, I changed the frame size going out of the Sine Wave block to 256 that got rid of the problem.

There is one more issue in your model in that the input to the ALSA Audio Playback function must be a signed int16 which means that samples are in the range [2^15, 2^15-1). Your MATLAB code was scaling the samples to 2^16-1.

Finally, you do not need to use a MATLAB function to scale the sine wave. Change the amplitude of the Sine Wave block to 32000 and use a Data Type Conversion block to convert the output to int16. Get rid of the MATLAB function block. Note also that adding the Data Type conversion block before matrix concatenation reduces the amount of work CPU is doing by half when doing data conversion.

07 Jun 2013 Hugo  
06 Jun 2013 Hugo

Murat Belge thank you for the response. I really need help on this :X

I put some other blocks on the model to ajust the signal for the ALSA block, the 2xN matrix int16 type.

it is better if you download the model. Thus I avoid get you wrong about what I tried. Link for download: https://feupload.fe.up.pt/get/To2nmpnz87UDsQ3

The output sound from raspberry comes from 3.5mm jack to a normal speakers (TEAC powermax 80/2). I can tell you that the sound goes noisy in less than 1 minute (I tested again before write this comment)

I do not have too much feedback on raspbeery to deal with this and I don't know if the problem is mine or some other thing inside the firmware.

I wait for response ;)

06 Jun 2013 Murat Belge

Hugo:
I need some information to reproduce the issue you are facing.

1. What is the parameters of the sine wave block (samplet time, amplitude, etc.)?

2. What is the sampling rate of the ALSA Audio Playback block?

05 Jun 2013 Hugo

Hello,

I have been testing the raspberry support package but I found some problems during the simulation on the hardware.

the problem is related with the sound output on 3.5mm jack and the model itself. My glitch is easy viewed on a simple model with a sine wave and the ALSA playback audio block. When I simulate on Matlab2013 on a PC it is OK during the time I want. However, when I pass to raspberry, the simulation run for a couple of seconds (the sound is normal) and after it, the output sound is noisy :\

Why this happens? For me project I need a standalone program always running on raspberry and constantly output a sound (via 3.5mm jack or another)

Please help :X

Thanks

28 May 2013 Murat Belge

Right click on the MATLAB icon or the MATLAB entry in the start menu and choose "Run as administrator" option.

28 May 2013 Chase

How do I put it in administrator mode to fix the "unable to query removable devices" error? Thanks.

05 May 2013 Hrvoje Bosnjak

no linux support

23 Apr 2013 fabrice

Hi Murat Belge
you are right, after putting in administrator mode , it is working
thanks

23 Apr 2013 Murat Belge

Joshua: The new Raspian Wheezy image is based on "2013-02-09-wheezy-raspbian.zip".

Following Linux packages are installed on top of the base image: libsdl1.2-dev, alsa-utils, espeak, x11vnc, guvcview, i2c-tools, libi2c-dev, wiringPi, ssmtp, ntpdate.

Following additional modifications have been done:
* Add user "pi" to video group: "sudo usermod -a -G video pi"
* Load i2c module in /etc/modules (add line "i2c-dev")
* Comment out blacklisted items "spi-bcm2708" and "i2c-bcm2708" in /etc/modprobe.d/raspi-blacklist.conf
* Create /etc/modprobe.d/uvcvideo.conf and enable UVCVIDEO quirks
* Enable SSH using raspi-config
* Enable medium level overclocking using raspi-config
* Enable writing IP address configuration to the FAT partition of the SD card
* Enable speaking IP address when the board boots (/etc/rc.local)
* Turn off reverse DNS lookup for SSH (/etc/ssh/sshd_config)
* Set time zone to New York

23 Apr 2013 Murat Belge

Fabrice/Leonardo: Did you start MATLAB in administrator mode?

22 Apr 2013 fabrice

same for me
"unable to query removable devices"
on win7 or win8
any idea ?

21 Apr 2013 Leonardo

Hi. I've been unable to complete my installation. It always stops with the same message: "unable to query removable devices", after the firmware download.
I'm running release 2013a with a Windows 8 Pro operating system. Any sugestions?

20 Apr 2013 Joshua Hurst

Hello,

It appears WiringPi has been added to this image?

Where can you find the updates that have been done to this image since the last one? Just curious what other things have now been included.

Thanks! Josh

20 Apr 2013 Joshua Hurst

Thank you! I've spent hours trying to figure out why my new Rpi was not working!

Josh

12 Apr 2013 Murat Belge

We updated the firmware image for Raspberry Pi using the latest release of Raspbian Wheezy (base image 2013-02-09-wheezy-raspbian.zip). If your Raspberry Pi Model B has a Hynix memory chip (the black square RAM chip right in the middle Raspberry Pi board) and you are having difficulty booting your board, try the new firmware image. Launch "targetupdater" utility on MATLAB command line and follow instructions to update the firmware of your Raspberry Pi.

The firmware image uses 2 GB of the SD card. After booting your board with the new firmware, run "raspi-config" utility on your board and select "expand_rootfs" option to expand the firmware image to fill the rest of the SD card.

02 Apr 2013 Murat Belge

We are looking into MAC/Linux support. Anybody else who wants Raspberry Pi support package to be available on MAC/Linux?

28 Mar 2013 Magnus

Nice! Will this become available for linux or mac platforms as well?

12 Mar 2013 Murat Belge

If you are having issues with updating the firmware of your Raspberry Pi, take a look at the following installation and troubleshooting guide: http://www.mathworks.com/support/solutions/attachment.html?resid=1-LUYRC0&solution=1-LTA2JJ

12 Mar 2013 Murat Belge

Attach a pair of speakers or headphones to the analog audio port of the Raspberry Pi board to hear Raspberry Pi speak its IP address when it boots. If you do not have a monitor connected to the Raspberry Pi board, this feature may come in handy.

11 Mar 2013 Joachim Schlosser

Works like a charm.

09 Mar 2013 Michael Lundgren

The pinmap for GPIO blocks is a nice touch.

08 Mar 2013 Tanya Morton

If the above URL doesn't work for you, then try http://www.mathworks.com/academia/raspberry-pi/

Updates
13 Mar 2013

Fixed URL

20 Sep 2013

-updated thumbnail and description text

17 Jan 2014

no change - upgrading hardware support package download action

Contact us