Mixed Reality Board
September 03, 2010, 09:42:38 am *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: Welcome to the official Mixed-Reality forum!

If you have problems to register, please mail to h/dot/spille/at/gmail/dot/com
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: How to get started programming the robots  (Read 1646 times)
guerra
AsadaLabs
Full Member
*
Posts: 109



View Profile WWW
« on: April 08, 2008, 10:17:45 am »

For those interested in using the robots in fully autonomous applications here are some tips and links that should help getting you started.

The new robots will be pretty powerful and allow much expansion, but how can someone start learning to program these things? Well, the robots are not ready yet, and even after they are delivered there is not much that one can do with them without having a firmware. We expect to have development for at least a simple firmware that listens to the infrared commands sent by a PC and then spin the wheels appropriately. But using such powerful microcontroller just for that is a little bit of a waste.

The new robots can be used also completely independent of an external control, in a fully autonomous application. Actually these robots have such huge battery capacity and such a small size that they are likely to be very good for a wide range of applications in research and education. But in order to have a robot reacting to the environment where it is inserted it needs sensors and perhaps even new actuators. The sensors and actuators can be attached to the robot itself using the expansion connector on top of it, but then one needs to program the firmware of the robot in order to get data from its sensors and send control commands to its actuators.

The good news is that you can start learning and implementing code for the robots right now!

ABOUT THE PROCESSOR

The new robots will have a microcontroller board based on the ARM processor AT91SAM7X256. This processor is not like the processor of a computer because it includes already many integrated devices, integrated memory and so on, so it is already more like a very small computer on its own -- this is why it is called a microcontroller. To see the specs of the processor itself you can have a look at http://odin.pcag.fh-wolfenbuettel.de:8080/mixedreality/index.php/topic,19.0.html and at the documents found at http://www.atmel.com/dyn/products/Product_card.asp?part_id=3755

DEVELOPMENT BOARD

If you never programmed a microcontroller before you may find it a bit overwhelming to have to understand how it works by reading its datasheet which has almost 700 pages. So the best way to get quickly started is to get some development board with some sample application. There are plenty of different development boards based on ARM processors but since these processors include many peripherals around it then different processors have slightly different configurations, so it seems much easier to start developing already with a development board that uses exactly the same processor that is to be found in the robot. Currently there are two very interesting boards for sell that fullfill the above points:
1) Olimex http://www.olimex.com/dev/sam7-ex256.html
2) Make Controller http://www.makezine.com/controller/

This means you can take advantage of all the documentation and example codes available for these development boards. Make Magazine, being a magazine directed towards a general audience, have very good tutorials for beginners. Take a look for example at http://www.makingthings.com/documentation. Actually you could simply guide yourself pretty much from there and ignore the rest of this post. Smiley

PROGRAMMER DEVICE

Besides the controller board itself one also needs some way of programming it (uploading the program to the board and debugging). In the ARM the most flexible way to upload and debug is by using a JTAG firmware uploader. Probably, if you are a developer using a modern computer, then you will want an USB-to-JTAG programmer/debugger. This programmer is not only needed in order to program the development board, but it is also going to be needed in order to program For this there are several options, among which there is:
1) Olimex http://www.olimex.com/dev/arm-usb-tiny.html
2) Olimex for several ports including USB http://www.olimex.com/dev/arm-usb-ocd.html

UPLOADING/DEBUGGING INTERFACE

The piece of software that you need to install in order to use the above programming/debugging devices is OpenOCD. There are plenty of tutorials instructing how to install this. I will just paste here the way it worked for me:

If you are using a Mac you need to install the FTDI D2XX Dynamic Library, if you are using Linux then maybe you can proceed to step 5 below:

1) Get latest FTDI Mac OS X D2XX dynamic library from http://www.ftdichip.com/Drivers/D2XX.htm. Copy D2XX/Samples/ftd2xx.h and D2XX/Samples/WinTypes.h to /usr/local/include

2) This step may or may not be needed, but here it is anyway. Modify the D2XX/bin/ftd2xx.cfg file's VID (VID_0403) and PID (PID_6001) as needed for the FTDI JTAG device as needed. If you have the device connected, you can use USB Prober (part of Apple's developer software installation) to find the VID and PID. For example, the Amontec JTAGkey needs the following: [VID_0403&PID_CFF8]

3) Copy the D2XX/bin dynamic library and D2XX/bin/ftd2xx.cfg file to /usr/local/lib (in this example the dynamic library is libftd2xx.0.1.0.dylib)

4) Create a symbolic link to the dynamic library:
Code:
ln -sf libftd2xx.0.1.0.dylib libftd2xx.dylib

