diff --git a/LUFA/Drivers/USB/LowLevel/Endpoint.h b/LUFA/Drivers/USB/LowLevel/Endpoint.h
index 8ff930611d89dc5f1a7299ce41731048609813d5..ef23253a5d4925965bf8ceadfb9cdc9895ee7560 100644
--- a/LUFA/Drivers/USB/LowLevel/Endpoint.h
+++ b/LUFA/Drivers/USB/LowLevel/Endpoint.h
@@ -338,7 +338,7 @@
 				 */
 				static inline void Endpoint_SetEndpointDirection(uint8_t DirectionMask);
 			#else
-				#if defined(USB_SERIES_6_AVR) || defined(USB_SERIES_7_AVR) || defined(__DOXYGEN__)
+				#if defined(USB_SERIES_6_AVR) || defined(USB_SERIES_7_AVR)
 					#define Endpoint_BytesInEndpoint()        UEBCX
 				#elif defined(USB_SERIES_4_AVR)
 					#define Endpoint_BytesInEndpoint()        (((uint16_t)UEBCHX << 8) | UEBCLX)				
diff --git a/LUFA/ManPages/ChangeLog.txt b/LUFA/ManPages/ChangeLog.txt
index f7af9a1e9f4f5c57f3be9c413db32097ce60221e..143b5a146ca785053aaf61c6b6da12a9e09e934d 100644
--- a/LUFA/ManPages/ChangeLog.txt
+++ b/LUFA/ManPages/ChangeLog.txt
@@ -56,6 +56,7 @@
   *  - Fixed TeensyHID bootloader not properly shutting down the USB interface to trigger a disconnection on the host before resetting
   *  - Fixed MassStorageHost Class driver demo not having USB_STREAM_TIMEOUT_MS compile time option set properly to prevent slow 
   *    devices from timing out the data pipes
+  *  - Fixed the definition of the Endpoint_BytesInEndpoint() macro for the U4 parts
   *
   *  \section Sec_ChangeLog091122 Version 091122
   *
diff --git a/Projects/AVRISP/Lib/PDIProtocol.c b/Projects/AVRISP/Lib/PDIProtocol.c
index d98c51c435774c7947cd6fc4fb06b81d073ad24b..864d4e9c345800ea357aa4c7ac7f3fe395579e6d 100644
--- a/Projects/AVRISP/Lib/PDIProtocol.c
+++ b/Projects/AVRISP/Lib/PDIProtocol.c
@@ -110,9 +110,7 @@ static void PDIProtocol_EnterXPROGMode(void)
 	/* Must hold DATA line high for at least 90nS to enable PDI interface */
 	PDIDATA_LINE_PORT |= PDIDATA_LINE_MASK;
 	asm volatile ("NOP"::);
-	#if (F_CPU > 8000000)
 	asm volatile ("NOP"::);
-	#endif
 	
 	/* Toggle CLOCK line 16 times within 100uS of the original 90nS timeout to keep PDI interface enabled */
 	for (uint8_t i = 0; i < 16; i++)
@@ -120,7 +118,7 @@ static void PDIProtocol_EnterXPROGMode(void)
 	
 	/* Enable access to the XPROG NVM bus by sending the documented NVM access key to the device */
 	PDITarget_SendByte(PDI_CMD_KEY);	
-	for (uint8_t i = 0; i < 8; i++)
+	for (uint8_t i = 0; i < sizeof(PDI_NVMENABLE_KEY); i++)
 	  PDITarget_SendByte(PDI_NVMENABLE_KEY[i]);
 
 	/* Read out the STATUS register to check that NVM access was successfully enabled */
diff --git a/Projects/AVRISP/Lib/PDITarget.c b/Projects/AVRISP/Lib/PDITarget.c
index 98d4bded48aa39ce6e9deaf10e537b88969946cb..03dd77998931b1ccfd4dc61ed841836ed9625e1a 100644
--- a/Projects/AVRISP/Lib/PDITarget.c
+++ b/Projects/AVRISP/Lib/PDITarget.c
@@ -52,9 +52,9 @@ void PDITarget_SendByte(uint8_t Byte)
 	for (uint8_t i = 0; i < 8; i++)
 	{
 		if (Byte & 0x01)
-		  PDIDATA_LINE_PORT |= PDIDATA_LINE_MASK;
-		else
 		  PDIDATA_LINE_PORT &= ~PDIDATA_LINE_MASK;
+		else
+		  PDIDATA_LINE_PORT |=  PDIDATA_LINE_MASK;
 		  
 		Byte >>= 1;
 
diff --git a/Projects/AVRISP/Lib/PDITarget.h b/Projects/AVRISP/Lib/PDITarget.h
index 294d1a98b839a6115f8020163b6e0a7a2c1d2186..00ce68bb3016697f107138806b1eb7270dc87b24 100644
--- a/Projects/AVRISP/Lib/PDITarget.h
+++ b/Projects/AVRISP/Lib/PDITarget.h
@@ -65,7 +65,7 @@
 			#define PDIDATA_LINE_PORT     PORTB
 			#define PDIDATA_LINE_DDR      DDRB
 			#define PDIDATA_LINE_PIN      PINB
-			#define PDIDATA_LINE_MASK     (1 << 2)
+			#define PDIDATA_LINE_MASK     (1 << 3)
 			
 			#define PDICLOCK_LINE_PORT    RESET_LINE_PORT
 			#define PDICLOCK_LINE_DDR     RESET_LINE_DDR
@@ -91,7 +91,9 @@
 		#define PDI_NVMENABLE_KEY     (uint8_t[]){0x12, 0x89, 0xAB, 0x45, 0xCD, 0xD8, 0x88, 0xFF}
 
 		#define TOGGLE_PDI_CLOCK      MACROS{ PDICLOCK_LINE_PORT ^= PDICLOCK_LINE_MASK; \
-		                                      PDICLOCK_LINE_PORT ^= PDICLOCK_LINE_MASK; }MACROE
+		                                      asm volatile ("NOP" ::);                  \
+		                                      PDICLOCK_LINE_PORT ^= PDICLOCK_LINE_MASK; \
+		                                      asm volatile ("NOP" ::);                  }MACROE
 		
 	/* Function Prototypes: */
 		void    PDITarget_SendByte(uint8_t Byte);
diff --git a/Projects/AVRISP/makefile b/Projects/AVRISP/makefile
index 6eebb2b3384ddc7ac01c9b10bc7db992a90ccdf7..b215a22a2439de71cf1cc004e29ad4ab50c63b14 100644
--- a/Projects/AVRISP/makefile
+++ b/Projects/AVRISP/makefile
@@ -60,7 +60,7 @@
 
 
 # MCU name
-MCU = at90usb1287
+MCU = at90usb162
 
 
 # Target board (see library "Board Types" documentation, USER or blank for projects not requiring