Programming with a bad program

I’m quite new to the 3pi and I ruined one 3pi this friday because of programming it while it hade bad battery voltage, so i’m quite cautious what i’m doing with the 3pi at the moment.

Anyway i got one more 3pi and wonder what is the worst case scenario in programming with a program which is a succeeded build in avr studio but maybe incorrect header files, forever loops, too big program and so on
Of course will I have batteries which is well charged :smiley:

I’m just worried to ruin one more robot.

I Appreciate an answer a lot!

Sorry for bad english!


What programmer are you using to program your 3pi? The Orangutan USB Programmer, or the AVR USB Programmer?

I haven’t heard of anyone breaking their 3pi with a bad program, but it might be possible to break the LCD control pins by driving them. It would be pretty hard to do this by mistake, especially if you stick to using the Pololu AVR library functions to control your 3pi. Whenever AVR studio compiles your program, you will see how much program memory the program is taking up in the debug output panel. You can use this to avoid programming a program that is too big. Another thing you definitely want to avoid is changing the fuses on the 3pi’s MCU.

To avoid programming your 3pi with the batteries low, you should make all of your programs display the battery voltage on the LCD when they start.

- Ryan

My program shows battery voltage so I hope i won´t kill the robot again :smiley:

I’m using the orangutang programmer.

The “problem” at the moment is that I have a several programs that runs on the robot but now I have put this programs in to one project with about 10 headerfiles.

I’m only using the pololu libraries in my program and there is no “special tweaks”

Just afraid that I have done anything crazy when I was putting all code in to one piece.

The fuses and everything like that i dont even look at :smiley:

I get this output from the building/compiling:
If its any help to figure out if the program/project is safe to program into 3pi

Build started 13.10.2009 at 18:42:46
avr-gcc -mmcu=atmega328p -Wall -gdwarf-2 -Os -std=gnu99 -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -MD -MP -MT solution.o -MF dep/solution.o.d -c …/solution.c
avr-gcc -mmcu=atmega328p -Wl, solution.o bargraph.o follow-segment.o maze-solve.o sensor.o turn.o eight.o distanceMeasure.o initialize.o menu-select.o splashscreen.o maze.o -lpololu_atmega328p -o solution.elf
avr-objcopy -O ihex -R .eeprom -R .fuse -R .lock -R .signature solution.elf solution.hex
avr-objcopy -j .eeprom --set-section-flags=.eeprom=“alloc,load” --change-section-lma .eeprom=0 --no-change-warnings -O ihex solution.elf solution.eep || exit 0
avr-objdump -h -S solution.elf > solution.lss

AVR Memory Usage

Device: atmega328p

Program: 16100 bytes (49.1% Full)
(.text + .data + .bootloader)

Data: 527 bytes (25.7% Full)
(.data + .bss + .noinit)

That all sounds good; have fun with your 3pi! If you have any other questions, feel free to post them.

- Ryan