Help with programming 3pi

Help with programming the Pololu 3pi please.

I’m new to the 3pi and wish to load the MazeSolving Code into it.
What is the ‘quick & dirty’ method of uploading code to the 3pi?
I don’t want to learn another IDE just to upload someone elses code.
I’m running a Laptop with 32bit Win7, which loads the USB Drivers OK.
I’ve installed both the WinAVR & AVR Studio4, but cannot work out a quick way of uploading the Demo MazeSolver Code to the 3pi. I don’t want to start learning to program the 3pi, as I’m struggling with Arduino C already, and I am only treating the 3pi as a toy.

Can someone point a 52yo brain in the right direction on this please.

.

Hello,

AVR Studio is pretty easy to use, but you can also do everything from the command line, if that is what you want. Did you install the Pololu AVR Library and try opening the ready-made example programs?

Assuming you have the Pololu USB AVR Programmer, some short instructions for using AVRDUDE to program your 3pi from the command line are in the Programmer User’s Guide.

The quick-and-dirty way to compile from the command line is to type “make” in the folder for the project. Each of our example programs comes with a Makefile to support this method.

-Paul

Thanks Paul,
Will your Command Line instructions also work with this programmer?
pololu.com/catalog/product/740

When I load the MazeSolver Code into AVR Studio, I get this Message . . .
Loaded plugin STK500
Loaded plugin AVR GCC
Loaded partfile: C:\Program Files\Atmel\AVR Tools\PartDescriptionFiles
Error Code: -2147467259:

Um, Help ???

About 2 Hours later . . .

OK, I tried this;

C:\Users\Murray\Downloads\Pololu 3 Pi\libpololu-avr\examples\atmega328p\3pi-mazesolver\default>
avrdude -p m328p -P COM4 -c avrispv2 -e -U flash:w:test.hex

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.05s

avrdude: Device signature = 0x1e9406
avrdude: Expected signature for ATMEGA328P is 1E 95 0F
Double check chip, or use -F to override this check.

avrdude done. Thank you.

Went to the Pololu Website & found that my 3pi is an older one with the Atmega168 Chip, so tried this;

C:\Users\Murray\Downloads\Pololu 3 Pi\libpololu-avr\examples\atmega328p\3pi-mazesolver\default>
avrdude -p m168 -P COM4 -c avrispv2 -e -U flash:w:test.hex

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.06s

avrdude: Device signature = 0x1e9406
avrdude: erasing chip
avrdude: reading input file "test.hex"
avrdude: input file test.hex auto detected as Intel Hex
avrdude: writing flash (10396 bytes):

Writing | ################################################## | 100% 5.16s

avrdude: 10396 bytes of flash written
avrdude: verifying flash memory against test.hex:
avrdude: load data flash data from input file test.hex:
avrdude: input file test.hex auto detected as Intel Hex
avrdude: input file test.hex contains 10396 bytes
avrdude: reading on-chip flash data:

Reading | ################################################## | 100% 4.31s

avrdude: verifying …
avrdude: 10396 bytes of flash verified

avrdude -p m168 -P COM4 -c avrispv2 -e -U flash:w:test.hex

avrdude: safemode: Fuses OK

avrdude done. Thank you.

Code appeared to load - 3pi has now got the top 8 blocks of LCD Black & no response.
Realized that this is not the program I want, I tried this to no avail.

C:\Users\Murray\Downloads\Pololu 3 Pi\libpololu-avr\examples\atmega168\3pi-mazesolver>
avrdude -p m168 -P COM4 -c avrispv2 -e -U flash:w:3pi-mazesolver

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.06s

avrdude: Device signature = 0x1e9406
avrdude: erasing chip
avrdude: reading input file "3pi-mazesolver"
avrdude: error opening 3pi-mazesolver: No such file or directory
avrdude: input file 3pi-mazesolver auto detected as invalid format
avrdude: can’t open input file 3pi-mazesolver: No such file or directory
avrdude: write to file ‘3pi-mazesolver’ failed

avrdude: safemode: Fuses OK

avrdude done. Thank you.

C:\Users\Murray\Downloads\Pololu 3 Pi\libpololu-avr\examples\atmega168\3pi-mazesolver>
appears to have no .hex file in it ?? :imp: :imp:

The command will (and did) work fine with the other programmer. The other programmer has its own User’s Guide.

Did you see how on your final try, AVRDUDE said

error opening 3pi-mazesolver: No such file or directory

?

You probably just need to type “3pi-mazesolver.hex” instead.

-Paul

Yes, I saw that Paul, but there is no .hex file within the 186 Folder ???

Hello.

Precompiled hex files for all of the example programs (including 3pi-mazesolver.hex) can be found in the directory:

For older 3pis with an ATmega168: libpololu-avr/examples/atmega168/hex_files
For new 3pis with an ATmega328: libpololu-avr/examples/atmega328p/hex_files

- Ben

And…if you want to make the hex file from the project folder, you should be able to just type “make”. It also looks like you were trying to use AVR Studio after all, and you managed to compile something within that IDE - is that correct? You can do it the same way for each of the examples.

-Paul

Ben & Paul,
Thank you both for your help.

C:\Users\Murray\Downloads\Pololu 3 Pi\libpololu-avr\examples\atmega168\hex_files>
avrdude -p m168 -P COM4 -c avrispv2 -e -U flash:w:3pi-mazesolver.hex

Worked perfectly, now I need to construct the Maze.

.

How many intersections can a 3pi with an AtMega168 handle in a Maze?
Does the Algorithm work by calculating intersections on-the-fly, or by a final calculation at the end of the Maze?

It calculates intersections on the fly and can store up to 100 at a time - you can read about it here.

-Paul