Saturday, July 13, 2013

Emulate Raspberry Pi - My Walk-through - Build QEMU on Ubuntu 12.04

Although i already have the real Pi on my desk, setting up the emulation can speed up compiling projects by using my desktop computer power.

I have a ubuntu 12.04 running on a AMD quad core machine that i think will be nice for emulation.
Lot of successful stories on the net.  The following is my version.


Emulation using QEMU

The command i need is 'qemu-system-arm'.  But the software manager somehow doesn't have 'qemu'.   (on newer os 'qemu' can be installed using software manager).

So I decided to build QEMU myself (reference: QEMU - Compiling for ARM (1176) emulation)

Steps:

1. set up environment
sudo apt-get install git zlib1g-dev libsdl1.2-dev libpixman-1-dev
mkdir ~/raspi
cd ~/raspi

2. download qemu latest source code from here.

3. uncompress qemu
tar jxvf qemu-1.5.1.tar.bz2

4. config, compile, and install are straight forward
  ./configure --help
  ./configure --target-list="arm-softmmu arm-linux-user" --enable-sdl --prefix=/usr
  make
  sudo make install

5. query supported chips including arm1176 for raspberry pi
qemu-system-arm -cpu ?


Disk Images

Emulation requires two files:  kernel and partition image

Steps:

1.  get kernel:
wget http://xecdesign.com/downloads/linux-qemu/kernel-qemu

2. get Raspbian from their site


It took a while for downloading the image.  Everyone said go for a coffee.  I went for a shower.  :P


Let's Roll it!

Now, run Emulation by one single command:

qemu-system-arm -cpu arm1176 -kernel kernel-qemu -name 'builder-raspi' -m 256 -M versatilepb -no-reboot -serial stdio -append "root=/dev/sda2 panic=0" -hda 2013-02-09-wheezy-raspbian.img


and ........  well!  it DOESN't work!

qemu booted up and stuck at an error, something "... Id '1' respawning too fast.  Disable for 5 minutes"

searched on the net...
It's the latest image having problem.  Some guys came up with a patch; i went for an older version of wheezy, 2012-10-28-wheezy-raspbian.img.

finally boot up successfully.   ^^

just in case, the default username is 'pi'.  password is 'raspberry'.


References:

Labels: ,

Friday, April 19, 2013

My Raspberry-Pi Experience

(I haven't written in this blog for long time.
Well, using raspberry pi is kinda linux stuff.  However, my goal is to make it a robot, so let's put what I've experienced here.  These are my baby steps' log. )



Date: 121220 (logged in 2013)

I tried a model B 256MB during 2012 Christmas.  Running Raspbian (build 2012-10-28) on it was surprisingly smooth.  The bottleneck was all about the slow SD card.  Once the programs were loaded up, they ran with good responsiveness.  Raspbian is a modified version of Debian, to support a ARM chip with VFP.  See hardware, and wiki.

Compiling programs on it using GCC is possible but very slow due to its lack of processing power CPU.  Instead, you can cross-compile the applications in linux.



Date: 130415



I ordered a model A-256MB and a model B-512MB.  It took only 2 days to arrive that I was totally impressed.


Model A has half memory, only one usb port and no ethernet port build-in.  I ordered it for its less power consumption, hopefully to extend the battery life if any.  (still not sure if a wise idea)



Date: 130419

First playing with the A board...

Model A couldn't recognize my basic USB hub, the same one that was running okay on the 'B' .  I assume it needs powered hub.  Will get one later.

I also get a WIFI adaptor, TL-WN725N.  A page on eLinux.org said hardware version 1.0 works out of the box.  ie. ver 2.0 needs some .ko file.  Google it if you need it.  Pre-setup the wlan0 on the SD card before plugging into the A board.  Once it power up, it automatically connected to my wireless router.  Nice.  Even better if i can find the command line wlan0 setup... (to be cont..)

I also try hooking up a no-brand linux compatible USB Ethernet Adaptor to A-board's only USB port.  Works right away. 



Date: 130509

ref: http://elinux.org/RPi_VerifiedPeripherals
Extend model A with a powered usb hub: startech.com  ST7202USB, tested in 15 mins:
- power pi A from the hub: YES
- keyboard/mouse: YES
- wifi adaptor: YES
- usb-to-lan adaptor: seems OKAY.  i could see eth0 detected.  not yet actually connected a lan cable though.  will try...
- disconnection: possibly - wlan0 was reset once while i tried to set up using WPS.  will continue monitoring.

in general, i am happy!   :)


Date: 130526

Playing with the GPIO.
Some page warns that GPIO uses 3.3V logic, not 5V commonly in TTL.
It is highly recommended that using protective circuits on all I/Os, eg. zener diodes.
I had been making the breakout board.  Then found out there's breakout board kit available saving you time shopping for different components. 
(tbc...)



Date: 160826

Labels: ,

Sunday, May 27, 2007

Autonomous Blimp - Stage 2 + Final Report

The Video
2nd Stage: Joystick Remote Control + auto-Height Adjustment (PID)
3rd Stage: Autonomous Control: Tracing Light Source

 It can now maintain height by using PID control on sonar data.


Labels: , , , , , , , , , , , , , , , ,

Tuesday, January 30, 2007

Autonomous Blimp - Stage 1


joystick controls 3 propellers to go forward/backward, up/down, or to turn and spin.

It uses atmel at90 board, a/d for reading the joystick positions, and pwm for driving the motors.

3 stages for this project:

  1. Joystick controlling motors, polling loop for inputs
  2. Mount motors on the blimp, wireless radio remote control and data transmission, sonars, Real-time OS, RS-232
  3. Fly freely in a building by itself, from one end to another landing on a light source( w/ light sensors), gryos, accelerometers...

Labels: , , , , , , , , , , , , , , , ,