转自:beagleboard@googlegroups.com邮件组

作者:kevind

I have MATLAB / Simulink working with BeagleBone Black.  I'm posting the instructions here in case anyone else might find it useful.

I'm using it with the audio cape, so these instructions include how to make the alsa sound Simulink blocks work. I haven't tried using HDMI audio; if you want to do that it might require a different alsa configuration.
 
BeagleBone Black Configuration:
 
You'll need to boot your BeagleBone to Ubuntu with a current image, anything prior to kernel 3.8.13-bone31 won't work with the Audio Cape. 
 
I used this one for uSD card:
and this one for eMMC:
 
decompress with 7zip, and write to uSD card with Win32 Disk Imager:
 
Boot to the SD card (requires holding down the button near the uSD card slot while applying power).
If you use the eMMC flasher, wait 10 minutes until LEDs all come on steady, then reboot without the uSD card.
 

# create a swap file (I used 512MB for booting from internal eMMC, use larger if booting from uSD card)
sudo su
mkdir -p /var/cache/swap/
dd if=/dev/zero of=/var/cache/swap/swapfile bs=1M count=512
chmod 0600 /var/cache/swap/swapfile
mkswap /var/cache/swap/swapfile
swapon /var/cache/swap/swapfile
# set the swap file to load on boot by adding an entry to /etc/fstab:
nano /etc/fstab

/var/cache/swap/swapfile    none    swap    sw    0   0

# install required packages
apt-get update
apt-get install build-essential libsdl1.2-dev mplayer espeak alsa-utils
wget -P /var/lib/alsa http://beagleboardtoys.info/files/BeagleBoneAudio/asound.state
 
# set up build environment
mv /usr/include/sys/asoundlib.h /usr/include/arm-linux-gnueabihf/sys
rmdir /usr/include/sys
ln -s /usr/include/arm-linux-gnueabihf/sys /usr/include/sys
ln -s /usr/include/arm-linux-gnueabihf/asm /usr/include/asm
ln -s /usr/include/arm-linux-gnueabihf/bits /usr/include/bits
ln -s /usr/include/arm-linux-gnueabihf/gnu /usr/include/gnu
 
# test sound output if using the audio cape
# run alsamixer, and crank up the levels on "PCM" and "HP DAC", or you won't hear anything
alsamixer
# test that sound comes out, run 2X because sound ramp-up is delayed
aplay /usr/share/sounds/alsa/Front_Left.wav
aplay /usr/share/sounds/alsa/Front_Right.wav
# test with mp3 file if you have one
mplayer xxxxxxxx.mp3
 
 
MATLAB Configuration:
 
1) install the BeagleBoard target.  For R2012A/B, run "targetinstaller".
 
2) run "xmakefilesetup" 
 
For R2012B, set "Template" to "gmake_remotebuild" & "Configuration" to "LinuxRemoteBuild"
For R2012A, set "Template" to "beagleboardgmake" and "Configuration" to "BeagleBoard"
 
On the "Compiler" tab, set "Arguments" to "-c -mfloat-abi=hard"
 
3) in your Simulink model, select "Tools -> Run On Target Hardware -> Options"
 
Select "Run On Target Hardware", then:
 
"Target Hardware" is "BeagleBoard"
 
"Enable External mode" should be checked, and port set to "17725"
 
For "Host name", enter the IP address of your BeagleBone
For "User name", enter "Ubuntu"
For "Password", enter "temppwd" (or current password if you changed it)
For "Build Directory", enter "/home/Ubuntu"
 
3) In your Simulink model, if you use the ALSA audio blocks, leave the device name set to 'default'
 
 
4) Run your model using "Tools -> Run On Target Hardware -> Run"
 
MATLAB will generate C code from your Simulink model, send it to the BeagleBone, build the code on the BeagleBone, then run the code on the BeagleBone.  You can adjust parameters in your model while it runs (i.e. move a slider or type in a new value), and the new values will be sent to the BeagleBone.

