Author Topic: HOW-TO Axon with Ubuntu  (Read 10433 times)

0 Members and 1 Guest are viewing this topic.

Offline smaniTopic starter

  • Beginner
  • *
  • Posts: 4
  • Helpful? 1
HOW-TO Axon with Ubuntu
« on: June 14, 2009, 06:33:51 AM »
Here is a quick how-to for working with the Axon on Ubuntu (and any other distributions, just use the according packages). I prefer to work with minimalistic tools, i.e. text editor and command line, hence this "development environment" does not make use of AVR studios or similar, although AVR studios exists for linux, and therefore should not be too much of a problem to install.

Enjoy, smani

**************************************************
* Axon on Ubuntu Linux (tested with 9.04 and up)     *
**************************************************

* INSTALLATION

- Base packages:
   sudo apt-get install build-essential gcc-avr gdb-avr binutils-avr avr-libc simulavr minicom

- Compile the bootloader
   Download the bootloader [1]
   cd <bootloader_dir>
   make

* WORKING WITH THE CONTROLLER

- Plug the controller in a USB port, recent kernels already contain the driver.
- Check if the BAUD rate of the serial port is correct [2]:
   stty -F /dev/ttyUSB0   (use /dev/ttyUSB<n> according to your particular system)
  The BAUD should be 115200, else set it:
   stty -F /dev/ttyUSB0 115200
- Connect to ttyUSB0 via minicom [3]:
   - run
      minicom -s
     choose Serial port setup and select the correct serial device node (here /dev/ttyUSB0)
   - Save configuration as def[ault] (optional)
   - run minicom, you should now be connected
   - To quit minicom, CTRL+A, then Z and finally Q

* PROGRAMMING

- Download Axon source files
- Edit the source files as you need
- Run make
- Assure your Axon is turned OFF! (i.e. battery disconnected, but still connected to USB clearly)
- Upload the program to the device (make sure minicom is not active!):
   ./bootloader -d /dev/ttyUSB0 -b 115200 -p file.hex
  where file.hex is your program (run bootloader without arguments for help)
- Turn on your Axon (i.e. connect power), programming should start (make sure there is no minicom instance running as it will lock the device!)
- Once programming is complete, your done.

* REFERENCES

[1] http://www.avrfreaks.net/index.php?module=Freaks%20Academy&func=viewItem&item_type=project&item_id=1927
[2] http://embedded.seattle.intel-research.net/wiki/index.php?title=Using_other_UARTs_in_Linux
[3] http://www.cyberciti.biz/tips/connect-soekris-single-board-computer-using-minicom.html

Offline awally88

  • Robot Overlord
  • ****
  • Posts: 212
  • Helpful? 0
Re: HOW-TO Axon with Ubuntu
« Reply #1 on: June 14, 2009, 09:36:00 PM »
<3  , I've been looking to buy an Axon however I am a big Ubuntu fan and don't want to have to run Vista for all my microcontroller needs. I've been holding off buying one until I have enough time to properly get it working, this makes it so much easier for me!

Thanks for the tip!

Offline smaniTopic starter

  • Beginner
  • *
  • Posts: 4
  • Helpful? 1
Re: HOW-TO Axon with Ubuntu
« Reply #2 on: June 15, 2009, 02:51:55 PM »
I also wrote a simplier makefile that includes only the essential rules, allowing easier editing and also including a rule to program the device (note that bootloader needs to be in your PATH, otherwise change the path below, i.e. to ./bootloader):

# Simple Makefile for Axon
# Written by Sandro Mani, version 20.06.2009
#
# Rules:
# all      -> build
# build      build the program
# clean      clean built files
# program   program the device

# Project settings
# MCU type, i.e. atmega640
MCU = atmega640
# dev node of the controller, i.e. /dev/ttyUSB0
DEVNODE = ttyUSB0
# Name of the project
NAME = Axon
# List of needed object files
OBJFILES=a2d.o main.o buffer.o rprintf.o timer640.o uart4.o

# Compiler flags settings
CC = avr-gcc
CFLAGS = -mmcu=$(MCU) -Os -Wall -Wstrict-prototypes -std=gnu99
LDFLAGS = -lm

all: build

build: $(NAME).bin
   @echo Creating program $(NAME).hex...
   @avr-objcopy -O ihex -R .eeprom $(NAME).bin $(NAME).hex
   @echo
   @echo Done!
   @avr-size --target=ihex $(NAME).hex

$(NAME).bin: $(OBJFILES)
   @echo Linking $(OBJFILES) to $(NAME).bin...
   @$(CC) $(CFLAGS) $(LDFLAGS) $(OBJFILES) -o $(NAME).bin

%.o: %.c
   @echo Compiling $<...
   @$(CC) -c $(CFLAGS) $< -o $@

clean:
   @echo Cleaning up...
   @rm -f *.o $(NAME).bin $(NAME).hex

program: build
   ./bootloader -d /dev/$(DEVNODE) -b 115200 -p $(NAME).hex

.PHONY: all build clean program
« Last Edit: June 20, 2009, 05:31:29 AM by smani »

Offline Resilient

  • Full Member
  • ***
  • Posts: 111
  • Helpful? 4
