Makefiles and library modified to add a new F_CLOCK constant to give the unprescaled master input clock frequency, so that the correct PLL mask can be determined even when the CPU (F_CPU) clock rate is prescaled outside the normal input range of the PLL.

Started to clean up the AVRISP Programmer project code, donated by Opendous Inc.
This commit is contained in:
Dean Camera 2009-02-26 05:48:47 +00:00
parent fa456ce531
commit 99145a8d7c
40 changed files with 632 additions and 250 deletions

View file

@ -21,6 +21,8 @@
* - Fixed KeyboardMouse demo discarding the wIndex value in the REQ_GetReport request
* - USBtoSerial demo now discards all Rx data when not connected to a USB host, rather than buffering characters for transmission
* next time the device is attached to a host.
* - Added new F_CLOCK compile time constant to the library and makefiles, to give the raw input clock (used to feed the PLL before any
* clock prescaling is performed) frequency, so that the PLL prescale mask can be determined
*
* \section Sec_ChangeLog090209 Version 090209
*

View file

@ -66,7 +66,12 @@
#endif
/* Preprocessor Checks and Defines: */
#if (F_CPU == 8000000)
#if !defined(F_CLOCK)
#error F_CLOCK is not defined. You must device F_CLOCK to the frequency of the unprescaled input clock in your project makefile.
#define F_CLOCK 0
#endif
#if (F_CLOCK == 8000000)
#if (defined(__AVR_AT90USB82__) || defined(__AVR_AT90USB162__))
#define USB_PLL_PSC 0
#elif (defined(__AVR_AT90USB646__) || defined(__AVR_AT90USB647__) || \
@ -76,7 +81,7 @@
#elif (defined(__AVR_ATmega16U4__) || defined(__AVR_ATmega32U4__))
#define USB_PLL_PSC 0
#endif
#elif (F_CPU == 16000000)
#elif (F_CLOCK == 16000000)
#if (defined(__AVR_AT90USB646__) || defined(__AVR_AT90USB647__) || defined(__AVR_ATmega32U6__))
#define USB_PLL_PSC ((1 << PLLP2) | (1 << PLLP1))
#elif (defined(__AVR_AT90USB1286__) || defined(__AVR_AT90USB1287__))

View file

@ -57,14 +57,22 @@
* directory into a /Board/ folder inside the application directory, and the stub driver completed with the appropriate code to drive the
* custom board's hardware.
*
* \subsection SSec_F_CPU The F_CPU Parameter
* This parameter indicates the target AVR's master clock frequency, in Hz. Consult your AVR model's datasheet for allowable clock frequencies
* if the USB interface is to be operational.
* \subsection SSec_F_CLOCK The F_CLOCK Parameter
* This parameter indicates the target AVR's input clock frequency, in Hz. This is the actual clock input, before any prescaling is performed. In the
* USB AVR architecture, the input clock before any prescaling is fed directly to the PLL subsystem, and thus the PLL is derived directly from the
* clock input. The PLL then feeds the USB and other sections of the AVR with the correct upscaled frequencies required for those sections to function.
*
* <b>Note that this value does not actually *alter* the AVR's clock frequency</b>, it is just a way to indicate to the library the clock frequency
* <b>Note that this value does not actually *alter* the AVR's input clock frequency</b>, it is just a way to indicate to the library the clock frequency
* of the AVR as set by the AVR's fuses. If this value does not reflect the actual running frequency of the AVR, incorrect operation of one of more
* library components will ocurr.
*
* \subsection SSec_F_CPU The F_CPU Parameter
* This parameter indicates the target AVR's master CPU clock frequency, in Hz.
*
* <b>Note that this value does not actually *alter* the AVR's CPU clock frequency</b>, it is just a way to indicate to the library the clock frequency
* of the AVR core as set by the AVR's fuses. If this value does not reflect the actual running frequency of the AVR, incorrect operation of one of more
* library components will ocurr.
*
* \subsection SSec_CDEFS The CDEFS Parameter
* Most applications will actually have multiple CDEF lines, which are concatenated together with the "+=" operator. This ensures that large
* numbers of configuration options remain readable by splitting up groups of options into seperate lines.

View file

@ -12,6 +12,14 @@
*
* \section Sec_MigrationXXXXXX Migrating from 090209 to XXXXXX
*
* <b>All</b>
* - LUFA projects must now give the raw input clock frequency (before any prescaling) as a compile time constant "F_CLOCK",
* defined in the project makefile and passed to the compiler via the -D switch.
* - The makefile EEPROM programming targets for FLIP and dfu-programmer no longer program in the FLASH data in addition to the
* EEPROM data into the device. If both are to be programmed, both the EEPROM and FLASH programming targets must be called.
*
* <b>Library Demos</b>
* - The USBtoSerial demo now discards all data when not connected to a host, rather than buffering it for later transmission.
*
* \section Sec_Migration090209 Migrating from 081217 to 090209
*