Speed up bit-banged USART code in the AVRISP project.
authorDean Camera <dean@fourwalledcubicle.com>
Tue, 15 Dec 2009 11:12:38 +0000 (11:12 +0000)
committerDean Camera <dean@fourwalledcubicle.com>
Tue, 15 Dec 2009 11:12:38 +0000 (11:12 +0000)
Fix project text files to refer to "project" instead of "demo".

Projects/AVRISP/AVRISP.txt
Projects/AVRISP/Lib/NVMTarget.c
Projects/AVRISP/Lib/PDITarget.c
Projects/AVRISP/makefile
Projects/Benito/Benito.txt
Projects/Magstripe/Magstripe.txt
Projects/MissileLauncher/MissileLauncher.txt
Projects/USBtoSerial/USBtoSerial.txt
Projects/XPLAINBridge/XPLAINBridge.txt

index 2de8dd2..35cf937 100644 (file)
@@ -6,9 +6,9 @@
  \r
 /** \mainpage AVRISP MKII Programmer Project\r
  *\r
  \r
 /** \mainpage AVRISP MKII Programmer Project\r
  *\r
- *  \section SSec_Compat Demo Compatibility:\r
+ *  \section SSec_Compat Project Compatibility:\r
  *\r
  *\r
- *  The following list indicates what microcontrollers are compatible with this demo.\r
+ *  The following list indicates what microcontrollers are compatible with this project.\r
  *\r
  *  - Series 7 USB AVRs\r
  *  - Series 6 USB AVRs\r
  *\r
  *  - Series 7 USB AVRs\r
  *  - Series 6 USB AVRs\r
@@ -17,7 +17,7 @@
  *\r
  *  \section SSec_Info USB Information:\r
  *\r
  *\r
  *  \section SSec_Info USB Information:\r
  *\r
- *  The following table gives a rundown of the USB utilization of this demo.\r
+ *  The following table gives a rundown of the USB utilization of this project.\r
  *\r
  * <table>\r
  *  <tr>\r
  *\r
  * <table>\r
  *  <tr>\r
@@ -67,7 +67,7 @@
  *  While this application can be compiled for USB AVRs with as little as 8KB of FLASH, for full functionality 16KB or more\r
  *  of FLASH is required. On 8KB devices, either ISP or PDI programming support can be disabled to reduce program size.\r
  *\r
  *  While this application can be compiled for USB AVRs with as little as 8KB of FLASH, for full functionality 16KB or more\r
  *  of FLASH is required. On 8KB devices, either ISP or PDI programming support can be disabled to reduce program size.\r
  *\r
- *\r
+ *  \section Sec_ISP ISP Connections\r
  *  Connections to the device for SPI programming (when enabled):\r
  *\r
  *  <table>\r
  *  Connections to the device for SPI programming (when enabled):\r
  *\r
  *  <table>\r
  *  <b><sup>1</sup></b> <i>Optional, see \ref SSec_Options section - for USB AVRs with ADC modules only</i> \n\r
  *  <b><sup>2</sup></b> <i>See \ref SSec_Options section</i>\r
  *\r
  *  <b><sup>1</sup></b> <i>Optional, see \ref SSec_Options section - for USB AVRs with ADC modules only</i> \n\r
  *  <b><sup>2</sup></b> <i>See \ref SSec_Options section</i>\r
  *\r
- *\r
+ *  \section Sec_PDI PDI Connections\r
  *  Connections to the device for PDI programming<b><sup>1</sup></b> (when enabled):\r
  *\r
  *  <table>\r
  *  Connections to the device for PDI programming<b><sup>1</sup></b> (when enabled):\r
  *\r
  *  <table>\r
  *   </tr>\r
  *  </table>\r
  *\r
  *   </tr>\r
  *  </table>\r
  *\r
- *  <b><sup>1</sup></b> When PDI_VIA_HARDWARE_USART is set, the AVR's Tx and Rx become the DATA line when connected together\r
- *                      via a pair of 300 ohm resistors, and the AVR's XCK pin becomes CLOCK.\r
+ *  <b><sup>1</sup></b> <i>When PDI_VIA_HARDWARE_USART is set, the AVR's Tx and Rx become the DATA line when connected together\r
+ *                         via a pair of 300 ohm resistors, and the AVR's XCK pin becomes CLOCK.</i>\r
  *\r
  *  \section SSec_Options Project Options\r
  *\r
  *\r
  *  \section SSec_Options Project Options\r
  *\r
- *  The following defines can be found in this demo, which can control the demo behaviour when defined, or changed in value.\r
+ *  The following defines can be found in this project, which can control the project behaviour when defined, or changed in value.\r
  *\r
  *  <table>\r
  *   <tr>\r
  *\r
  *  <table>\r
  *   <tr>\r
index 9402b2b..10a911f 100644 (file)
@@ -182,7 +182,6 @@ bool NVMTarget_ReadMemory(uint32_t ReadAddress, uint8_t* ReadBuffer, uint16_t Re
  *  \param[in]  WriteCommand  Command to send to the device to write each memory byte\r
  *  \param[in]  WriteAddress  Start address to write to within the target's address space\r
  *  \param[in]  WriteBuffer   Buffer to source data from\r
  *  \param[in]  WriteCommand  Command to send to the device to write each memory byte\r
  *  \param[in]  WriteAddress  Start address to write to within the target's address space\r
  *  \param[in]  WriteBuffer   Buffer to source data from\r
- *  \param[in]  WriteSize     Number of bytes to write\r
  *\r
  *  \return Boolean true if the command sequence complete successfully\r
  */\r
  *\r
  *  \return Boolean true if the command sequence complete successfully\r
  */\r