Re: HOW-TO Axon with Ubuntu
« Reply #3 on: June 15, 2009, 06:43:52 PM »
Is this using just the standard USB cable attached directly to the Axon? Or is it using some other hardware to attach to the Axon?

Offline smaniTopic starter

  • Beginner
  • *
  • Posts: 4
  • Helpful? 1
Re: HOW-TO Axon with Ubuntu
« Reply #4 on: June 16, 2009, 10:15:04 AM »
Nono, standard USB cable. Just Plug-n-Play.

Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,703
  • Helpful? 173
    • Society of Robots
Re: HOW-TO Axon with Ubuntu
« Reply #5 on: June 17, 2009, 03:47:45 PM »
Cool! One less reason for me to use Windows. Now if only my CAD software were to work in Linux, I'd probably swap :P

Anyway, I linked this up in step 2 here:
http://www.societyofrobots.com/axon/axon_getting_started_software.shtml

Offline smaniTopic starter

  • Beginner
  • *
  • Posts: 4
  • Helpful? 1
Re: HOW-TO Axon with Ubuntu
« Reply #6 on: June 18, 2009, 02:57:18 PM »
Just wait, the more M$ releases garbage that is only designed to look fancy but is totally useless for anything else than playing, the more CAD manufacturers will realize where to focus development on  ;D And Wine is getting better at an extremely fast rate, just in case  ;)

Offline Trumpkin

  • Supreme Robot
  • *****
  • Posts: 1,176
  • Helpful? 5
Re: HOW-TO Axon with Ubuntu
« Reply #7 on: June 18, 2009, 08:19:09 PM »
Quote
And Wine is getting better at an extremely fast rate, just in case 
Yeah, I'm able to get just about anything working with Wine now.
Robots are awesome!

Offline weijie90

  • Beginner
  • *
  • Posts: 4
  • Helpful? 0
Re: HOW-TO Axon with Ubuntu
« Reply #8 on: December 03, 2009, 01:03:41 AM »
Why is the bootloader so slow? It takes 40 seconds to transfer a 108k .hex file.

Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,703
  • Helpful? 173
    • Society of Robots
Re: HOW-TO Axon with Ubuntu
« Reply #9 on: December 03, 2009, 08:02:16 AM »
Why is the bootloader so slow? It takes 40 seconds to transfer a 108k .hex file.
http://www.societyofrobots.com/axon/axon_FAQ.shtml#boot_slow

Offline weijie90

  • Beginner
  • *
  • Posts: 4
  • Helpful? 0
Re: HOW-TO Axon with Ubuntu
« Reply #10 on: December 03, 2009, 08:04:53 AM »
I'm using Ubuntu.

Offline Jdog

  • Robot Overlord
  • ****
  • Posts: 259
  • Helpful? 3
Re: HOW-TO Axon with Ubuntu
« Reply #11 on: May 09, 2011, 08:27:49 PM »
EDIT* - My bad, it's already been posted http://www.societyofrobots.com/robotforum/index.php?topic=10792.0. Sorry about that.

Hey, I know this hasn't been posted in for a while but I'm running into some problems.  I cant seem to run my makefile properly to build the hex file.

I'm rather new to compiling software from te command line but from what I read, I'm supposed just run make from the directory that my files are in:

Code: [Select]
root@turdferg-desktop:~/Documents/Robotics/my_robots/Axon/Servo# make
 

When I try this i get this error message:
Code: [Select]
.dep/a2d.o.d:1: *** multiple target patterns.  Stop.
I'm really at a loss here, any help would be greatly appreciated  ;)

Should I be using a different makefile for ubuntu than windows maybe?
« Last Edit: May 09, 2011, 08:41:58 PM by Jdog »

Offline joe61

  • Supreme Robot
  • *****
  • Posts: 417
  • Helpful? 16
Re: HOW-TO Axon with Ubuntu
« Reply #12 on: May 10, 2011, 07:12:41 AM »
Can you post the makefile? Also, copy and paste all the error messages when you compile after a make clean.

Joe

Offline TrickyNekro

  • Contest Winner
  • Supreme Robot
  • ****
  • Posts: 1,208
  • Helpful? 15
  • Hardware and Firmware Designer
    • The Hellinic Robots Portal
Re: HOW-TO Axon with Ubuntu
« Reply #13 on: May 10, 2011, 09:04:44 AM »
Just to ask... Why not run a VM??? Most of us guys, in University, simply do this... (VM = Virtual machine)

It's that easy... They won't get 100% processing power, but you don't need them for programming anyways...

It's merely that simple... ;)
For whom the interrupts toll...

Offline adanvasco

  • Full Member
  • ***
  • Posts: 107
  • Helpful? 6
  • Necessity is the mother of invention.
Re: HOW-TO Axon with Ubuntu
« Reply #14 on: May 31, 2011, 08:42:20 AM »
Cool! One less reason for me to use Windows. Now if only my CAD software were to work in Linux, I'd probably swap :P

As someone said already, you can use Wine. I particularly use K3D for all my CAD. Not as intuitive as SketchUp but way more powerful.

If you really want to swap, I bet you'll always find an alternative piece of software or at least a way to run the one you already have. I use Oracle's VirtualBox for example when absolutely necessary. ;)
« Last Edit: June 04, 2011, 08:55:56 PM by adanvasco »
Knowledge does not weigh.