Speed up bit-banged USART code in the AVRISP project.

Fix project text files to refer to "project" instead of "demo".
pull/1469/head
Dean Camera 15 years ago
parent 2f6c096050
commit 4f74075fad

@ -6,9 +6,9 @@
/** \mainpage AVRISP MKII Programmer Project
*
* \section SSec_Compat Demo Compatibility:
* \section SSec_Compat Project Compatibility:
*
* The following list indicates what microcontrollers are compatible with this demo.
* The following list indicates what microcontrollers are compatible with this project.
*
* - Series 7 USB AVRs
* - Series 6 USB AVRs
@ -17,7 +17,7 @@
*
* \section SSec_Info USB Information:
*
* The following table gives a rundown of the USB utilization of this demo.
* The following table gives a rundown of the USB utilization of this project.
*
* <table>
* <tr>
@ -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
* of FLASH is required. On 8KB devices, either ISP or PDI programming support can be disabled to reduce program size.
*
*
* \section Sec_ISP ISP Connections
* Connections to the device for SPI programming (when enabled):
*
* <table>
@ -111,7 +111,7 @@
* <b><sup>1</sup></b> <i>Optional, see \ref SSec_Options section - for USB AVRs with ADC modules only</i> \n
* <b><sup>2</sup></b> <i>See \ref SSec_Options section</i>
*
*
* \section Sec_PDI PDI Connections
* Connections to the device for PDI programming<b><sup>1</sup></b> (when enabled):
*
* <table>
@ -152,12 +152,12 @@
* </tr>
* </table>
*
* <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
* via a pair of 300 ohm resistors, and the AVR's XCK pin becomes CLOCK.
* <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
* via a pair of 300 ohm resistors, and the AVR's XCK pin becomes CLOCK.</i>
*
* \section SSec_Options Project Options
*
* The following defines can be found in this demo, which can control the demo behaviour when defined, or changed in value.
* The following defines can be found in this project, which can control the project behaviour when defined, or changed in value.
*
* <table>
* <tr>

@ -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
* \param[in] WriteAddress Start address to write to within the target's address space
* \param[in] WriteBuffer Buffer to source data from
* \param[in] WriteSize Number of bytes to write
*
* \return Boolean true if the command sequence complete successfully
*/

@ -45,9 +45,8 @@ volatile bool IsSending;
/** Software USART raw frame bits for transmission/reception. */
volatile uint16_t SoftUSART_Data;
/** Bits remaining to be sent or received via the software USART. */
volatile uint8_t SoftUSART_BitCount;
/** Bits remaining to be sent or received via the software USART - set as a GPIOR for speed. */
#define SoftUSART_BitCount GPIOR2
/** ISR to manage the software USART when bit-banged USART mode is selected. */
ISR(TIMER1_COMPA_vect, ISR_BLOCK)
@ -59,21 +58,13 @@ ISR(TIMER1_COMPA_vect, ISR_BLOCK)
if (!(SoftUSART_BitCount))
return;
/* Check to see if the current clock state is on the rising or falling edge */
bool IsRisingEdge = (BITBANG_PDICLOCK_PORT & BITBANG_PDICLOCK_MASK);
if (IsSending && !IsRisingEdge)
/* Check to see if we are at a rising or falling edge of the clock */
if (BITBANG_PDICLOCK_PORT & BITBANG_PDICLOCK_MASK)
{
if (SoftUSART_Data & 0x01)
BITBANG_PDIDATA_PORT |= BITBANG_PDIDATA_MASK;
else
BITBANG_PDIDATA_PORT &= ~BITBANG_PDIDATA_MASK;
/* If at rising clock edge and we are in send mode, abort */
if (IsSending)
return;
SoftUSART_Data >>= 1;
SoftUSART_BitCount--;
}
else if (!IsSending && IsRisingEdge)
{
/* Wait for the start bit when receiving */
if ((SoftUSART_BitCount == BITS_IN_FRAME) && (BITBANG_PDIDATA_PIN & BITBANG_PDIDATA_MASK))
return;
@ -84,6 +75,20 @@ ISR(TIMER1_COMPA_vect, ISR_BLOCK)
SoftUSART_Data >>= 1;
SoftUSART_BitCount--;
}
else
{
/* If at falling clock edge and we are in receive mode, abort */
if (!IsSending)
return;
if (SoftUSART_Data & 0x01)
BITBANG_PDIDATA_PORT |= BITBANG_PDIDATA_MASK;
else
BITBANG_PDIDATA_PORT &= ~BITBANG_PDIDATA_MASK;
SoftUSART_Data >>= 1;
SoftUSART_BitCount--;
}
}
#endif
@ -120,7 +125,7 @@ void PDITarget_EnableTargetPDI(void)
asm volatile ("NOP"::);
/* Fire timer compare ISR every 100 cycles to manage the software USART */
OCR1A = 100;
OCR1A = 80;
TCCR1B = (1 << WGM12) | (1 << CS10);
TIMSK1 = (1 << OCIE1A);

@ -66,7 +66,7 @@ MCU = at90usb1287
# 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 = XPLAIN
BOARD = USBKEY
# Processor frequency.