index 28df550..1bbb4d5 100644 (file)
@@ -45,9 +45,8 @@ volatile bool     IsSending;
 /** Software USART raw frame bits for transmission/reception. */\r
 volatile uint16_t SoftUSART_Data;\r
 \r
 /** Software USART raw frame bits for transmission/reception. */\r
 volatile uint16_t SoftUSART_Data;\r
 \r
-/** Bits remaining to be sent or received via the software USART. */\r
-volatile uint8_t  SoftUSART_BitCount;\r
-\r
+/** Bits remaining to be sent or received via the software USART - set as a GPIOR for speed. */\r
+#define SoftUSART_BitCount   GPIOR2\r
 \r
 /** ISR to manage the software USART when bit-banged USART mode is selected. */\r
 ISR(TIMER1_COMPA_vect, ISR_BLOCK)\r
 \r
 /** ISR to manage the software USART when bit-banged USART mode is selected. */\r
 ISR(TIMER1_COMPA_vect, ISR_BLOCK)\r
@@ -59,21 +58,13 @@ ISR(TIMER1_COMPA_vect, ISR_BLOCK)
        if (!(SoftUSART_BitCount))\r
          return;\r
 \r
        if (!(SoftUSART_BitCount))\r
          return;\r
 \r
-       /* Check to see if the current clock state is on the rising or falling edge */\r
-       bool IsRisingEdge = (BITBANG_PDICLOCK_PORT & BITBANG_PDICLOCK_MASK);\r
-\r
-       if (IsSending && !IsRisingEdge)\r
-       {\r
-               if (SoftUSART_Data & 0x01)\r
-                 BITBANG_PDIDATA_PORT |=  BITBANG_PDIDATA_MASK;\r
-               else\r
-                 BITBANG_PDIDATA_PORT &= ~BITBANG_PDIDATA_MASK;                  \r
-\r
-               SoftUSART_Data >>= 1;\r
-               SoftUSART_BitCount--;\r
-       }\r
-       else if (!IsSending && IsRisingEdge)\r
+       /* Check to see if we are at a rising or falling edge of the clock */\r
+       if (BITBANG_PDICLOCK_PORT & BITBANG_PDICLOCK_MASK)\r
        {\r
        {\r
+               /* If at rising clock edge and we are in send mode, abort */\r
+               if (IsSending)\r
+                 return;\r
+                 \r
                /* Wait for the start bit when receiving */\r
                if ((SoftUSART_BitCount == BITS_IN_FRAME) && (BITBANG_PDIDATA_PIN & BITBANG_PDIDATA_MASK))\r
                  return;\r
                /* Wait for the start bit when receiving */\r
                if ((SoftUSART_BitCount == BITS_IN_FRAME) && (BITBANG_PDIDATA_PIN & BITBANG_PDIDATA_MASK))\r
                  return;\r
@@ -84,6 +75,20 @@ ISR(TIMER1_COMPA_vect, ISR_BLOCK)
                SoftUSART_Data >>= 1;\r
                SoftUSART_BitCount--;\r
        }\r
                SoftUSART_Data >>= 1;\r
                SoftUSART_BitCount--;\r
        }\r