5) Now you can proceed with the installation of OpenOCD. Linux users probably can start following from here (someone who did this in Linux please give me some feedback if any of the above is needed in Linux). Get latest OpenOCD source from svn://svn.berlios.de/openocd/trunk

6) Using a terminal window (at least for Linux and Mac, I don't know about Windows), change to the root of the OpenOCD source code and type the following sequence of commands:
Code:
aclocal
autoconf
autoheader
automake -a
./configure --prefix=/usr --enable-ft2232-ftd2xx --with-ftd2xx=/usr/local/include

7) If you are using a Mac then in ./src/Makefile, change FTD2XXLDADD (about line 102) to point to the FTDI dynamic library:
Code:
FTD2XXLDADD = /usr/local/lib/libftd2xx.dylib

8 ) From the root of the OpenOCD source, now make and install the project:
Code:
make
sudo make install

COMPILER

In order to compile the programs you also need to install the compiler, which in the case of the ARM happens to be GNU GCC Smiley . Here is the link to the precompiled binaries http://www.gnuarm.com/

DESIGNING EXPANSIONS

The schematic of the Olimex and Make Magazine controllers are available online. Together these two development boards show how to connect digital I/Os, AD/DA converters, relays, USB port, SD/MiniSD/MicroSD cards, ethernet, speaker/headphone, microphone input, LCD display, serial port, buttons, joysticks, etc. The robot uses the same processor but lacks these specific peripherals, but usually these peripherals are very easily to implement by simply adding a few components that connect somehow somewhere into the processor. Well, these connections are already design there in the development boards above cited, so one can simply implement the same design in the robot controller, but miniaturized. So, if for example you want the robot to respond to sound, then one easy way to get an idea of how to connect a mic into the controller is by ing a look on how Olimex did it. Then you can not only design very quickly expansion modules, but also your code can be transfered directly from the development board to the robot controller and vice-versa.

To check which pins are found where in the new controlling board just use the attached file as a reference.


* ecobe2-sch-rev2-2.png (93.67 KB, 2116x1481 - viewed 334 times.)
« Last Edit: April 08, 2008, 10:23:54 am by guerra » Logged
Henning
Administrator
Full Member
*****
Posts: 108



View Profile
« Reply #1 on: April 11, 2008, 08:40:20 am »

Hi,

i used this:
http://www.mikrocontroller.net/articles/ARM_GCC_toolchain_for_Linux_and_Mac_OS_X

ther is also an howto install. Works fine

FTDI fpr JTAG
Dowlnload Driver: http://www.ftdichip.com/Drivers/D2XX/Linux/libftd2xx0.4.13.tar.gz
# copied the dynamic lib with cp libftd2xx.so.0.4.13 /usr/local/lib/
# created symlink of
Code:
ln -s /usr/local/lib/libftd2xx.so.0.4.13 /usr/local/lib/libftd2xx.so
# created symlink of
Code:
ln -s /usr/local/lib/libftd2xx.so.0.4.13 /usr/lib/libftd2xx.so
# copied ftd2xx.h and WinTypes.h into /usr/include
# edited /etc/ld.so.conf and added the line
Code:
/usr/local/lib
# run ldconfig from a console to rebuild the runtime loader database of available libraries
# edited /etc/fstab to add a line of
Code:
none /proc/bus/usb usbfs defaults,devmode=0666 0 0
# run mount -a from a console to mount the new USB filesystem


« Last Edit: April 22, 2008, 09:42:40 am by Henning » Logged
Henning
Administrator
Full Member
*****
Posts: 108



View Profile
« Reply #2 on: April 22, 2008, 10:13:07 am »

Open OCD needs to be configured:

Fist, checkout:
Code:
svn checkout svn://svn.berlios.de/openocd/trunk

sec, generate skripts with bootstrap and configure with ftdi param:
(maybe you need to install automake for bootstrap && texinfo for compiling using make)
Code:
./bootstrap
./configure --prefix=/usr --enable-ft2232-ftd2xx --with-ftd2xx=/usr/local/include
make
sudo make install

After installing OpenOcd you can start to flash the Arm. There is a Problem that the newer versions of OpenOcd are not compatible with the older ones. So you might experience some error messages like this:
Code:
Info:    options.c:50 configuration_output_handler(): Command write_binary not found
In that case you have to change in your flash.script the flash command to
Code:
write_bank
instead of
Code:
write_binary
The flash command looks like:
Code:
openocd --file sam7flash.cfg

Later i will put a DemoProjekt in the CVS for everyone to play with the development board.

Regards
Henning

« Last Edit: April 22, 2008, 12:01:16 pm by Henning » Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC Valid XHTML 1.0! Valid CSS!