Saturday, November 5, 2011

Fast wireless data transfer between Android and Computer

Preamble:
So, a couple of months ago the USB cable which came with my Nexus-S stopped working for data transfer. Since then the number of pictures and videos has been steadily building up. Today I decided to solve that by getting a wifi link to my phone working.
I tried a number of free apps, but none of them could transfer more than one file at once. Then I stumbled upon Software Data Cable, so I thought I would share.

How To:
1) Find and install the free 'Software Data Cable' app on your android phone.
2) Launch it and click on 'Start Service'
3) Download a FTP client on your computer if you don't already have one. I use the free FileZilla client
4) Launch FileZilla
5) On your android there will be an address which looks like ftp://192.168.1.3:8888/
6) Type the 192.168.1.3 bit into 'Host' and the 8888 bit into 'Port'
7) Click QuickConnect

Now you can drag and drop files and folders from you phone (on the right) to your computer (one the left) or vice versa.

Speed up Transfers:
In order speed up the transfer of lots of files do the following:
i) In FileZilla click on 'Edit' -> 'Settings'
ii) Click on 'Transfers' in the left pane
iii) Change 'Maximum simultaneous transfers' to 1
For me this approximately tripled the transfer speed.

Tuesday, November 1, 2011

Fake tech support call

Hey!

Well, I received one of those indian 'I am from Microsoft and your computer has a virus and is going slower and slower' scam calls.

I went along with them to see what scam they were running.

1) They got me to check "eventvwr" and showed me Application Events and claimed they were caused by a virus (they obviously aren't)

2) They then got me to look at "inf virus" and told me these were all caused by virus' too.

