Quick Tip: Pause any process you want in Linux

 mike@krusty:~$ pidof ffmpeg
 22730
 mike@krusty:~$ sudo kill -STOP 22730
 [sudo] password for mike:
 mike@krusty:~$ sudo kill -CONT 22730

Holy crap, how come it took so long for me to figure out you can pause a running process in Linux and restart it later? I was looking at the manual page for the kill command (man kill) when I started wondering what the CONT option is used for. It turns out that it is paired with the STOP option (and a couple of others) which can be used to pause a running process. Here’s a quick rundown of the process:

  1. Find the PID of the process using the ‘pidof’ command
  2. Pause the process using that PID (22730 for example): sudo kill -STOP 22730
  3. Go about your business
  4. Restart the process when you’re ready: sudo kill -CONT 22730
What can you use this for? Well, if you’re doing something processor intensive, like transcoding video, you might want to regain your CPU power for a quick task. This lets you do that.

Terminal Life

Terminal-life

After completing my first iteration of Conway’s Game of Life I was unhappy with the performance. After a bit of testing I discovered that the real bottleneck wasn’t in my algorithm, but in the overhead associated with the pygame module that was taking care of the graphics.

 

I just completed a branch of the code that does away with the pygame module. Instead, it runs in a bash shell. The program uses tput to read in lines and columns available in the terminal, and also to move the cursor back to the top left before each new generation is drawn. Of course the limitation here is that it only works on Linux. I was able to maintain the look by using a Unicode character which draws a box. That’s a screenshot of the code running.

AVR Development using Eclipse

I’ve just today set up and started using Eclipse as an IDE for AVR development. I got here in a rather roundabout way. My current project is a tetris-like game played on a 3595 lcd screen. I’m having a bit of trouble with the scalability of the playing area and needed to do some debugging. I installed avarice and avr-gdb and did a bit of debug-wire work with those for the first time, but I wanted a way to tie everything together. It seems that eclipse will allow me to code, build, program, debug code, and hardware debug all in one. First thing is first though, I needed to get eclipse installed and running.

Trial and Error
I use Ubuntu 8.10 Intrepid Ibex and Eclipse is in the repositories, yay!! An hour and a half of downloads later I can’t get the AVR-eclipse plugin to work. Great.

Well, come to find out that Ubuntu has Eclipse version 3.2.2 in the repository and the AVR plugin needs a minimum of 3.3 installed. Fortunately eclipse comes as a java package, requiring no compiling. In fact, I don’t think you even need administrative privileges to install it.

Go download the Eclipse IDE for C/C++ developers here:
http://www.eclipse.org/downloads/

Unpack it, I just put the eclipse folder from the tar package in my home directory. To run it just go into that directory and type:
./eclipse

We will need to AVR plugin for eclipse. To install it go to Help –> Software Updates. Click the available software tab, click add site and put in this url:
http://avr-eclipse.sourceforge.net/updatesite/
In the window to the left expand the tree next to the url you just entered. Check the box next to AVR Eclipse Plugin and click Install to the right.

The plugin will download and install and then you will be prompted to restart eclipse, do so. Once you are back in use the AVR plugin help file to get things going. Find this by going to Help –> Help Contents –> AVR Plugin –> Getting Started.

Following that guide for about 5 minutes I was able to code, build, and program an app that flashed 6 leds in sequence on my development board (Dragon Rider 500) using a mega168 (what I already had sitting in the board. I’m asking my self why I didn’t start using this method much sooner.

There is a pretty good wiki regarding this AVR plugin:
http://avr-eclipse.sourceforge.net/wiki/index.php/The_AVR_Eclipse_Plugin

I’m going to look into on-chip debugging using eclipse along with avarice and avr-gdb. Check back for more on that.

Programming AVR on Ubuntu 8.10 Intrepid Ibex

I have been using kubuntu as my OS for quite some time.  This week I upgraded to 8.10 Intrepid Ibex and it is awful (the kubuntu version).  I had major issues with using remote desktop and I don’t like the “usability” of the new version of KDE.  To make a long story short, I’ve switching back to ubuntu (which uses the gnome desktop) by way for a fresh install and need to set things up to program AVR again.  Let’s see if I can remember how I did it before. Continue reading

what’s this about?

I’ve recently gotten into hobby projects using the AVR line of microcontrolers made by Atmel.  I had dealt in the past with the BS2 (Basic Stamp 2) microcontroller but finally decided to make the switch due to the extremely slow clock speed.

I don’t use windows.

I use Ubuntu 7.10 “Gutsy Gibbon” which you should know, is a fairly poplar Linux distribution.  I have been staying away from Atmel’s AVR Studio software because it cannot be run on Linux.  So, here are some of my experiences getting into AVR microcontrollers in a linux environment.