PiMSO

From Link wiki
Jump to navigation Jump to search

PiMSO

The PiMSO lets you run the MSO-28 USB based Oscilloscope/Logic Analyzer from a Raspberry PI. The Oscilloscope is controlled via the browser on your smartphone, tablet, PC or MAC. The connection to the host is via WIFI or Ethernet.

PiMSO consists of eight parts: Web Server, Wifi Access Point, Name Server, DHCP server, FCGI server, LCD driver, MSO server side driver and MSO client side Javascripts. Not all parts are necessary for the PiMSO to function, a bare bone setup without Wifi is an Ethernet based setup consists of Web server, FCGI server, MSO server side driver and MSO client side Javascripts. We will begin with this scenario.

Getting started

The easy way

The easiest way is to clone the http://bit.ly/IP21ey and copy the raw image into an 8GB SD card. Raw image installation instruction is provided on this site [1].

Roll your own

If you like to install this on your own distro, here is the instruction on how to do it.

Setting up the Raspberry Pi

1. Grab the latest version of Raspian from [2]. Follow the raw images installation instruction provided on this site [3].

2. Boot up the Raspbian and set the it to boot into command line.

Package Installation

1. Gain root privilege.

sudo -i       

2. Update the package list.

apt-get update

3. Install the necessary packages.

apt-get install git-core build-essential nginx hostapd iw minicom usbmount dnsmasq  libfcgi-dev

4. Go to the home directory.

cd / home/pi

5. wiringPi is not necessary if you don't have PiLCD, but it is nice to have for future I/O control.

git clone git://git.drogon.net/wiringPi   
cd wiringPi
./build

6. Grab and install the WebMSO-config.git so the Pi will recognize MSO-28 and MSO-19

cd ..
git clone git://github.com/tkrmnz/WebMSO-config.git
cd WebMSO-config
cp /home/pi/WebMSO-config/74-linkmso.rules /etc/udev/rules.d/.

7. At this point plug the MSO-28 into the Raspberry Pi, you should see it listed under /dev as MSO-28-0.

Setting up the web server

8. Edit the nginx default file.

nano /etc/nginx/sites-available/default

Change the nginx default root directory to /var/www

root /var/www;

9. Also add the following block for fcgi port forwarding.

location /fcgi-bin/mso28ctl.fcgi{
  include fastcgi_params;
  fastcgi_pass 127.0.0.1:9000;
}

10. Copy the proxy.conf to /etc/nginx

cp proxy.conf /etc/nginx/.

The content of the proxy.conf is shown below.

proxy_redirect          off;
proxy_set_header        Host            $host;
proxy_set_header        X-Real-IP       $remote_addr;
proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
client_max_body_size    10m;
client_body_buffer_size 128k;
proxy_connect_timeout   90;
proxy_send_timeout      90;
proxy_read_timeout      90;

11. Check to see if the gzip is enabled in the /etc/nginx/nginx.conf

nano /etc/nginx/nginx.conf

un-comment gzip on;

gzip on;
gzip_disable "msie6";

12. Create the webpage folder

mkdir /var/www

13. Grab and install the WebMSO28fcgi javascripts content

cd /home/pi
git clone git://github.com/tkrmnz/WebMSO28fcgi.git
cd WebMSO28fcgi
cp -rf * /var/www/.  

14. Start the nginx web server.

/etc/init.d/nginx start

At this point nginx should start serving the web page. ifconfig to get your ipv4 address and access it via a browser from a different computer on the same network.

Setting up the FCGI server

15. Add execution privilege of the MSO28 fcgi driver in the /var/www/fcgi-bin directory.

chmod +x /var/www/fcgi-bin/mso28ctl.fcgi

16. Create a temporary ram drive for the mso28 fcgi driver to store the captured data.

mkdir /mnt/tmp
mount -t tmpfs -o size=20m tmpfs /mnt/tmp
ln -s /mnt/tmp	/var/www/fcgi-bin/tmp

17. Grab and install the spawn-fcgi and mso28ctl.fcgi

cd /home/pi
git clone git://github.com/tkrmnz/mso28fcgi.git

copy spawn-fcgi-1.6.3.tar.bz2 to /home/pi and unzip the spawn-fcgi

cp mso28fcgi/spawn-fcgi-1.6.3.tar.bz2 .
tar -xvjf spawn-fcgi-1.6.3.tar.bz2

Install the spawn-fcgi

cd spawn-fcgi-1.6.3
./configure
make
make install
cp src/spawn-fcgi /usr/bin/.

Copy the init script from /home/pi/mso28fcgi to /etc/init.d

cp /home/pi/mso28fcgi/spawn-fcgi1 to /etc/init.d/.
chmod +x /etc/init.d/spawn-fcgi1

18. Compile and copy the mso28ctl to /www/var/fcgi-bin

cd mso28fcgi
touch main.c
sh makemso2.sh
sh msocpy6.sh

19. You can test the installing by starting the spawn-fcgi using

/etc/init.d/spawn-fcgi1 start

You should be able to see the blinking indicator next to the Stby above the timing window of the WebMSO28 client page. If you see No MSO, then your spwan-fcgi is not running.

To stop the spawn-fcgi ctrl-z and kill the process

fuser -k 9000/tcp

20. To auto start spawn-fcgi on boot.

update-rc.d spawn-fcgi1 defaults

To remove spawn-fcgi from auto boot.

update-rc.d -f spawn-fcgi1 remove

At this point server works with ethernet cable. Go to wifi AP setup for Wifi installation and PiLCD setup for the PiLCD module.

PiMSO on Raspberry Pi

Now the PiMSO is installed, you can access the MSO-28 from Midori by running X-Window.

startx

Simultaneously other computers on your network can also access the MSO-28.

PiMSO Wifi AP Setup

wifi AP setup

PiMCO PiLCD setup

PiLCD Setup

WebMSO28 fcgi API

WebMSO28fcgi

MSO28 Registers

MSO28 Registers