3) Then the real part of the scam started when they wanted to have a technician 'help' me. Basically they get you to go to www.letmein123.com from a run dialogue (I'm guessing this gives it administrator rights or similar?). Then, because I "didn't know the 6 digit code that came with my computer" they gave me one. In this case 471831 (DONT TYPE THAT IN!).

I hung up at this point, because I couldn't find a picture of what the letmein page looked like and it's not like I was actually going to give them remote access to my computer.

Wish I had had time to get a virtual machine running so I could run through it with them and see what they tried.


Tuesday, October 18, 2011

Getting UART 1, 2 and 3 to work in the IGEPv2

Hey,

I had quite a struggle getting all three of the UARTs to work under linaro on my IGEPv2. I was originally using linaro-media-create to make my microSD card image. The problem is that this seems to use the linaro kernel, rather than the IGEP kernel. As such, I would recommend first following the steps on my previous post to get the IGEP kernel, with a linaro head on it. This will make getting all of the peripherals to work much easier.

Specifically, here is what I did to get UART 1, 2 and 3 working:

UART 1

Add the following line to igep.ini. For a distribution running off an SD card, this is found in the 'boot' partition of the card.

board.ei485=no

This stops UART 1 being use for RS485 and makes it available to you on J960 at RS232 instead. Note that what is happening here, is that you are disabling RS485 converter, so the RS232 port will looking like it sort of works without it, but only in one direction.

For me, UART1 did not work after the following change, so I also had to follow the instructions in the hardware manual and execute the following commands from within the loaded operating system.

sudo su 
mount -t debugfs none /sys/kernel/debug
echo 0x007 > /sys/kernel/debug/omap_mux/uart1_rts 
echo 0x007 > /sys/kernel/debug/omap_mux/uart1_cts 

For me, the 'none' was already mounted, but it can't hurt to run it again.

Note that the above line 'sudo su' makes you the root user. To get back to being yourself, use 'su USERNAME', where USERNAME is the user you were logged on as.

UART 2

Add the following lines to igep.ini.

buddy=igep0022 
buddy.modem=yes

This enables UART 2 over J990.

UART 3

Comment out the following line in igep.ini by placing a semicolon before it.

;console=ttyS2,115200n8

This disables the serial debug output over UART3 on J960, and makes it available for use by you. This may not be needed, depending on which rootfs you are using. Try joining TX and RX together (pin 2 and 3 on J960). Then open /dev/ttyS2 (say using minicom) and copy and paste a big chunk of data into it. If the screen goes crazy, it is because you are not the only one using UART2, so you have to comment out the above line.

You should now have:

UART 1 over pin 8/9 of J960 at RS232 levels

UART 2 over pin 6/8 of J990 at 1V8 CMOS levels (DO NOT EXPOSE TO ABOVE 1V8!)

UART 3 over pin 2/3 of J960 at RS232 levels

Installing rtklib

Hey all,

Just a quick few lines, which I used to successfully make rtklib under ubuntu 10.10. I am not sure if all install packages are required or not, but the following worked for me.


Download and unpack the latest version of rtklib, 2.4.1 as at October 2011

wget http://www.rtklib.com/prog/rtklib_2.4.1.zip
unzip rtklib_2.4.1.zip
cd rtklib_2.4.1/

Install the required C compiler and Linear Algebra packs

sudo apt-get install build-essential
sudo apt-get install automake
sudo apt-get install checkinstall
sudo apt-get install liblapack3gf
sudo apt-get install libblas3gf

Make it!

cd app/
sudo bash makeall.sh

Tutorial on getting a working IGEP/linaro distribution on the IGEPv2

Hi all!

Over the last couple of months I have been playing around with an IGEPv2. I was starting off with a very limited knowledge of linux and no idea when it came to embedded development. The IGEP wiki was useful, but what with me not having a clue when it came to x-loaders/uboot/kernels, I struggled to get a working microSD card. In order to help out other people in a similar position, I have combined a few different sources from the IGEP wiki into one contiguous file. You can use it from any new ubunutu distribution (or at least all those I have tried), and there is no need to use the 8.04 version supplied by IGEP.

I am not sure exactly what the protocol is when copying bits of a wiki, if there are any copyright issues, please let me know ASAP.

NOTE: Much of what follows is NOT MY WORK. I have copied bits and pieces from various places in the IGEP wiki. It is based on this page.

Preparing the microSD card

Find out which /dev/ directory your micro SD card is connected to:

Open a terminal window and clear your dmesg using:

sudo dmesg -c

Now insert a new microsd card in your PC and then check your dmesg:

dmesg

You should see something like this:

mmc0: new high speed SDHC card at address 0001

mmcblk0: mmc0:0001 00000 3.79 GiB

mmcblk0: unknown partition table

From now on, whenever you see 'mmcblk0' replace it with whatever your output above was . Mine was sdb, and I have replaced it in the following sections. Note that once we make them, partition 1 and partition 2 are

mmcblkp1 <=> sdb1 <=> sdc1

mmcblkp2 <=> sdb2 <=> sdc2

etc, where these appear.

Ensure all in your microsd card it's erased:

$ umount /dev/sdb1
$ umount /dev/sdb2
$ sudo dd if=/dev/zero of=/dev/sdb bs=1024 count=1024
[sudo] password for jdoe:
1024+0 records in
1024+0 records out
1048576 bytes (1.0 MB) copied, 0.43556 s, 2.4 MB/s

Install GParted

We will use the gparted program for create the partitions, if you don't have this program installed then you must install it with this command:

sudo apt-get install gparted

Create the required Partitions

When the install procedure ends you can call the program from your system tools menu or directly using a terminal console using 'sudo gparted'.


Create the MSDOS Partition Table

The next step it's create the msdos table partition for it you should click in the "Device" menu and then in the "Create Partition Table" option.

Check the default option it's create a msdos partition table.

After that you can Apply.

Create the BOOT Partition

The Next step it's create the partitions for it you should go to the partition menu and select the "New" option then the application.

We will configure the partition as:

§ Primary Partition

§ Format: FAT32

§ Size: 100 MegaBytes

§ Label: Boot

§ Align to: cylinder


We must "add" the partition.

It is recommended to apply changes now or you might get an error later.


Create the ROOTFS Partition

The Next step it's create the root file system partition.

First you should select the unallocated partition area and then you should go to the partition menu and select the "New" option.

We will configure the rootfs partition as:

§ Primary Partition

§ Format: EXT4

§ Size: All the Rest

§ Label: Rootfs

At end we will click on "Add" button.


Apply all Changes

Click on apply button in the main menu after that gparted show a window to confirm all operations

We should click on apply button.

Now we can see all partitions and configurations done in the main gparted window

Select "Boot flag" for the boot partition

Now we must select the boot flag for the first partition for it we use the right mouse button over the boot partition and select "Manage Flags" option

Now we have the microsd prepared for copy the boot files

Select the boot partition and mount it in your host.


X-Loader (MLO)

We will build the x-loader (first thing which the processor calls) with Ubuntu Cross Compiler gcc 4.5.2. Install the cross compiler based on your Linux version:

Enviroment Ubuntu 10.10

sudo apt-get install cpp-4.5-arm-linux-gnueabi g++-4.5-arm-linux-gnueabi

Enviroment Ubuntu 10.04

sudo add-apt-repository ppa:linaro-maintainers/toolchain
sudo apt-get install cpp-4.5-arm-linux-gnueabi g++-4.5-arm-linux-gnueabi

Setup the board settings

git clone git://git.igep.es/pub/scm/igep-x-loader.git
cd igep-x-loader
make igep00x0_config

Build

make

Sign the binary x-loader

You should execute contrib/signGP for sign the xloader.

contrib/signGP x-load.bin

Copy the created x-loader.bin.ift into the boot partition and rename x-loader.bin.ift to MLO as follows. Note first you must mount the boot partition by right clicking on 'Places'-> 'boot' and selecting 'mount.'

cp x-load.bin.ift /media/boot/MLO

Now we're ready for test the board boots from the microsd card.

X-Loader boot test

We will eject the boot and rootfs partitions from our Host PC, this step it's a lot important due the Linux must sync all changes before eject the microsd card.

We will insert our microSD card into the IGEP board, connect the serial debug cable and open the serial terminal

Power UP the board and you should see something similar to this put out over the serial console


Configure the IGEP-X-Loader

As mentioned earlier, the x-loader is the first file called by the processor. It is then responsible for calling the kernel. In order to control what start-up parameters the kernel is given, we use a file called igep.ini. You can use a file like this:

[kernel]
; Kernel load address, NOT Modify
kaddress=0x80008000
; RAM disk load Address, NOT Modify
;rdaddress=0x84000000
; Board Serial ID
serial.low=00000001
serial.high=00000000
; Board Revision
revision=0003
; Kernel Image Name
kImageName=zImage
; Kernel RAM Disk Image Name
;kRdImageName=initrd.img-2.6.35-1010-linaro-omap
MachineID=xxxx Where Machine ID = 2344 for IGEPv2 and ID = 2717 for IGEP Module
 
[kparams]
;buddy=igep0022
;buddy=base0010
; Setup the Kernel console params
console=ttyS2,115200n8
; Enable early printk
;earlyprintk=serial,ttyS2,115200
; Setup the Board Memory Configuration
mem=430M
;mem=512M
; Setup the Boot Delay
boot_delay=0
; Setup the ARM Processor Speed
;mpurate=800
; Setup the loglevel
;loglevel=7
; Enable Kernel Debug Output
;debug=1
; Fix RTC Variable
;fixrtc=1
; Configure nocompcache variable
nocompcache=1
; Configure Frame Buffer Configuration
;omapfb.mode=dvi:1280x720MR-16@60
omapfb.mode=dvi:hd720-16@60
; Configure Video Ram assigned
vram=40M
; Configure Video RAM assigned to every frame buffer
omapfb.vram=0:12M,1:16M,2:12M
; Configure frame buffer debug output
;omapfb.debug=1
; Configure DSS Video Debug option
;omapdss.debug=1
; Configure the Board Ethernet Mac Address
smsc911x.mac=0xb2,0xb0,0x14,0xb5,0xcd,0xde
;  --- Configure UBI FS boot --- 
;ubi.mtd=2 
;root=ubi0:igep0020-rootfs 
;rootfstype=ubifs
;  --- Configure NFS boot --- 
;ip=192.168.2.123:192.168.2.129:192.168.2.1:255.255.255.0::eth0:
;root=/dev/nfs
;nfsroot=192.168.2.129:/srv/nfs/igep_rootfs
;  --- Configure MMC boot --- 
root=/dev/mmcblk0p2 rw rootwait
; Assign Init program
;init=/bin/bash
 

Create a new file into the boot partition named igep.ini with these content in it and save the file. I will explain some of the lines in this file in a later post.

Build kernel from sources

Download the latest stable version sources and follow next steps:

wget http://downloads.igep.es/sources/linux-omap-2.6.35.tar.gz

tar xzf linux-omap-2.6.35.tar.gz

cd [kernel version]

A generic configuration is provided for all IGEP machines, and can be used as the default by

make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- igep00x0_defconfig
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- zImage modules


Create the Rootfs mount point

Go to /media directory and create one sub-folder called "binary"

$ cd /media
$ media > sudo mkdir binary


Mount the RootFS partition

Mount the rootfs partition using the 'binary' directory

$ media > sudo mount /dev/sdb2 /media/binary


Download rootfs

The rootfs (also called the 'head' I think) is what we see of the operating system. In this tutorial I will use a rootfs made by linaro. There are several options available from

http://releases.linaro.org/platform/linaro-m/

ALIP - a very basic desktop including applications for internet browsing (ubuntu 10.10 based)

Netbook - has a few more features and is a bit bigger/slower but comes with a bunch of useful programs pre-isntalled

Plasma - the biggest of the options, it also has the nicest features and best looking desktop.

Headless - doesn't use a screen. To access it, you have to use a remote console via a serial link.

$ media > wget http://releases.linaro.org/platform/linaro-m/alip/final/linaro-m-alip-tar-20101109-0.tar.gz

Untar the rootfs package

Make sure "linaro-m-headless-tar-20101108-2.tar.gz" or whichever linaro you have decided on is inside the /media directory and untar it using:

$ media > sudo tar xvfz linaro-m-headless-tar-20101108-2.tar.gz

Install the kernel modules

Now you should install your kernel modules inside your root file system.

$ media > cd /home/jdoe/linux-omap-2.6
 
$ /home/jdoe/linux-omap-2.6 > sudo make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- modules_install INSTALL_MOD_PATH=/media/binary
 

Install the kernel Image

Just copy the zImage inside your boot partition, remember before that you must mount your mmc boot partition.

$ /home/jdoe/linux-omap-2.6> sudo cp arch/arm/boot/zImage /media/boot/

After that you can unmount the boot & rootfs partitions. You may need to umount sdb2 twice if you get an error the first time

sudo umount /dev/sdb1
sudo umount /dev/sdb2

Now we're ready for test our new microsd card

Test your new MicroSD

Put your new SD card into your IGEP and power it up, with a monitor plugged into you DVI port. A red LED on your IGEPv2 should come on (this is the xloader doing its thing). This should then turn to a solid green LED as the kernel loads. Soon after this, some lines of debug info should start showing up on your screen, then a short pause and finally your working rootfs should load (i.e. your computer is now on!).

Tuesday, May 17, 2011

Matlab Subplot Spacing

Hey all, Just a quick matlab tip. I have been playing around with sub plots quite a bit and the margins between images seems far too big, especially when you are subplotting quite a few figures. I did a bit of a google, but couldn't find anyone with a quick tutorial on how to reduce the margins and increase image size. So here it is:

1) Go to your MATLAB folder in program files. It was 'C:\Program Files\MATLAB\' for me.
2) Navigate to '...\MATLAB\toolbox\matlab\graph2d\subplot.m'.
3) Make a copy of this subplot.m and put it in your current working directory (wherever your current files are).
4) Open it up, and find the line that says 'inset = [.2 .18 .04 .1]; % [left bottom right top]'. Change this to whichever margins you are after. I use 'inset = [.02 .05 .02 .05];'.
5) Save it.

