0

I have read that serial (UART) communications are unreliable or will not work when using the 8MHz internal oscillator as the clock source.

For example here are two results from a quick google.

http://forum.arduino.cc/index.php?topic=116404.0 "Since the internal RC oscillator is not as well regulated as one using an external resonator or crystal you may have to use a slower baud rate to make sure the bit times fall within spec. Maybe re-compile your bootloader for 9600 baud."

http://www.technoblogy.com/show?1YO1 "unless you need accurate timing, or are going to use the serial interface (which requires accurate timing), you don't need an external crystal and capacitors, because the ATmega328 has a built-in internal clock"

However, opinion seems to be split as to whether its acceptable/a good idea to use serial on an ATMega328 using the internal resonator. I do not currently have an Arduino board with me for the time being so i cannot test this out in person.

This brings me to my question. Despite the opinions that serial is unreliable, it seems no one has problems uploading code to an ATMega328 via FTDI when using no crystal (at least it hasnt come up in my searches). FTDI uses serial to upload so surely if serial is unreliable with a standalone chip, uploading via FTDI would not be possible?

I'm sure i am missing something but I was hoping that someone could explain this to me.

  • I think you'd have to compare the performance specs of the FT232 ftdichip.com/Support/Documents/DataSheets/ICs/DS_FT232R.pdf against a 328P, which can have its RC oscillator calibrated better match serial speeds for less errors. I can't open the FT232 datasheet from here; does it have an internal crystal to support high speed comm's with a PC? – CrossRoads Apr 11 at 12:13
  • From the datasheet "The Clock Multiplier / Divider takes the 12MHz input from the Internal Oscillator function and generates the 48MHz, 24MHz, 12MHz and 6MHz reference clock signals. The 48Mz clock reference is used by the USB DPLL and the Baud Rate Generator blocks." And it mentions having an internal oscillator but does not specify the type. In terms of the high speed comms the speeds stated are 300baud to 3Mbaud. Im aware that the internal oscillator for the 328 can be calibrated but not many tutorials online actually go through that process, yet they still upload through FTDI? – C.W.G Apr 11 at 12:48
  • See 13.12.1 in the Atme328P datasheet. "The CAL7 bit determines the range of operation for the oscillator. Setting this bit to 0 gives the lowest frequency range, setting this bit to 1 gives the highest frequency range. The two frequency ranges are overlapping, in other words, a setting of OSCCAL=0x7F gives a higher frequency than OSCCAL=0x80. The CAL[6:0] bits are used to tune the frequency within the selected range. A setting of 0x00 gives the lowest frequency in that range and a setting of 0x7F gives the highest frequency in the range." A range of 7.3 to 8.1MHz should achievable. – CrossRoads Apr 11 at 13:08
  • "The oscillator calibration register is used to trim the calibrated internal RC oscillator to remove process variations away from the oscillator frequency. A preprogrammed calibration value is automatically written to this register during chip reset, ... The application software can write this register to change the oscillator frequency. The oscillator can be calibrated to frequencies as specified in the Clock Characteristics section of chapter Electrical Characteristics. Calibration outside that range is not recommended." So your sketch can write to the OSCCAL register to change it. – CrossRoads Apr 11 at 13:11
  • Thank you for your help on the calibration front! Im sure I will get round to doing that at some point. My question was why, if in theory a serial baudrate mismatch can be caused by the internal resonator, and therefore people advise against using the serial, there doesn't seem to be a record of people struggling to upload code through FTDI which uses serial, because of a mismatch,. I'm aware you can calibrate the oscillator to remove the chance of a mismatch but i don't see people doing this. – C.W.G Apr 11 at 13:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.