OSC20M Stored Frequency Error Compensation

This oscillator can operate at multiple frequencies, selected by the value of the Frequency Select bits (FREQSEL) in the Oscillator Configuration fuse (FUSE.OSCCFG) at Reset. As previously mentioned appropriate calibration values are loaded to adjust to center frequency (OSC20M), and temperature drift compensation (TEMPCAL20M), meeting the specifications defined in the Internal Oscillator Characteristics. For applications requiring wider operating range, the relative factory stored frequency error after calibrations can be used. The 4 errors are measured at different setting and are available in Signature Row as signed byte values.

The Error is stored as a compressed Q1.10 fixed point 8 bit value, in order not to lose resolution, where the MSB is the sign bit and the 7 LSBs the lower bits of the Q.10.

BAUDactual=(BAUDideal+BAUDideal*‚ÄČSigRowError1024)

The example below, demonstrates how to use this factory stored error value for more accurate USART baud rates:

  
  /* Baud rate compensated with factory stored frequency error */
  /* Synchronous communication without Auto-baud (Sync Field)  */
  /* 16MHz Clock, 3V and 600 BAUD register value               */

  int8_t  sigrow_val    = SIGROW.OSC16ERR3V;   // read signed error
  int32_t baud_reg_val  = 600;                 // ideal baud rate
    
  baud_reg_val *= (1024 + sigrow_value);       // sum resolution + error
  baud_reg_val /=  1024;                       // divide by resolution
  USART0.BAUD = (int16_t) baud_reg_val;        // set adjusted baud rate