Newbie help with RS232 Tutorial

Your source for all things Atmel.

Moderator: phalanx

Post Reply
tonys
Posts: 10
Joined: Tue Sep 23, 2008 5:25 pm

Newbie help with RS232 Tutorial

Post by tonys » Sat Sep 27, 2008 7:17 pm

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!

tlynch99
Posts: 8
Joined: Mon Jul 30, 2007 12:20 pm

Post by tlynch99 » Sun Sep 28, 2008 5:49 pm

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.

tonys
Posts: 10
Joined: Tue Sep 23, 2008 5:25 pm

Post by tonys » Sun Sep 28, 2008 6:31 pm

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! :)

EricAtPobot
Posts: 4
Joined: Fri Nov 07, 2008 4:57 am

Post by EricAtPobot » Sun Nov 16, 2008 9:49 am

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).

signal7
Posts: 177
Joined: Fri Nov 07, 2008 7:52 am

Post by signal7 » Thu Nov 20, 2008 9:42 am

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.

Post Reply