@ -6,9 +6,9 @@
/** \mainpage Benito Arduino Programmer Project
*
* \section SSec_Compat Demo Compatibility:
* \section SSec_Compat Project Compatibility:
*
* The following list indicates what microcontrollers are compatible with this demo.
* The following list indicates what microcontrollers are compatible with this project.
*
* - Series 7 USB AVRs
* - Series 6 USB AVRs
@ -17,7 +17,7 @@
*
* \section SSec_Info USB Information:
*
* The following table gives a rundown of the USB utilization of this demo.
* The following table gives a rundown of the USB utilization of this project.
*
* <table>
* <tr>
@ -58,7 +58,7 @@
*
* \section SSec_Options Project Options
*
* The following defines can be found in this demo, which can control the demo behaviour when defined, or changed in value.
* The following defines can be found in this project, which can control the project behaviour when defined, or changed in value.
*
* <table>
* <tr>

@ -6,16 +6,16 @@
/** \mainpage Denver Gingerich's USBSnoop Magnetic Card Reader Project
*
* \section SSec_Compat Demo Compatibility:
* \section SSec_Compat Project Compatibility:
*
* The following list indicates what microcontrollers are compatible with this demo.
* The following list indicates what microcontrollers are compatible with this project.
*
* - AT90USB1287
* - AT90USB1286
*
* \section SSec_Info USB Information:
*
* The following table gives a rundown of the USB utilization of this demo.
* The following table gives a rundown of the USB utilization of this project.
*
* <table>
* <tr>
@ -87,17 +87,17 @@
* </tr>
* </table>
*
* This project is based on the LUFA Keyboard demonstration application,
* This project is based on the LUFA Keyboard projectnstration application,
* written by Denver Gingerich.
*
* This application uses a keyboard HID driver to communicate the data collected
* a TTL magnetic stripe reader to the connected computer. The raw bitstream
* obtained from the magnetic stripe reader is "typed" through the keyboard
* driver as 0's and 1's. After every card swipe, the demo will send a return key.
* driver as 0's and 1's. After every card swipe, the project will send a return key.
*
* \section SSec_Options Project Options
*
* The following defines can be found in this demo, which can control the demo behaviour when defined, or changed in value.
* The following defines can be found in this project, which can control the project behaviour when defined, or changed in value.
*
* <table>
* <tr>

@ -4,17 +4,17 @@
* documentation pages. It is not a project source file.
*/
/** \mainpage Missile Launcher
/** \mainpage David Fletcher's Missile Launcher
*
* \section SSec_Compat Demo Compatibility:
* \section SSec_Compat Project Compatibility:
*
* The following list indicates what microcontrollers are compatible with this demo.
* The following list indicates what microcontrollers are compatible with this project.
*
* - Series 7 USB AVRs
*
* \section SSec_Info USB Information:
*
* The following table gives a rundown of the USB utilization of this demo.
* The following table gives a rundown of the USB utilization of this project.
*
* <table>
* <tr>
@ -47,7 +47,7 @@
*
* \section SSec_Options Project Options
*
* The following defines can be found in this demo, which can control the demo behaviour when defined, or changed in value.
* The following defines can be found in this project, which can control the project behaviour when defined, or changed in value.
*
* <table>
* <tr>

@ -4,11 +4,11 @@
* documentation pages. It is not a project source file.
*/
/** \mainpage USB to Serial Converter Project (via CDC-ACM class)
/** \mainpage USB to Serial Converter Project
*
* \section SSec_Compat Demo Compatibility:
* \section SSec_Compat Project Compatibility:
*
* The following list indicates what microcontrollers are compatible with this demo.
* The following list indicates what microcontrollers are compatible with this project.
*
* - Series 7 USB AVRs
* - Series 6 USB AVRs
@ -17,7 +17,7 @@
*
* \section SSec_Info USB Information:
*
* The following table gives a rundown of the USB utilization of this demo.
* The following table gives a rundown of the USB utilization of this project.
*
* <table>
* <tr>
@ -55,8 +55,8 @@
* error rates at the AVR's clock speed, data lengths other than 6, 7 or 8 bits,
* 1.5 stop bits, parity other than none, even or odd).
*
* After running this demo for the first time on a new computer,
* you will need to supply the .INF file located in this demo
* After running this project for the first time on a new computer,
* you will need to supply the .INF file located in this project
* project's directory as the device's driver when running under
* Windows. This will enable Windows to use its inbuilt CDC drivers,
* negating the need for custom drivers for the device. Other
@ -65,7 +65,7 @@
*
* \section SSec_Options Project Options
*
* The following defines can be found in this demo, which can control the demo behaviour when defined, or changed in value.
* The following defines can be found in this project, which can control the project behaviour when defined, or changed in value.
*
* <table>
* <tr>

@ -6,15 +6,15 @@
/** \mainpage XPLAIN UART Bridge Project
*
* \section SSec_Compat Demo Compatibility:
* \section SSec_Compat Project Compatibility:
*
* The following list indicates what microcontrollers are compatible with this demo.
* The following list indicates what microcontrollers are compatible with this project.
*
* - AT90USB1287
*
* \section SSec_Info USB Information:
*
* The following table gives a rundown of the USB utilization of this demo.
* The following table gives a rundown of the USB utilization of this project.
*
* <table>
* <tr>
@ -46,14 +46,14 @@
* host. When inserted, the device will enumerate as a regular COM port on the host, which can then be opened and data exchanged
* between the XMEGA and Host as if the XMEGA was connected directly to the host's serial port.
*
* After running this demo for the first time on a new computer, you will need to supply the .INF file located in this demo
* After running this project for the first time on a new computer, you will need to supply the .INF file located in this project
* project's directory as the device's driver when running under Windows. This will enable Windows to use its inbuilt CDC drivers,
* negating the need for custom drivers for the device. Other Operating Systems should automatically use their own inbuilt CDC-ACM
* drivers.
*
* \section SSec_Options Project Options
*
* The following defines can be found in this demo, which can control the demo behaviour when defined, or changed in value.
* The following defines can be found in this project, which can control the project behaviour when defined, or changed in value.
*
* <table>
* <tr>

Loading…
Cancel
Save