If you want a more permanent solution, replace the file at '...\MATLAB\toolbox\matlab\graph2d\subplot.m' with the fixed subplot.m file, so that the fix will apply to all future projects. Don't forget to make a backup of the original file in case something goes wrong. I have checked this with R2010a and R2010b. If any changes needed for other versions, post a comment and let me know.

Now, whenever you make subplots in this folder, the margins will be smaller and the plots with be bigger! Note that this still isn't perfect, as the margins can still be pretty big when you have elongated graphs, but to fix that you have to start playing around with graph location and size, which is a bit more trial and error.

Friday, December 5, 2008

New Zealand on a whim

So when I started this blog I swore to myself I would be good, post often and not let it get washed to the wayside. Two months on and there has been a distinct lack of blogging. Typical.

Anywho, I now have a chance to do a post on the travel side of things. At the end of last semester I was getting itchy feet, what with having been in the county for several months and not having any plans for the Christmas holidays. Vac work was originally supposed to take up my time, but no one wanted me (or maybe it was because I only applied to one mine and they didn’t want mechatronic engineers.. hmm.. well organized Thomas). Sooo, I had to come up with other plans. A quick browse of bestflights.com.au and I discovered the only place I could afford to go to was New Zealand. No problem there, its a nice place, and the weather is better than in Australia, so a few indecisive days and $450 later I had myself I ticket.

