From 99c447c754e0b238aca99ac772b5dabb78fc8b48 Mon Sep 17 00:00:00 2001 From: Dean Camera Date: Wed, 5 Aug 2009 13:16:36 +0000 Subject: Fixed issue in USBtoSerial demos where the USART Rx line was not having its pullup enabled at startup, leading to noise being received from the Rx pin when left floating. Removed unused relative Common.h header include from the DriverStubs board stub drivers. Fixed Benito programmer, use the correct LED functions where needed to ensure correct status display at all times. --- Bootloaders/CDC/BootloaderCDC.c | 18 +++++++++--------- Demos/Device/ClassDriver/USBtoSerial/USBtoSerial.c | 2 +- Demos/Device/ClassDriver/USBtoSerial/USBtoSerial.h | 1 - Demos/Device/LowLevel/USBtoSerial/USBtoSerial.c | 4 ++-- LUFA.pnproj | 2 +- LUFA/DriverStubs/Buttons.h | 2 -- LUFA/DriverStubs/Joystick.h | 2 -- LUFA/DriverStubs/LEDs.h | 2 -- LUFA/ManPages/ChangeLog.txt | 1 + Projects/Benito/Benito.c | 13 +++++++------ Projects/Benito/Benito.h | 2 ++ Projects/Benito/makefile | 2 +- 12 files changed, 24 insertions(+), 27 deletions(-) diff --git a/Bootloaders/CDC/BootloaderCDC.c b/Bootloaders/CDC/BootloaderCDC.c index 6769a0c2d..f92595615 100644 --- a/Bootloaders/CDC/BootloaderCDC.c +++ b/Bootloaders/CDC/BootloaderCDC.c @@ -235,15 +235,7 @@ static void ReadWriteMemoryBlock(const uint8_t Command) while (BlockSize--) { - if (MemoryType == 'E') - { - /* Read the next EEPROM byte into the endpoint */ - WriteNextResponseByte(eeprom_read_byte((uint8_t*)(uint16_t)(CurrAddress >> 1))); - - /* Increment the address counter after use */ - CurrAddress += 2; - } - else + if (MemoryType == 'F') { /* Read the next FLASH byte from the current FLASH page */ #if (FLASHEND > 0xFFFF) @@ -258,6 +250,14 @@ static void ReadWriteMemoryBlock(const uint8_t Command) HighByte = !HighByte; } + else + { + /* Read the next EEPROM byte into the endpoint */ + WriteNextResponseByte(eeprom_read_byte((uint8_t*)(uint16_t)(CurrAddress >> 1))); + + /* Increment the address counter after use */ + CurrAddress += 2; + } } } else diff --git a/Demos/Device/ClassDriver/USBtoSerial/USBtoSerial.c b/Demos/Device/ClassDriver/USBtoSerial/USBtoSerial.c index b78a6d331..0c83cd8dd 100644 --- a/Demos/Device/ClassDriver/USBtoSerial/USBtoSerial.c +++ b/Demos/Device/ClassDriver/USBtoSerial/USBtoSerial.c @@ -110,7 +110,7 @@ void SetupHardware(void) clock_prescale_set(clock_div_1); /* Hardware Initialization */ - Joystick_Init(); + Serial_Init(9600, false); LEDs_Init(); USB_Init(); } diff --git a/Demos/Device/ClassDriver/USBtoSerial/USBtoSerial.h b/Demos/Device/ClassDriver/USBtoSerial/USBtoSerial.h index 4ceb931a3..c982ad1a6 100644 --- a/Demos/Device/ClassDriver/USBtoSerial/USBtoSerial.h +++ b/Demos/Device/ClassDriver/USBtoSerial/USBtoSerial.h @@ -48,7 +48,6 @@ #include #include - #include #include #include #include diff --git a/Demos/Device/LowLevel/USBtoSerial/USBtoSerial.c b/Demos/Device/LowLevel/USBtoSerial/USBtoSerial.c index 736c0af10..141a45276 100644 --- a/Demos/Device/LowLevel/USBtoSerial/USBtoSerial.c +++ b/Demos/Device/LowLevel/USBtoSerial/USBtoSerial.c @@ -81,9 +81,9 @@ void SetupHardware(void) clock_prescale_set(clock_div_1); /* Hardware Initialization */ + Serial_Init(9600, false); LEDs_Init(); - ReconfigureUSART(); - USB_Init(); + USB_Init(); } /** Event handler for the USB_Connect event. This indicates that the device is enumerating via the status LEDs and diff --git a/LUFA.pnproj b/LUFA.pnproj index dd3739e94..d73823e0a 100644 --- a/LUFA.pnproj +++ b/LUFA.pnproj @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/LUFA/DriverStubs/Buttons.h b/LUFA/DriverStubs/Buttons.h index 0d02e5c71..9449bcbfd 100644 --- a/LUFA/DriverStubs/Buttons.h +++ b/LUFA/DriverStubs/Buttons.h @@ -46,8 +46,6 @@ #include #include - #include "../../../Common/Common.h" - // TODO: Add any required includes here /* Enable C linkage for C++ Compilers: */ diff --git a/LUFA/DriverStubs/Joystick.h b/LUFA/DriverStubs/Joystick.h index ca80672b3..a09f8db9b 100644 --- a/LUFA/DriverStubs/Joystick.h +++ b/LUFA/DriverStubs/Joystick.h @@ -46,8 +46,6 @@ /* Includes: */ #include - #include "../../../Common/Common.h" - // TODO: Add any required includes here /* Enable C linkage for C++ Compilers: */ diff --git a/LUFA/DriverStubs/LEDs.h b/LUFA/DriverStubs/LEDs.h index 3f4cca006..0421f14d3 100644 --- a/LUFA/DriverStubs/LEDs.h +++ b/LUFA/DriverStubs/LEDs.h @@ -45,8 +45,6 @@ /* Includes: */ #include - #include "../../../Common/Common.h" - // TODO: Add any required includes here /* Enable C linkage for C++ Compilers: */ diff --git a/LUFA/ManPages/ChangeLog.txt b/LUFA/ManPages/ChangeLog.txt index 6037593e2..dab0ec6b6 100644 --- a/LUFA/ManPages/ChangeLog.txt +++ b/LUFA/ManPages/ChangeLog.txt @@ -86,6 +86,7 @@ * - Fixed HID Report Descriptor Parser not correctly resetting internal states when a REPORT ID element is encountered * - Fixed incorrect BUTTONS_BUTTON1 for the STK526 target * - Fixed RNDIS demos freezing when more than one connection was attempted simultaneously, causing memory corruption + * - Fixed USBtoSerial demo receiving noise from the USART due to pullup not being enabled * * * \section Sec_ChangeLog090605 Version 090605 diff --git a/Projects/Benito/Benito.c b/Projects/Benito/Benito.c index d7e0413a6..100c897fa 100644 --- a/Projects/Benito/Benito.c +++ b/Projects/Benito/Benito.c @@ -141,6 +141,7 @@ void SetupHardware(void) clock_prescale_set(clock_div_1); /* Hardware Initialization */ + Serial_Init(9600, false); LEDs_Init(); USB_Init(); @@ -165,17 +166,17 @@ void EVENT_USB_Device_Connect(void) void EVENT_USB_Device_Disconnect(void) { PingPongMSRemaining = 0; - LEDs_TurnOffLEDs(LEDMASK_BUSY); + LEDs_SetAllLEDs(LEDS_NO_LEDS); } /** Event handler for the library USB Configuration Changed event. */ void EVENT_USB_Device_ConfigurationChanged(void) { PingPongMSRemaining = 0; - LEDs_TurnOffLEDs(LEDMASK_BUSY); + LEDs_SetAllLEDs(LEDS_NO_LEDS); if (!(CDC_Device_ConfigureEndpoints(&VirtualSerial_CDC_Interface))) - LEDs_TurnOnLEDs(LEDMASK_ERROR); + LEDs_SetAllLEDs(LEDMASK_ERROR); } /** Event handler for the library USB Unhandled Control Request event. */ @@ -233,9 +234,9 @@ void EVENT_CDC_Device_ControLineStateChanged(USB_ClassInfo_CDC_Device_t* const C /* Check if the DTR line has been asserted - if so, start the target AVR's reset pulse */ if (CDCInterfaceInfo->State.ControlLineStates.HostToDevice & CDC_CONTROL_LINE_OUT_DTR) { - LEDs_TurnOnLEDs(LEDMASK_BUSY); + LEDs_SetAllLEDs(LEDMASK_BUSY); - AVR_RESET_LINE_DDR |= AVR_RESET_LINE_MASK; - ResetPulseMSRemaining = AVR_RESET_PULSE_MS; + AVR_RESET_LINE_DDR |= AVR_RESET_LINE_MASK; + ResetPulseMSRemaining = AVR_RESET_PULSE_MS; } } diff --git a/Projects/Benito/Benito.h b/Projects/Benito/Benito.h index 3b0dfcd2c..daf8315b2 100644 --- a/Projects/Benito/Benito.h +++ b/Projects/Benito/Benito.h @@ -57,8 +57,10 @@ /** LED mask for the library LED driver, to indicate RX activity. */ #define LEDMASK_RX LEDS_LED2 + /** LED mask for the library LED driver, to indicate that an error has occurred in the USB interface. */ #define LEDMASK_ERROR (LEDS_LED1 | LEDS_LED2) + /** LED mask for the library LED driver, to indicate that the USB interface is busy. */ #define LEDMASK_BUSY (LEDS_LED1 | LEDS_LED2) /* Function Prototypes: */ diff --git a/Projects/Benito/makefile b/Projects/Benito/makefile index 88c62e9e8..227012b16 100644 --- a/Projects/Benito/makefile +++ b/Projects/Benito/makefile @@ -66,7 +66,7 @@ MCU = at90usb162 # Target board (see library "Board Types" documentation, USER or blank for projects not requiring # LUFA board drivers). If USER is selected, put custom board drivers in a directory called # "Board" inside the application directory. -BOARD = USBKEY +BOARD = USER # Processor frequency. -- cgit v1.2.3