-
Notifications
You must be signed in to change notification settings - Fork 7
/
install-windows.html
123 lines (123 loc) · 10.8 KB
/
install-windows.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Style-Type" content="text/css" />
<meta name="generator" content="pandoc" />
<title></title>
<style type="text/css">code{white-space: pre;}</style>
</head>
<body>
<h1 id="installing-on-windows">Installing on Windows</h1>
<p>Copyright David A.W. Barton ([email protected]) 2015.</p>
<p>All of the associated source code and documentation is released under the MIT license.</p>
<p>Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:</p>
<p>The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.</p>
<p>THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.</p>
<h2 id="overview">Overview</h2>
<p>This document describes how to build firmware for the real-time controller, install suitable device drivers for the real-time controller and use it with Matlab.</p>
<p>It is not necessary to build the firmware if you have already have suitable firmware to use.</p>
<h2 id="to-build-the-real-time-controller-firmware-optional">To build the real-time controller firmware (optional)</h2>
<p>The instructions below uses the Cygwin environment to build the firmware. It should also be possible to use the MSYS environment in much the same way (untested!).</p>
<ol style="list-style-type: decimal">
<li><p>Download GCC ARM compiler from <a href="https://launchpad.net/gcc-arm-embedded/4.9/4.9-2014-q4-major/+download/gcc-arm-none-eabi-4_9-2014q4-20141203-win32.exe">https://launchpad.net/gcc-arm-embedded/4.9/4.9-2014-q4-major/+download/gcc-arm-none-eabi-4_9-2014q4-20141203-win32.exe</a>.</p>
<ul>
<li>Any recent version (i.e., post 2013) should work. Probably even ones earlier than that will work as well.</li>
</ul></li>
<li><p>Install ARM compiler.</p>
<ul>
<li>At the end you will have the option of adding the compiler to your path, doing so will make your life <em>slightly</em> easier.</li>
</ul></li>
<li><p>Download Cygwin from <a href="http://www.cygwin.org/">http://www.cygwin.org/</a>.</p></li>
<li><p>Install Cygwin with git and make selected (both under the devel category).</p>
<ul>
<li>It will say that other packages are required; accept the suggestions.</li>
</ul></li>
<li><p>Start the Cygwin terminal. By default the home directory is in <code>c:\cygwin\home\<username></code>.</p>
<ul>
<li><p>If you didn't add the compiler to your path, you will have to add it to your path in Cygwin with the command</p>
<pre><code>export PATH=$PATH:"/cygdrive/c/Program Files (x86)/GNU Tools ARM Embedded/4.9 2014q4/bin"</code></pre></li>
</ul></li>
<li><p>Decide where you are going to store the files.</p>
<ul>
<li><p>If you want to store them in your normal Windows Documents folder it is easiest to create a symbolic link to the appropriate place. E.g., if you have already created the folder "controlcont" in your Documents folder, issue the command</p>
<pre><code>ln -s /cygdrive/c/Users/<username>/My\ Documents/controlcont</code></pre></li>
</ul>
<p>to create a link to that folder in your Cygwin home directory, then <code>cd controlcont</code>.</p>
<ul>
<li>Alternatively, create a new directory in your Cygwin home directory, e.g., <code>mkdir controlcont</code> followed by <code>cd controlcont</code>.</li>
</ul></li>
<li><p>Clone the necessary repositories from <a href="http://github.com/db9052/">GitHub</a>.</p>
<pre><code>git clone https://github.com/db9052/rtc rtc
cd rtc
git clone https://github.com/db9052/starterware starterware</code></pre></li>
<li><p>Build TI Starterware.</p>
<pre><code>cd build
make starterware
cd ..</code></pre></li>
<li><p>Build the rig of your choice, e.g., duffing_numerical for a simple test</p>
<pre><code>cd rigs/duffing_numerical
make</code></pre></li>
<li><p>Put the resulting <code>.bin</code> file on a micro SD card as app.bin. There should also be a file called <code>uEnv.txt</code> on the SD card which contains the following text (only).</p>
<pre><code>uenvcmd=mmcinfo;fatload mmc 0 0x80000000 app.bin; go 0x80000000</code></pre></li>
</ol>
<p>Once you have done all this once, you only need to repeat steps 9 and 10 to compile new versions of your firmware.</p>
<h2 id="device-drivers-for-the-usb-interface-to-the-real-time-controller">Device drivers for the USB interface to the real-time controller</h2>
<ol style="list-style-type: decimal">
<li><p>Build the firmware (as above) and start up the real-time controller by plugging it into a suitable USB port.</p>
<ul>
<li>If your USB port cannot provide enough power, a 5V power supply can be used to power the board using the barrel connector.</li>
</ul></li>
<li><p>Ignore any of Window's requests for installing a device driver.</p></li>
<li><p>Download Zadig from <a href="http://zadig.akeo.ie">http://zadig.akeo.ie</a> and run it as an Administrator.</p></li>
<li><p>Select the "Real-time controller (Interface 0)" and the WinUSB driver. Press "Install Driver".</p></li>
<li><p>Select the "Real-time controller (Interface 1)" and the WinUSB driver. Press "Install Driver".</p></li>
<li><p>If you are using Windows 8 (or above) un-check "Ignore Hubs or Composite Parents" under the options menu and then select "Real-time controller" from the drop-down box. Ensure that the WinUSB driver is selected and then press "Replace Driver".</p></li>
<li><p>The real-time controller is now ready for use with Matlab.</p></li>
</ol>
<h2 id="to-use-the-real-time-controller-in-matlab">To use the real-time controller in Matlab</h2>
<ol style="list-style-type: decimal">
<li><p>[<em>Optional: see bullet point below</em>] Download the "Latest Windows binaries" from <a href="http://libusb.info">http://libusb.info</a> and extract <code>libusb-1.0.dll</code> from either the MS32 or the MS64 directory depending on whether you are using 32 bit Windows (and Matlab) or 64 bit Windows (and Matlab). Put it in the <code>rtc\matlab</code> folder alongside <code>rtc_interface.m</code>.</p>
<ul>
<li>If you are using a regular 64 bit installation of Windows, there is a copy of libusb-1.0.dll already included in the repository and so you don't need to do this.</li>
</ul></li>
<li><p>Start Matlab.</p></li>
<li><p>[<em>Optional: see bullet point below</em>] Make sure that you have a suitable compiler for using the Matlab mex function. (Check the output of <code>mex -setup</code>.) Then compile the MEX functions using the compile_mex function in <code>controlcont\rtc\matlab</code>.</p>
<ul>
<li><p>If you are using a regular 64 bit installation of Windows and Matlab, there are compiled MEX files ready for use in the repository and so you don't need to do this unless they don't work.</p></li>
<li><p>If the MEX file fails to run with the error "Invalid MEX-file '...': The specified module could not be found." then you need to download the Microsoft Visual C++ Redistributable Packages for Visual Studio 2013 from <a href="http://www.microsoft.com/en-us/download/details.aspx?id=40784">http://www.microsoft.com/en-us/download/details.aspx?id=40784</a>. (These are already installed on many computers.)</p></li>
<li><p>A suitable (free) compiler is Microsoft Visual Studio Community Edition.</p></li>
</ul></li>
<li><p>Add <code>controlcont\rtc\matlab</code> to the Matlab path (<code>help addpath</code>).</p></li>
<li><p>Add the appropriate rig directory to the Matlab path, e.g., <code>controlcont\rtc\rigs\duffing_numerical</code>.</p></li>
<li><p>Create the interface to the controller with</p>
<pre><code>rtc = duffing_numerical_interface()</code></pre></li>
<li><p>All the controller parameters are available through <code>rtc.par.<variable name></code>.</p></li>
<li><p>Time series data can be collected through the use of streams; see the help for <code>rtc.set_stream</code>, <code>rtc.run_stream</code>.</p>
<ul>
<li><p>By default, 5 different streams (0-4) are available for use.</p></li>
<li><p>The maximum amount of data a stream can return is around 8 MB. If too much data is requested, the stream recording will refuse to start.</p></li>
</ul></li>
</ol>
<p>Note: this assumes that a rig specific interface is used to set default parameters. This is not necessary and the generic rtc_interface can be used instead if desired.</p>
<h2 id="to-use-the-real-time-controller-in-python-2.x-or-3.x">To use the real-time controller in Python (2.x or 3.x)</h2>
<ol style="list-style-type: decimal">
<li><p>[<em>Optional: see bullet point below</em>] Download the "Latest Windows binaries" from <a href="http://libusb.info">http://libusb.info</a> and extract <code>libusb-1.0.dll</code> from either the MS32 or the MS64 directory depending on whether you are using 32 bit Windows (and Matlab) or 64 bit Windows (and Matlab). Put it in the <code>rtc\python</code> folder alongside <code>rtc_interface.py</code>.</p>
<ul>
<li>If you are using a regular 64 bit installation of Windows, there is a copy of libusb-1.0.dll already included in the repository and so you don't need to do this.</li>
</ul></li>
<li><p>Start Python.</p></li>
<li><p>Import the Python module and create the interface to the controller with</p>
<pre><code>import rtc_interface
rtc = rtc_interface.rtc_interface()</code></pre></li>
<li><p>All the controller parameters are available through <code>rtc.par.<variable name></code>.</p></li>
<li><p>Time series data can be collected through the use of streams; see the help for <code>rtc.set_stream</code>, <code>rtc.run_stream</code>.</p>
<ul>
<li><p>By default, 5 different streams (0-4) are available for use.</p></li>
<li><p>The maximum amount of data a stream can return is around 8 MB. If too much data is requested, the stream recording will refuse to start.</p></li>
</ul></li>
</ol>
<p>Note: if desired, rig specific interfaces for Python can be created in much the same way as for Matlab.</p>
<!-- pandoc -s install-windows.txt -o install-windows.html -->
</body>
</html>