Newbie help with RS232 Tutorial

Hi I’m up to this part of the tutorial:

http://www.sparkfun.com/commerce/tutori … als_id=105

I’ve set the fuse bits for a 16Mhz crystal on my ATMega168. I’m still not sure what SUT_CKSEL to pick, so I picked the very last one on the list. I got the RS232 shifter board and it seems to be working fine, when I tie RX and TX the keyboard echoes correctly to TeraTerm. But the program in the tutorial doesn’t work, when I run it, all it does is print boxes, which I’m guessing means an unknown character or it didn’t receive it correctly. Does anyone know how to make it print correctly, or what I might be doing wrong? Here is the code of the tutorial.

http://www.sparkfun.com/tutorial/Beginn … ega168.zip

Thanks!

I am interested in learning about this as well. I am having a similar problem. Everything work with regards to the loop backs etc… but when I try and run the program all I get is “…”. I think it may have something to do with the baud rate not being correct, but I am not sure.

Wow I just fixed it now. I’m using AVR Studio. First I picked the last SUT_CKSEL on the list “Ext Crystal Osc 8.0-”. Then this is what fixed it: make sure to uncheck CKDIV8. That tutorial needs to be updated and more specific. The final fuse values should be EXTENDED=0xF9, HIGH=0xDF, LOW=0xBF. I can finally get on to other stuff! :slight_smile:

As you may have guessed, the CKDIV8 flag divides the clock by 8, so the frequency at which the proc is running is no more the crystal one, but 1 MHz if your crystal is a 8MHz one. The baud rates generation is thus no more correct (at least if you have not configured them for a 1 MHz clock).

Personally, if I’m doing anything time critical, I will set the clock prescaler in software right after I set up the stack. The fuse bits on all of the atmel parts I’ve used just set the initial prescaler value. Software can then successfully set the prescaler to known value and you don’t have to worry about whether or not the fuse bits are programmed right.