转自: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. 无刷新分页 jquery.pagination.js

     无刷新分页 jquery.pagination.js 采用Jquery无刷新分页插件jquery.pagination.js实现无刷新分页效果 1.插件参数列表 http://www.dtan.so ...

  2. Dubbo分布式服务框架入门

    参考http://blog.csdn.net/u013142781/article/details/50387583 一.Dubbo概念介绍 1.1.Dubbo是什么? Dubbo是一个分布式服务框架 ...

  3. Vim 命令笔记

    给指定行添加序号 let la = 行a let lb = 行b +1 let lc = lb - la for i in range(lc) let cl = la + i call setline ...

  4. jsp获取struts2查询到的数据

    1.在struts2的方法中利用查询语句查询到结果,然后再对结果进行封装,jsp根据封装获取相关信息 struts2的查询和封装方法: private List<FreeMarkerDetail ...

  5. ios ableviewcell的动态加载数据,模仿喜马拉雅动态数据加载

    iphone(UITableViewCell)动态加载图片http://developer.apple.com/library/ios/#samplecode/LazyTableImages/Intr ...

  6. HDU 1280 前m大的数【哈希入门】

    题意:中文的题目= =将各种组合可能得到的和作为下标,然后因为不同组合得到的和可能是一样的, 所以再用一个数组num[]数组,就可以将相同的和都记录下来 #include<iostream> ...

  7. datatables 参数详解(转)

    //@translator codepiano //@blog codepiano //@email codepiano.li@gmail.com //尝试着翻译了一下,难免有错误的地方,欢迎发邮件告 ...

  8. php.ini配置中文详解

    ;;;;;;;;;;; ; 警告 ; ;;;;;;;;;;; ; 此配置文件是对于新安装的PHP的默认设置. ; 默认情况下,PHP使用此配置文件安装 ; 此配置针对开发目的,并且*不是*针对生产环境 ...

  9. Azure SQL 数据库新服务级别现已正式发布

    T.K.Ranga Rengarajan   2014 年 9 月 10 日上午 11:00 我们很高兴地宣布,新的 SQL 数据库服务级被基本.标准和高级级别现已正式发布.这些服务级别中含有内置且可 ...

  10. js spin 加载动画(loading)

    js spin 加载动画 最近做页面ajax加载是又用到loading动画,还好有一个spin.js 具体的包大家可以去http://fgnass.github.com/spin.js/下载, 如果想 ...