I'm trying to get my senior design project working. I'm using an ARM to control a quadrotor. The arm doesn't want to talk i2c for some reason, so I'm trying to use a atmega328 I have around as an interperter to serial. Another team member wrote working code to talk to the IMU sensor using the wire library on his arduino uno. I go to drop the same code (with a very slight modification in some serial writes) and nothing. I have the chip set up to run of the internal oscillator. I use a USB Tiny to flash, and have an Omliex dev board. I changed the F_CPU setting to 8000000L in the board.txt file. I'm not using a bootloader. I have no idea why I get no serial out. I even wrote a small test program that all it should do is echo any serial it gets back.
Serial.write may result in unprintable data being sent out. From the Reference page for Serial:
write()
Description
Writes binary data to the serial port. This data is sent as a byte or series of bytes; to send the characters representing the digits of a number use the print() function instead.
print()
Description
Prints data to the serial port as human-readable ASCII text. This command can take many forms. Numbers are printed using an ASCII character for each digit. Floats are similarly printed as ASCII digits, defaulting to two decimal places. Bytes are sent as a single character. Characters and strings are sent as is.
Thanks for the reply. I don't think that's the issue, though. I don't even get that Ready printed in the terminal when I fire up the avr. Like I said, that's just a test program and I was only sending ascii values to it. I also set my terminal (using GTKTerm) to print hex values so I could check the data rather than printable characters. I'm just not getting data period.
I'm sure ground is good. I can jump the pins on the socket for the AVR with a wire and see an echo, so that's good. I just borrowed a friend's arduino and tested the code on it. Code works fine, so this is definitely something to do with me trying to load it to a non-arduinoified (is that how to say it?) AVR. I would think it should just work.
Did you program the fuses on your standalone device? Need an AVR programmer connected to the SPI pins & Reset, +5, Gnd to do that.
The default fuse settings may be messing you up - resulting in a 1 MHz clock speed.
Programing the fuses to remove the prescaler was the first thing I did. I will double check later that they are correct. Its starting to look like I may have a bad sensor, so I may not need this anyway, but I would like to figure out why its not playing nice regardless.