\r
/* Set up the synchronous USART for XMEGA communications - \r
8 data bits, even parity, 2 stop bits */\r
- UBRR1 = (F_CPU / 1000000UL);\r
+ UBRR1 = (F_CPU / 500000UL);\r
UCSR1B = (1 << TXEN1);\r
UCSR1C = (1 << UMSEL10) | (1 << UPM11) | (1 << USBS1) | (1 << UCSZ11) | (1 << UCSZ10) | (1 << UCPOL1);\r
#else\r
\r
/* Set up the synchronous USART for XMEGA communications - \r
8 data bits, even parity, 2 stop bits */\r
- UBRR1 = (F_CPU / 1000000UL);\r
+ UBRR1 = (F_CPU / 500000UL);\r
UCSR1B = (1 << TXEN1);\r
UCSR1C = (1 << UMSEL10) | (1 << UPM11) | (1 << USBS1) | (1 << UCSZ11) | (1 << UCSZ10) | (1 << UCPOL1);\r
#else\r
/** Disables the target's PDI interface, exits programming mode and starts the target's application. */\r
void XPROGTarget_DisableTargetPDI(void)\r
{\r
+ /* Switch to Rx mode to ensure that all pending transmissions are complete */\r
+ XPROGTarget_SetRxMode();\r
+\r
#if defined(XPROG_VIA_HARDWARE_USART)\r
/* Turn off receiver and transmitter of the USART, clear settings */\r
UCSR1A |= (1 << TXC1) | (1 << RXC1);\r
/** Disables the target's TPI interface, exits programming mode and starts the target's application. */\r
void XPROGTarget_DisableTargetTPI(void)\r
{\r
+ /* Switch to Rx mode to ensure that all pending transmissions are complete */\r
+ XPROGTarget_SetRxMode();\r
+\r
#if defined(XPROG_VIA_HARDWARE_USART)\r
/* Turn off receiver and transmitter of the USART, clear settings */\r
UCSR1A |= (1 << TXC1) | (1 << RXC1);\r