Qball's Weblog

Atmel Coding, unexpected errors

Tags atmel  General 

An atmel uses one clock, in my case I use an external crystal (if you run a clock on it, you don’t want an RC oscilator). Something you should keep in mind is, that (unless specified otherwise) the atmel uses this clock for everything. You timers, interfaces, etc.

This can lead to some unexpected problems, for example the uart. The uart (serial port) needs to transmit/recieve the data at a certain speed, for example 57k6 bit/sec. The whole crux is that it has to generate this from the main  clock, and this isn’t always a nice match.

So if you f.e. run your atmel with a 8mhz crystal the atmel produces an error of -3.5%, and for 115k2 even worse: 8.5%. This can lead to a problem with certain serial ports. So when it works fine on your desktop pc, it can fail on your laptop, or when using a serial->usb dongle (this happened to me, on more then one occasion)
Because this are those little bugs that can be hard to figure out, so I thought lets blog about it.

More atmel related blogs to come, I don’t know at what level you people will still read it. Should I go into much details?