MATLAB / Simulink on BeagleBone Black的更多相关文章

  1. 基于Matlab/Simulink的模型开发(连载一)

    概述 基于模型的开发将省去繁琐的代码编写步骤,只需要拖动几个模块,就像搭积木一般,轻松搭建您自己的飞控算法.飞控开发人员可以将更多的精力放在算法本身,而不需要过多关注代码实现的细节,这样将大大加快开发 ...

  2. 无人机基于Matlab/Simulink的模型开发(连载一)

    "一切可以被控制的对象,都需要被数学量化" 这是笔者从事多年研发工作得出的道理,无论是车辆控制,机器人控制,飞机控制,还是无人机控制,所有和机械运动相关的控制,如果不能被很好的数学 ...

  3. 8_LQR 控制器_状态空间系统Matlab/Simulink建模分析

    再线性控制器中讲到: 举例说明(线性控制器中的一个例子)博客中有说明 在matlab中:使用lqr求解K1.K2 这里希望角度(即x1)能迅速变化,所以Q矩阵中Q11为100,并没有关心角速度(dot ...

  4. 声反馈抑制使用matlab/simulink仿真

    第一份工作时做啸叫抑制的仿真,调大0.3可以有大的啸叫产生,下图的SIMULINK仿真模型 实现移相有多种方法: 1.iir实现 2.FFT实现 3.使用FIR实现 所有信号均可以由正弦信号叠加而成.

  5. MATLAB/SIMULINK生成代码错误之change the default character encoding setting

    SIMULINK点击生成C代码报错 错误提示: Error encountered while executing PostCodeGenCommand for model 'RTW_sc3': Cl ...

  6. Matlab/Simulink仿真中如何将Scope转化为Figure?

    1.只需要在运行仿真后,在命令窗口内输入: ,'ShowHiddenHandle','on'); set(gcf,'menubar','figure'); scope最上方会出现一个菜单栏,选择Too ...

  7. Matlab Simulink

  8. matlab之simulink仿真入门

    Matlab Simulink仿真工具的应用 ****Simulink是一个用来对动态系统进行建模.仿真和分析的软件包.使用Simulink来建模.分析和仿真各种动态系统(包含连续系统.离散系统和混合 ...

  9. 使用MATLAB生成模糊控制的离线查询表

    1.打开模糊控制工具箱,编辑输入输出变量的隶属度函数和模糊控制规则,如下图所示,导出为fuzzy_control.fis文件. 2.打开Simulink模块,建立下图所示的系统框图,两输入,一输出,处 ...

随机推荐

  1. 33. Search in Rotated Sorted Array

    题目: Suppose a sorted array is rotated at some pivot unknown to you beforehand. (i.e., 0 1 2 4 5 6 7  ...

  2. Android关于实现EditText中加多行下划线的的一种方法

    1. 重写EditText public class LinedEditText extends EditText { private Paint linePaint; private float m ...

  3. 如何创建支持Eclipse IDE的Maven项目

    使用Maven创建的项目是不支持任何IDE的,不能导入IDE中,因为项目格式都不符合特定IDE的格式要求,那么如何创建符合IDE要求的项目呢? 1.使用mvn eclipse:eclipse 命令把项 ...

  4. SQL延时操作

    --使用waitfor语句延迟或暂停程序的执行 --waitfor{delay'time'|time 'time'} delay是指间隔时间 最长到24小时 time是指定时间执行 waitfor d ...

  5. Java开发之单例设计模式

    设计模式之单例模式: 一.单例模式实现特点:①单例类在整个应用程序中只能有一个实例(通过私有无参构造器实现):②单例类必须自己创建这个实例并且可供其他对象访问(通过静态公开的访问权限修饰的getIns ...

  6. C++ STL之vector容器的基本操作

    注意事项:特别注意任何时候同时使用两个迭代器产生的将会是一个前闭后开的区间(具体见插入和删除的例子)特别注意begin()指向的是vec中的第0个元素,而end是指向最后一个元素的后面一个位置(不是最 ...

  7. Qt之自定义界面(QMessageBox)

    简述 通过前几节的自定义窗体的学习,我们可以很容易的写出一套属于自己风格的界面框架,通用于各种窗体,比如:QWidget.QDialog.QMainWindow. 大多数窗体的实现都是采用控件堆积来完 ...

  8. EASYUI+MVC4通用权限管理平台

    通用权限案例平台在经过几年的实际项目使用,并取得了不错的用户好评.在平台开发完成后,特抽空总结一下平台知识,请各位在以后的时间里,关注博客的更新. 1.EASYUI+MVC4通用权限管理平台--前言 ...

  9. Jquery 模板插件 jquery.tmpl.js 的使用方法(1):基本语法,绑定,each循环,ajax获取json数据

    jquery.tmpl.js 是一个模板js  ,主要有2个方法 (1):$.template()方法,将一段script或者是Html编译为模板,例如 $.template('myTemplate' ...

  10. java分层架构概念

    转自:http://www.cnblogs.com/bdqnbenet/p/4924778.html service是业务层 DAO (Data Access Object) 数据访问 1.JAVA中 ...