aboutsummaryrefslogtreecommitdiffstats
path: root/LUFA
diff options
context:
space:
mode:
authorDean Camera <dean@fourwalledcubicle.com>2009-02-26 05:48:47 +0000
committerDean Camera <dean@fourwalledcubicle.com>2009-02-26 05:48:47 +0000
commit99145a8d7c88d9af065cfb7f5e8507d5b65ff811 (patch)
tree80b407b9114c1fe6727b40e7b7e0caf6fefc0ea1 /LUFA
parentfa456ce531b75e2dd3c7c0ecb971e3ede36f5d35 (diff)
downloadlufa-99145a8d7c88d9af065cfb7f5e8507d5b65ff811.tar.gz
lufa-99145a8d7c88d9af065cfb7f5e8507d5b65ff811.tar.bz2
lufa-99145a8d7c88d9af065cfb7f5e8507d5b65ff811.zip
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.
Diffstat (limited to 'LUFA')
-rw-r--r--LUFA/ChangeLog.txt2
-rw-r--r--LUFA/Drivers/USB/LowLevel/LowLevel.h9
-rw-r--r--LUFA/GettingStarted.txt16
-rw-r--r--LUFA/MigrationInformation.txt8
4 files changed, 29 insertions, 6 deletions
diff --git a/LUFA/ChangeLog.txt b/LUFA/ChangeLog.txt
index fd21b3f10..af15a964d 100644
--- a/LUFA/ChangeLog.txt
+++ b/LUFA/ChangeLog.txt
@@ -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
*
diff --git a/LUFA/Drivers/USB/LowLevel/LowLevel.h b/LUFA/Drivers/USB/LowLevel/LowLevel.h
index faafbd7bf..9721baca0 100644
--- a/LUFA/Drivers/USB/LowLevel/LowLevel.h
+++ b/LUFA/Drivers/USB/LowLevel/LowLevel.h
@@ -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__))
diff --git a/LUFA/GettingStarted.txt b/LUFA/GettingStarted.txt
index 0fe3f50b9..a88a82533 100644
--- a/LUFA/GettingStarted.txt
+++ b/LUFA/GettingStarted.txt
@@ -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.
diff --git a/LUFA/MigrationInformation.txt b/LUFA/MigrationInformation.txt
index 1cdb55ae7..cd23da332 100644
--- a/LUFA/MigrationInformation.txt
+++ b/LUFA/MigrationInformation.txt
@@ -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
*