Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow loading an OSCCAL value from EEPROM #183

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Commits on Sep 14, 2016

  1. Allow loading an OSCCAL value from EEPROM

    When an EEPROM address is given through OSCCAL_EEPROM_ADDR at
    compiletime, a byte is read from that address on startup and written to
    OSCCAL (unless it is 0xff, which should never be a meaningful
    calibration value). This allows improving the accuracy of the UART
    baudrate when running off the internal oscillator.
    
    Enabling this option adds 30 bytes on the atmega328p build. This can
    probably be reduced by inlining eeprom_read_byte.
    matthijskooijman committed Sep 14, 2016
    Configuration menu
    Copy the full SHA
    9f7159e View commit details
    Browse the repository at this point in the history
  2. Allow loading an OSCCAL value from PROGMEM

    When the OSCCAL_PROGMEM variable is given at compiletime, a byte is
    allocated in PROGMEM (flash) at a fixed location at the top of the flash
    space (just below the version bytes, so the third byte from the top).
    
    If this byte is overwritten with a calibration value (e.g. when
    programming the bootloader), it will be automatically loaded on startup.
    This allows improving the accuracy of the UART baudrate when running off
    the internal oscillator, and prevents the actual program from having to
    worry about calibration.
    
    The default value of this byte is 0xff, which causes it to be ignored.
    
    To fix the address of this variable, a dedicated .osccal section is used
    for it, and the linker is passed some options to put it in the right
    place (identical to what happens for the version variable).
    
    Enabling this option adds 15 bytes on the atmega328p build.
    matthijskooijman committed Sep 14, 2016
    Configuration menu
    Copy the full SHA
    8d68385 View commit details
    Browse the repository at this point in the history