Views

For Beginners

From GNUBLIN

In the tutorial for beginners you will learn how to switch a LED on and off on the Gnublin-Board and how to use a digital Input. Further you will learn some commands to explore the Linux system on your board.

Login as root

You have two options to connect to your Gnublin Board. The first option is to use the intern USB_to_RS232 converter as a shell for Linux, or you can buildup a virtual network connection over the USB interface with which you can connect over SSH. The first option is more comfortable and easier.

Output if the pin is high or low (1 = about 3.3V, 0 = about 0 V or rather GND) is easy. Therefor you must only cat the file value

cat /sys/class/gpio/gpio11/value

This is the way how GPIO works on a Linux platform.

Measure analog voltage

The easiest way to measure analog voltage is to use shell commands. At first you have to select the desired analog-input GPA1:

root@armv5te:~# echo "1" > /dev/lpc313x_adc

Thats it, now you can measure analog voltage with the following command:

root@armv5te:~# cat /dev/lpc313x_adc

The output of the command is just a simple Hexnumber like:

0x3b2

The adc has a resolution of 10bit by default. The values you get are between 0 and 0x3ff for the default resolution. The adc can work with resolution of 8bit or 4bit, too. Details about how to configure the resolution can be found in the Treiber .

An editor for Gnublin to write programs on

To write a program for GNUBLIN directly on the GNUBLIN you need something like a texteditor. GNUBLIN has two texteditors in the eldk-root-file-system the classical vi and nano .

Create a new file with vi:

vi test.txt

To write something inside the newly created file, you have to press the button i to get into insert-mode
If you have finished writing you have to press ESC first to get out of the insert-mode and get back into the command-mode
Now you can save your file and quit the editor by typing :wq or for the lazy people :x

Commands:

:w (save Document)

:q (quit Document)

:x (write and quit Document)

nano - The user-friendly editor

You can edit a textfile with the following command:

nano test.txt

You can see a menu with useful commands at the bottom of the shell. You can save a file with the command CTRL+o and afterwards pressing the Enter button.If you want to close nano you must press CTRL-X. The other commands are self-explanatory.

Hello World, the first project of a developer

The purpose of an Embedded System is, in nearly every case, to automate some processes in the "real world" or to regulate a system. There are a lot of programs, ways to communicate and literature about hardware. You have a huge variety of program languages you can use. Below you can see a small "Hello-World-Program" in different languages, and how you can execute it. We use vi or nano to make and edit the Hello World Program.

Bash Scripts

hello.sh

#!/bin/bash
STR="Hello World!"
echo $STR

How to Execute:

sh hello.sh

C Programs

There is a ready-to-go C-Compiler on the Gnublin. Of course it's not the fastest Compiler, but for small programs it's sufficient.