+       else\r
+       {\r
+               /* If at falling clock edge and we are in receive mode, abort */\r
+               if (!IsSending)\r
+                 return;\r
+\r
+               if (SoftUSART_Data & 0x01)\r
+                 BITBANG_PDIDATA_PORT |=  BITBANG_PDIDATA_MASK;\r
+               else\r
+                 BITBANG_PDIDATA_PORT &= ~BITBANG_PDIDATA_MASK;                  \r
+\r
+               SoftUSART_Data >>= 1;\r
+               SoftUSART_BitCount--;\r
+       }\r
 }\r
 #endif\r
 \r
 }\r
 #endif\r
 \r
@@ -120,7 +125,7 @@ void PDITarget_EnableTargetPDI(void)
        asm volatile ("NOP"::);\r
 \r
        /* Fire timer compare ISR every 100 cycles to manage the software USART */\r
        asm volatile ("NOP"::);\r
 \r
        /* Fire timer compare ISR every 100 cycles to manage the software USART */\r
-       OCR1A   = 100;\r
+       OCR1A   = 80;\r
        TCCR1B  = (1 << WGM12) | (1 << CS10);\r
        TIMSK1  = (1 << OCIE1A);\r
        \r
        TCCR1B  = (1 << WGM12) | (1 << CS10);\r
        TIMSK1  = (1 << OCIE1A);\r
        \r
index 23e27c5..2b6a1e8 100644 (file)
@@ -66,7 +66,7 @@ MCU = at90usb1287
 # Target board (see library "Board Types" documentation, USER or blank for projects not requiring\r
 # LUFA board drivers). If USER is selected, put custom board drivers in a directory called \r
 # "Board" inside the application directory.\r
 # Target board (see library "Board Types" documentation, USER or blank for projects not requiring\r
 # LUFA board drivers). If USER is selected, put custom board drivers in a directory called \r
 # "Board" inside the application directory.\r
-BOARD = XPLAIN\r
+BOARD = USBKEY\r
 \r
 \r
 # Processor frequency.\r
 \r
 \r
 # Processor frequency.\r
index 128fba3..248ca77 100644 (file)
@@ -6,9 +6,9 @@
  \r
 /** \mainpage Benito Arduino Programmer Project\r
  *\r
  \r
 /** \mainpage Benito Arduino Programmer Project\r
  *\r
- *  \section SSec_Compat Demo Compatibility:\r
+ *  \section SSec_Compat Project Compatibility:\r
  *\r
  *\r
- *  The following list indicates what microcontrollers are compatible with this demo.\r
+ *  The following list indicates what microcontrollers are compatible with this project.\r
  *\r
  *  - Series 7 USB AVRs\r
  *  - Series 6 USB AVRs\r
  *\r
  *  - Series 7 USB AVRs\r
  *  - Series 6 USB AVRs\r
@@ -17,7 +17,7 @@
  *\r
  *  \section SSec_Info USB Information:\r
  *\r
  *\r
  *  \section SSec_Info USB Information:\r
  *\r
- *  The following table gives a rundown of the USB utilization of this demo.\r
+ *  The following table gives a rundown of the USB utilization of this project.\r
  *\r
  * <table>\r
  *  <tr>\r
  *\r
  * <table>\r
  *  <tr>\r
@@ -58,7 +58,7 @@
  *\r
  *  \section SSec_Options Project Options\r
  *\r
  *\r
  *  \section SSec_Options Project Options\r
  *\r
- *  The following defines can be found in this demo, which can control the demo behaviour when defined, or changed in value.\r
+ *  The following defines can be found in this project, which can control the project behaviour when defined, or changed in value.\r
  *\r
  *  <table>\r
  *   <tr>\r
  *\r
  *  <table>\r
  *   <tr>\r
index 1958627..41c6b6e 100644 (file)
@@ -6,16 +6,16 @@
  \r
 /** \mainpage Denver Gingerich's USBSnoop Magnetic Card Reader Project\r
  *\r
  \r
 /** \mainpage Denver Gingerich's USBSnoop Magnetic Card Reader Project\r
  *\r
- *  \section SSec_Compat Demo Compatibility:\r
+ *  \section SSec_Compat Project Compatibility:\r
  *\r
  *\r
- *  The following list indicates what microcontrollers are compatible with this demo.\r
+ *  The following list indicates what microcontrollers are compatible with this project.\r
  *\r
  *  - AT90USB1287\r
  *  - AT90USB1286\r
  *\r
  *  \section SSec_Info USB Information:\r
  *\r
  *\r
  *  - AT90USB1287\r
  *  - AT90USB1286\r
  *\r
  *  \section SSec_Info USB Information:\r
  *\r
- *  The following table gives a rundown of the USB utilization of this demo.\r
+ *  The following table gives a rundown of the USB utilization of this project.\r
  *\r
  * <table>\r
  *  <tr>\r
  *\r
  * <table>\r
  *  <tr>\r
  *   </tr>\r
  *  </table>\r
  *\r
  *   </tr>\r
  *  </table>\r
  *\r
- *  This project is based on the LUFA Keyboard demonstration application,\r
+ *  This project is based on the LUFA Keyboard projectnstration application,\r
  *  written by Denver Gingerich.\r
  *\r
  *  This application uses a keyboard HID driver to communicate the data collected\r
  *  a TTL magnetic stripe reader to the connected computer. The raw bitstream\r
  *  obtained from the magnetic stripe reader is "typed" through the keyboard\r
  *  written by Denver Gingerich.\r
  *\r
  *  This application uses a keyboard HID driver to communicate the data collected\r
  *  a TTL magnetic stripe reader to the connected computer. The raw bitstream\r
  *  obtained from the magnetic stripe reader is "typed" through the keyboard\r
- *  driver as 0's and 1's. After every card swipe, the demo will send a return key.\r
+ *  driver as 0's and 1's. After every card swipe, the project will send a return key.\r
  *\r
  *  \section SSec_Options Project Options\r
  *\r
  *\r
  *  \section SSec_Options Project Options\r
  *\r
- *  The following defines can be found in this demo, which can control the demo behaviour when defined, or changed in value.\r
+ *  The following defines can be found in this project, which can control the project behaviour when defined, or changed in value.\r
  *\r
  *  <table>\r
  *   <tr>\r
  *\r
  *  <table>\r
  *   <tr>\r
index 1dfff2f..519410e 100644 (file)
@@ -4,17 +4,17 @@
  *  documentation pages. It is not a project source file.\r
  */\r
  \r
  *  documentation pages. It is not a project source file.\r
  */\r
  \r
