Skip to content

Commit 2666376

Browse files
author
Lars
committed
pdi reads successfull
1 parent b2590d1 commit 2666376

File tree

8 files changed

+13
-9
lines changed

8 files changed

+13
-9
lines changed

LUFA/Drivers/USB/Core/XMEGA/Endpoint_XMEGA.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -452,7 +452,7 @@
452452
static inline void Endpoint_SetEndpointDirection(const uint8_t DirectionMask)
453453
{
454454
// UECFG0X = ((UECFG0X & ~(1 << EPDIR)) | (DirectionMask ? (1 << EPDIR) : 0));
455-
USB_Endpoint_SelectedEndpoint = (USB_Endpoint_SelectedEndpoint & ~ENDPOINT_DIR_IN) | DirectionMask;
455+
//USB_Endpoint_SelectedEndpoint = (USB_Endpoint_SelectedEndpoint & ~ENDPOINT_DIR_IN) | DirectionMask;
456456
}
457457

458458
/** Reads one byte from the currently selected endpoint's bank, for OUT direction endpoints.

Projects/AVRISP-MKII/AVRISP-MKII.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ void SetupHardware(void)
9696
#if defined(RESET_TOGGLES_LIBUSB_COMPAT)
9797
UpdateCurrentCompatibilityMode();
9898
#endif
99-
99+
100100
/* USB Stack Initialization */
101101
USB_Init();
102102
}
@@ -122,7 +122,7 @@ void EVENT_USB_Device_ConfigurationChanged(void)
122122
ConfigSuccess &= Endpoint_ConfigureEndpoint(AVRISP_DATA_OUT_EPADDR, EP_TYPE_BULK, AVRISP_DATA_EPSIZE, 1);
123123

124124
/* Setup AVRISP Data IN endpoint if it is using a physically different endpoint */
125-
if ((AVRISP_DATA_IN_EPADDR & ENDPOINT_EPNUM_MASK) != (AVRISP_DATA_OUT_EPADDR & ENDPOINT_EPNUM_MASK))
125+
//if ((AVRISP_DATA_IN_EPADDR & ENDPOINT_EPNUM_MASK) != (AVRISP_DATA_OUT_EPADDR & ENDPOINT_EPNUM_MASK))
126126
ConfigSuccess &= Endpoint_ConfigureEndpoint(AVRISP_DATA_IN_EPADDR, EP_TYPE_BULK, AVRISP_DATA_EPSIZE, 1);
127127

128128
/* Indicate endpoint configuration success or failure */

Projects/AVRISP-MKII/Config/AppConfig.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@
8080
#define PDI_USART USARTC0
8181
#define PDI_PORT PORTC
8282
#define PDI_RX_MASK (1 << 2)
83-
#define PDI_RX_CTRL PIN1CTRL
83+
#define PDI_RX_CTRL PIN2CTRL
8484

8585
#define PDI_TX_MASK (1 << 3)
8686
#define PDI_TX_CTRL PIN3CTRL

Projects/AVRISP-MKII/Config/LUFAConfig.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,8 +115,8 @@
115115
#define FIXED_NUM_CONFIGURATIONS 1
116116
// #define CONTROL_ONLY_DEVICE
117117
#define MAX_ENDPOINT_INDEX 4
118-
// #define NO_DEVICE_REMOTE_WAKEUP
119-
// #define NO_DEVICE_SELF_POWER
118+
#define NO_DEVICE_REMOTE_WAKEUP
119+
#define NO_DEVICE_SELF_POWER
120120

121121
#else
122122

Projects/AVRISP-MKII/Lib/V2Protocol.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ void V2Protocol_ProcessCommand(void)
102102
#if ARCH == ARCH_AVR8
103103
TCCR0B = ((1 << CS02) | (1 << CS00));
104104
#elif ARCH == ARCH_XMEGA
105-
TCD0.CTRLA = TC_CLKSEL_DIV1024_gc;
105+
DELAY_TIMER.CTRLA = TC_CLKSEL_DIV1024_gc;
106106
#endif
107107
switch (V2Command)
108108
{

Projects/AVRISP-MKII/Lib/XPROG/XMEGANVM.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,8 +255,11 @@ bool XMEGANVM_ReadMemory(const uint32_t ReadAddress,
255255
{
256256
/* Send a LDS command with the read address to read out the requested byte */
257257
XPROGTarget_SendByte(PDI_CMD_LDS(PDI_DATASIZE_4BYTES, PDI_DATASIZE_1BYTE));
258+
258259
XMEGANVM_SendAddress(ReadAddress);
260+
259261
*(ReadBuffer++) = XPROGTarget_ReceiveByte();
262+
260263
}
261264

262265
return (TimeoutTicksRemaining > 0);

Projects/AVRISP-MKII/Lib/XPROG/XPROGTarget.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,7 @@ void XPROGTarget_SendByte(const uint8_t Byte)
216216
#elif (ARCH == ARCH_XMEGA)
217217
while(!(PDI_USART.STATUS & USART_DREIF_bm))
218218
;
219+
PDI_USART.STATUS |= USART_TXCIF_bm;
219220
PDI_USART.DATA = Byte;
220221
#endif
221222
}
@@ -236,7 +237,7 @@ uint8_t XPROGTarget_ReceiveByte(void)
236237
;
237238
return UDR1;
238239
#elif (ARCH == ARCH_XMEGA)
239-
while(!(PDI_USART.STATUS & USART_RXCIF_bm))
240+
while(!(PDI_USART.STATUS & USART_RXCIF_bm) && TimeoutTicksRemaining)
240241
;
241242
return PDI_USART.DATA;
242243
#endif

Projects/AVRISP-MKII/makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
# Run "make help" for target help.
1313

14-
MCU = atxmega128a4u
14+
MCU = atxmega256a3u
1515
ARCH = XMEGA
1616
BOARD = NONE
1717
F_CPU = 32000000

0 commit comments

Comments
 (0)