Setting up with Ubuntu 10.10

I’m in a robotics club in my university and have been given a 3pi robot to program.

I am using the USBtinyISP which says that no driver is required since avrdude 5.5 supports it out of the box. (I’m using avrdude 5.10-3.)
I am wanting to install it under Ubuntu 10.10 and am following the instructions given on this page (note: this is not the page for any course I am attending, I found it using a Google search for “3pi Linux”) and your page.
I have installed emacs, cvs, avrdude, gcc-avr, avr-libc, binutils-avr, and avra using Synaptic Package Manager.
Instead of installing the libpololu-avr-081209.zip suggested by the course page, I installed libpololu-avr-100607.zip, the latest release.

When I run

abram@abram-G51J:~/libpololu-avr/examples/atmega168/simple-test$ make program
I receive this output:

avr-gcc -g -Wall -mcall-prologues -mmcu=atmega168 -Os   -c -o test.o test.c
avr-gcc -g -Wall -mcall-prologues -mmcu=atmega168 -Os test.o -Wl,-gc-sections -lpololu_atmega168 -Wl,-relax -o test.obj
avr-objcopy  -R .eeprom -O ihex test.obj test.hex
avrdude -p m168 -c avrisp2 -P /dev/ttyUSB0 -U flash:w:test.hex
avrdude: ser_open(): can't open device "/dev/ttyUSB0": No such file or directory
make: *** [program] Error 1
rm test.obj

I think I’ve covered all the relevant information concerning this. If not, let me know.
This is my first experience programming a robot, so detailed instruction would be appreciated.

Well what it looks like is your port for your programmer is not specified correctly (/dev/ttyUSB0) you could try unplugging it and typing in as root “tail -f /var/log/messages” and then then plug in your programmer and it should show you what device to use.

Hopefully that helps :S Maybe someone with some more experience could give some input if I said anything incorrectly.

Hello,

I do not know much about the USBtinyISP, but I think you need to update the definition of PORT in the Makefile to /dev/ttyACM0. This is what you would need to do to get the Pololu AVR Programmer to work, and I believe it is the same for that device.

-Paul

When I do this it shows up with

Nov 13 21:28:43 abram-G51J kernel: [  380.256700] usb 2-1.2: new low speed USB device using ehci_hcd and address 7

When the 3pi is plugged in.

When I do this, it returns

avrdude -p m168 -c avrisp2 -P /dev/ttyACM0 -U flash:w:test.hex
avrdude: ser_open(): can't open device "/dev/ttyACM0": No such file or directory
make: *** [program] Error 1

Hello,

Sorry, I was wrong about the way the USBtinyISP works. To use it with Ubuntu, you will have to modify the line in your makefile that runs avrdude according to the instructions here. If you still cannot get it to work, you should probably contact someone on the ladyada site about your problem.

-Paul

I’m following these instructions, and when I run

abram@abram-G51J:~/avrg-4.5.1$ ~/Desktop/gcc-4.5.1/configure --target=avr --enable-languages=c --disable-libssp

it runs through some checks and then spits out this error:

configure: error: Building GCC requires GMP 4.2+, MPFR 2.3.1+ and MPC 0.8.0+.
Try the --with-gmp, --with-mpfr and/or --with-mpc options to specify
their locations.  Source code for these libraries can be found at
their respective hosting sites as well as at
ftp://gcc.gnu.org/pub/gcc/infrastructure/.  See also
http://gcc.gnu.org/install/prerequisites.html for additional info.  If
you obtained GMP, MPFR and/or MPC from a vendor distribution package,
make sure that you have installed both the libraries and the header
files.  They may be located in separate packages.

This is getting ridiculous.

Hello,

Why are you trying to build avr-gcc yourself? You already had avr-gcc working fine, since it ran without any errors according to your first post. All you need to do is get back to where you were before and figure out how to execute the correct avrdude command to make your USBtinyISP programmer work. Unfortunately, we cannot give you much help with that here, but I think the link I sent you explains how to run avrdude for that programmer.

-Paul

Okay, I just ran through the instructions on the page you sent me and got this back:

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.01s

avrdude: Device signature = 0x1e950f
avrdude: Expected signature for ATMEGA8 is 1E 93 07
         Double check chip, or use -F to override this check.

avrdude done.  Thank you.

and the robot beeped.

Still, when I input

abram@abram-G51J:~/libpololu-avr/examples/atmega168/simple-test$ make program

it gives me

avrdude -p m168 -c avrisp2 -P /dev/ttyUSB0 -U flash:w:test.hex
avrdude: ser_open(): can't open device "/dev/ttyUSB0": No such file or directory
make: *** [program] Error 1

Hello,

It looks like the page I sent you had a working avrdude command. But running that command is not going to fix the makefile! You sitll need to change the line of the makefile that runs avrdude to run it with the parameters that worked for you. I think this is the last line of the makefile - it starts with $(AVRDUDE). The dollar-sign expressions are variables that you should leave in the appropriate places, but I think $(PORT) will no longer be required.

-Paul

Hello.

You will also need to remember to change the device from ATmega8 to ATmega328p.

- Ben

Hello,

Or atmega168, if you have an atmega168 3pi. (I noticed you were running the previous attempt from the atmega168 directory - is that why?)

-Paul

I don’t even know what you’re talking about or what to do now. :frowning:

Hello,

Can you ask a more specific question about what I said you should do?

-Paul

I keep getting the same error over again. I don’t know what lines of the Makefile to change, and what to change them to.

DEVICE = atmega328p
MCU = atmega328p
AVRDUDE_DEVICE = m328p
DEVICE ?= atmega168
MCU ?= atmega168
AVRDUDE_DEVICE ?= m168

CFLAGS=-g -Wall -mcall-prologues -mmcu=$(MCU) $(DEVICE_SPECIFIC_CFLAGS) -Os
CC=avr-gcc
OBJ2HEX=avr-objcopy 
LDFLAGS=-Wl,-gc-sections -lpololu_$(DEVICE) -Wl,-relax

PORT ?= /dev/ttyACM0
AVRDUDE=avrdude

TARGET=test
OBJECT_FILES=test.o

all: $(TARGET).hex

clean:
	rm -f *.o *.hex *.obj *.hex

%.hex: %.obj
	$(OBJ2HEX) -R .eeprom -O ihex $< $@

test.o: test.c

%.obj: $(OBJECT_FILES)
	$(CC) $(CFLAGS) $(OBJECT_FILES) $(LDFLAGS) -o $@

program: $(TARGET).hex
	$(AVRDUDE) -p $(AVRDUDE_DEVICE) -c avrisp2 -P $(PORT) -U flash:w:$(TARGET).hex

There was a command that worked for you. You need to modify the last line of the makefile to run that command. If you are still confused, can you post the command that worked? Then I can tell you how to format it on the last line of the makefile.

-Paul