-/** \mainpage Missile Launcher\r
+/** \mainpage David Fletcher's Missile Launcher\r
  *\r
  *\r
- *  \section SSec_Compat Demo Compatibility:\r
+ *  \section SSec_Compat Project Compatibility:\r
  *\r
  *\r
- *  The following list indicates what microcontrollers are compatible with this demo.\r
+ *  The following list indicates what microcontrollers are compatible with this project.\r
  *\r
  *  - Series 7 USB AVRs\r
  *\r
  *  \section SSec_Info USB Information:\r
  *\r
  *\r
  *  - Series 7 USB AVRs\r
  *\r
  *  \section SSec_Info USB Information:\r
  *\r
- *  The following table gives a rundown of the USB utilization of this demo.\r
+ *  The following table gives a rundown of the USB utilization of this project.\r
  *\r
  *  <table>\r
  *   <tr>\r
  *\r
  *  <table>\r
  *   <tr>\r
@@ -47,7 +47,7 @@
  *\r
  *  \section SSec_Options Project Options\r
  *\r
  *\r
  *  \section SSec_Options Project Options\r
  *\r
- *  The following defines can be found in this demo, which can control the demo behaviour when defined, or changed in value.\r
+ *  The following defines can be found in this project, which can control the project behaviour when defined, or changed in value.\r
  *\r
  *  <table>\r
  *   <tr>\r
  *\r
  *  <table>\r
  *   <tr>\r
index f5378cc..10f0003 100644 (file)
@@ -4,11 +4,11 @@
  *  documentation pages. It is not a project source file.\r
  */\r
  \r
  *  documentation pages. It is not a project source file.\r
  */\r
  \r
