Switching from external to internal oscillator on ATmega328PB – impact on UART, I2C, and SPI?

I am currently using an ATmega328P with an 8MHz external oscillator. I plan to switch to the ATmega328PB and configure it to use the internal oscillator, completely removing the external crystal.

However, I am using the following communication interfaces:

  • UART (Serial) → for debug prints and flashing firmware
  • I2C
  • SPI

My Questions:

  1. Can I completely remove the external oscillator when switching the ATmega328PB to the internal oscillator?
  2. Does the internal oscillator’s lower precision (~1% deviation) impact I2C or SPI communication?

Hint:
Diff of Crystal between P and PB derivates:


AT15007: Differences between ATmega328/P and ATmega328PB

I2C and SPI have clock lines, and the bits are clocked in and out based on transitions on the clock line. So I don't think lack of precision in the internal oscillator would make any difference.

However, UART could present a problem if the oscillator is far enough off. I think that's unlikely, but you might want to look in the datasheet for the OSCCAL register, which allows you to tweak the frequency of the oscillator and effectively calibrate it pretty accurately. If you have multiple devices, you could save the calibrated OSCCAL value for each device in EEPROM, and then just read that on each bootup.

If you don't have a way to measure frequency to do the calibration, you could find a clock sketch, and compare the time it keeps with your watch or phone after a few hours.

You also want to be sure that you flash the appropriate bootloader for using the 8MHz internal oscillator, as I assume you did with the 328P.

Why would you think that it would?

I've used 328P with internal uncalibrated 8Mhz and did have problems at certain UART bit rates.

Thanks for the hint.