What to do, that was the next question. I like the idea of flying, for no particular reason. I was always very impressed when I was a kid and we drove past those people running down hills with big kites strapped to them. I get the feeling I’ve explained my reasoning somewhere in another blog, so long story short I am in Queenstown, with no real plans other than I want to get my PG1 paragliding license!

Day 1:
I arrived in Christchurch on the 1st and gave the people I had hired a car from a call (Apollo, got a car for under AU$20/day). The car, a 4ish yr old Toyota Getz, was very abused. It had more scratches and dints than I could fit on the damage report form. At this point, I had a car for 15 days, a flight home and that was it. It was very relaxing. I had picked up a few hostel brochures, so I drove into town to Thomas' on Hereford. For $22 a got myself a bed for the night, very reasonable. It was a clean place, not too much to it, but the staff were friendly, and it was close to the centre of town.

Day 2:
Spent a night there, then bought some groceries and headed south. I didn’t really have any plans, but I figured I wanted to go in the general direction of Queenstown. Had a few issues with my lane turning into a big pile of gravel at the beginning of the 79, just across in the train line, so that was my excitement for the day. Found a friendly panel beater in Geraldine who fixed it up for me for $80 cash after he finished work, so that was nice. Could have claimed it on insurance and the such, but for $80 it really wasn’t worth the hassle. Spent a night camping at Lake Tekapo, on Lake Alexandria Road I think. Nice little spot, $5pppn and very quiet. Little bit of unsealed road at the end of it, but its easy enough to walk if your worried about the car.