-/** \mainpage USB to Serial Converter Project (via CDC-ACM class)\r
+/** \mainpage USB to Serial Converter Project\r
  *\r
  *\r
- *  \section SSec_Compat Demo Compatibility:\r
+ *  \section SSec_Compat Project Compatibility:\r
  *\r
  *\r
- *  The following list indicates what microcontrollers are compatible with this demo.\r
+ *  The following list indicates what microcontrollers are compatible with this project.\r
  *\r
  *  - Series 7 USB AVRs\r
  *  - Series 6 USB AVRs\r
  *\r
  *  - Series 7 USB AVRs\r
  *  - Series 6 USB AVRs\r
@@ -17,7 +17,7 @@
  *\r
  *  \section SSec_Info USB Information:\r
  *\r
  *\r
  *  \section SSec_Info USB Information:\r
  *\r
- *  The following table gives a rundown of the USB utilization of this demo.\r
+ *  The following table gives a rundown of the USB utilization of this project.\r
  *\r
  *  <table>\r
  *   <tr>\r
  *\r
  *  <table>\r
  *   <tr>\r
@@ -55,8 +55,8 @@
  *  error rates at the AVR's clock speed, data lengths other than 6, 7 or 8 bits,\r
  *  1.5 stop bits, parity other than none, even or odd).\r
  *  \r
  *  error rates at the AVR's clock speed, data lengths other than 6, 7 or 8 bits,\r
  *  1.5 stop bits, parity other than none, even or odd).\r
  *  \r
- *  After running this demo for the first time on a new computer,\r
- *  you will need to supply the .INF file located in this demo\r
+ *  After running this project for the first time on a new computer,\r
+ *  you will need to supply the .INF file located in this project\r
  *  project's directory as the device's driver when running under\r
  *  Windows. This will enable Windows to use its inbuilt CDC drivers,\r
  *  negating the need for custom drivers for the device. Other\r
  *  project's directory as the device's driver when running under\r
  *  Windows. This will enable Windows to use its inbuilt CDC drivers,\r
  *  negating the need for custom drivers for the device. Other\r
@@ -65,7 +65,7 @@
  *\r
  *  \section SSec_Options Project Options\r
  *\r
  *\r
  *  \section SSec_Options Project Options\r
  *\r
- *  The following defines can be found in this demo, which can control the demo behaviour when defined, or changed in value.\r
+ *  The following defines can be found in this project, which can control the project behaviour when defined, or changed in value.\r
  *\r
  *  <table>\r
  *   <tr>\r
  *\r
  *  <table>\r
  *   <tr>\r
index e90a2d6..ec6eee7 100644 (file)
@@ -6,15 +6,15 @@
  \r
 /** \mainpage XPLAIN UART Bridge Project\r
  *\r
  \r
 /** \mainpage XPLAIN UART Bridge Project\r
  *\r
- *  \section SSec_Compat Demo Compatibility:\r
+ *  \section SSec_Compat Project Compatibility:\r
  *\r
  *\r
- *  The following list indicates what microcontrollers are compatible with this demo.\r
+ *  The following list indicates what microcontrollers are compatible with this project.\r
  *\r
  *  - AT90USB1287\r
  *\r
  *  \section SSec_Info USB Information:\r
  *\r
  *\r
  *  - AT90USB1287\r
  *\r
  *  \section SSec_Info USB Information:\r
  *\r
- *  The following table gives a rundown of the USB utilization of this demo.\r
+ *  The following table gives a rundown of the USB utilization of this project.\r
  *\r
  *  <table>\r
  *   <tr>\r
  *\r
  *  <table>\r
  *   <tr>\r
  *  host. When inserted, the device will enumerate as a regular COM port on the host, which can then be opened and data exchanged\r
  *  between the XMEGA and Host as if the XMEGA was connected directly to the host's serial port.\r
  *\r
  *  host. When inserted, the device will enumerate as a regular COM port on the host, which can then be opened and data exchanged\r
  *  between the XMEGA and Host as if the XMEGA was connected directly to the host's serial port.\r
  *\r
- *  After running this demo for the first time on a new computer, you will need to supply the .INF file located in this demo\r
+ *  After running this project for the first time on a new computer, you will need to supply the .INF file located in this project\r
  *  project's directory as the device's driver when running under Windows. This will enable Windows to use its inbuilt CDC drivers,\r
  *  negating the need for custom drivers for the device. Other Operating Systems should automatically use their own inbuilt CDC-ACM\r
  *  drivers.\r
  *\r
  *  \section SSec_Options Project Options\r
  *\r
  *  project's directory as the device's driver when running under Windows. This will enable Windows to use its inbuilt CDC drivers,\r
  *  negating the need for custom drivers for the device. Other Operating Systems should automatically use their own inbuilt CDC-ACM\r
  *  drivers.\r
  *\r
  *  \section SSec_Options Project Options\r
  *\r
- *  The following defines can be found in this demo, which can control the demo behaviour when defined, or changed in value.\r
+ *  The following defines can be found in this project, which can control the project behaviour when defined, or changed in value.\r
  *\r
  *  <table>\r
  *   <tr>\r
  *\r
  *  <table>\r
  *   <tr>\r