summary | 
shortlog | 
log | 
commit | commitdiff | 
tree
raw | 
patch | 
inline | side by side (from parent 1: 
002cd6d)
 
Speed up XMEGANVM_WaitWhileNVMControllerBusy() by preloading the status register address into the pointer register of the target's NVM controller and then reading via a faster indirect load command.
   *  - Fixed USBtoSerial and XPLAINBridge demos discarding data from the PC if the send buffer becomes full
   *  - Fixed broken input in the MagStripe reader project due to an incorrect HID report descriptor
   *  - Fixed incorrect PollingIntervalMS values in the demo/project/bootloader endpoint descriptors (thanks to MCS Electronics)
   *  - Fixed USBtoSerial and XPLAINBridge demos discarding data from the PC if the send buffer becomes full
   *  - Fixed broken input in the MagStripe reader project due to an incorrect HID report descriptor
   *  - Fixed incorrect PollingIntervalMS values in the demo/project/bootloader endpoint descriptors (thanks to MCS Electronics)
-  *  - Fixed PDI/TPI programming speed of ~250KHz in the AVRISP-MKII Clone project, instead of the desired 500KHz (thanks to Tom Light)
   *
   *  \section Sec_ChangeLog100807 Version 100807
   *  <b>New:</b>
   *
   *  \section Sec_ChangeLog100807 Version 100807
   *  <b>New:</b>
 
  */
 bool XMEGANVM_WaitWhileNVMControllerBusy(void)
 {
  */
 bool XMEGANVM_WaitWhileNVMControllerBusy(void)
 {
+       /* Preload the pointer register with the NVM STATUS register address to check the BUSY flag */
+       XPROGTarget_SendByte(PDI_CMD_ST | (PDI_POINTER_DIRECT << 2) | PDI_DATSIZE_4BYTES);
+       XMEGANVM_SendNVMRegAddress(XMEGA_NVM_REG_STATUS);
+
        /* Poll the NVM STATUS register while the NVM controller is busy */
        for (;;)
        {
        /* Poll the NVM STATUS register while the NVM controller is busy */
        for (;;)
        {
-               /* Send a LDS command to read the NVM STATUS register to check the BUSY flag */
-               XPROGTarget_SendByte(PDI_CMD_LDS | (PDI_DATSIZE_4BYTES << 2));
-               XMEGANVM_SendNVMRegAddress(XMEGA_NVM_REG_STATUS);
-
+               /* Fetch the current status value via the pointer register (without auto-increment afterwards) */
+               XPROGTarget_SendByte(PDI_CMD_LD | (PDI_POINTER_INDIRECT << 2) | PDI_DATSIZE_1BYTE);
                uint8_t StatusRegister = XPROGTarget_ReceiveByte();
 
                /* We might have timed out waiting for the status register read response, check here */
                uint8_t StatusRegister = XPROGTarget_ReceiveByte();
 
                /* We might have timed out waiting for the status register read response, check here */
 
                #endif
 
                /** Serial carrier TPI/PDI speed when hardware TPI/PDI mode is used. */
                #endif
 
                /** Serial carrier TPI/PDI speed when hardware TPI/PDI mode is used. */
-               #define XPROG_HARDWARE_SPEED       500000
+               #define XPROG_HARDWARE_SPEED       250000
 
                /** Total number of bits in a single USART frame. */
                #define BITS_IN_USART_FRAME        12
 
                /** Total number of bits in a single USART frame. */
                #define BITS_IN_USART_FRAME        12
 
 
 
 # Target board (see library "Board Types" documentation, NONE for projects not requiring
 # LUFA board drivers). If USER is selected, put custom board drivers in a directory called
 # "Board" inside the application directory.
 
 
 # Target board (see library "Board Types" documentation, NONE for projects not requiring
 # LUFA board drivers). If USER is selected, put custom board drivers in a directory called
 # "Board" inside the application directory.
 #     does not *change* the processor frequency - it should merely be updated to
 #     reflect the processor speed set externally so that the code can use accurate
 #     software delays.
 #     does not *change* the processor frequency - it should merely be updated to
 #     reflect the processor speed set externally so that the code can use accurate
 #     software delays.