Day 3:
Next day made it all the way to Frankton, just outside of Queenstown. Detoured via Arrowtown, with the thought of going to Macetown. Turns out it is a 4 hour walk, or 4by4 access only though, so that plan failed quite abruptly. Ended up continuing on to Frankton Motor Camp for $14/nt. They had awesome showers, a kitchen (with pots and pans which could be borrowed from reception) and a awesome view. Unfortunate that it rained all night and it took me all of 4 hours to get the tent dry enough to pack up, but other than that it was great!

Day4:
After having packed up my tent (and I cant stress how painful it was waiting for it to.. it seemed to be getting wetter rather than drier most of the time), I drove the quick 6km to Queenstown and found myself a hostel (with the help of hostelworld.com). Decided on Bumbles Backpackers (28 pppn), which was a good choice. A 5 min walk from the town centre, it has off street parking, a well equipped kitchen and reasonable beds. I even managed to score a non-bunk bed which was very exciting. Explored Queenstown, bought myself a few knickknacks (love the pink store) and booked my PG1 course. All the hostel stuff seemed quite enthusiastic about it, which I was surprised by, I thought lots of people would do that sort of stuff.

Day 5:
Today! WELLL... at 8:45am I called up Elevation Paragliding to check the weather. It was a go, so at 9am, their van pulled up outside the hostel and in I jumped. It was a morning, so unsurprisingly I was completely unprepared, with no food, water or sunscreen. I was warm though.. with my fancy new thermals I bought yesterday. The instructors, Keith, and an English lady(whose name evades me) picked me up. We then picked up a French family with 3 daughters under the age of 5. They all seemed quite well behaved though. Off we went to the training hill, just outside of Queenstown.
At this point, I am running out of internet time, so I am going to steal a bit from an email I sent Amanda:
Had my first paragliding lesson today.. all was perfect (blue sky, 18 degrees, almost no wind) while we set up and the instructor explained everything too me.. then just as he strapped me into the harness, the wind picked up to 35-40km/hr! Which apparently isnt good when you are trying to learn.. The paraglider has a constant speed to 35km/h, so if you take off into the wind you are standing still or going backwards...
Anywho.. we waited a while and we had a lull in the wind, so I took off. At this point the instructor is telling me "okay, we are just going to run down the hill and you will feel the sail take your weight and pull your heels off the ground and then you put it right back down again." All went well, until I actually tried it. A gust came along, and next thing I know he is saying "Just go with it! Your not THAT high, oh crap, pull down, pull down!!" By this stage I am about 2 meters up haha. But I got it down nice and safe and IT FELT AWESOME!!! I FLEWWWW!!!! like a bird! I love birds :) They’re so lucky.. I bet they don’t have to double check all their lines and stuff before they take off though haha.

On that note, I feel I should really get outside and see the real world for a while.. I have a quite exciting Buttered Chicken and rice waiting at home to be cooked... I know your all jealous.