Added reliability patches to the AVRISP-MKII Clone project's ISP and PDI/TPI protocols (thanks to Justin Mattair).

pull/1469/head
Dean Camera 13 years ago
parent 6553bf5bfb
commit db73b11244

@ -68,6 +68,7 @@
* - Updated all host mode demos and projects to use the EVENT_USB_Host_DeviceEnumerationComplete() event callback for device configuration * - Updated all host mode demos and projects to use the EVENT_USB_Host_DeviceEnumerationComplete() event callback for device configuration
* instead of manual host state machine manipulations in the main application task * instead of manual host state machine manipulations in the main application task
* - Changed the reports in the GenericHID device demos to control the board LEDs, to reduce user confusion over the callback routines * - Changed the reports in the GenericHID device demos to control the board LEDs, to reduce user confusion over the callback routines
* - Added reliability patches to the AVRISP-MKII Clone project's ISP and PDI/TPI protocols (thanks to Justin Mattair)
* *
* <b>Fixed:</b> * <b>Fixed:</b>
* - Core: * - Core:

@ -69,10 +69,11 @@ void ISPProtocol_EnterISPMode(void)
ISPTarget_EnableTargetISP(); ISPTarget_EnableTargetISP();
ISPTarget_ChangeTargetResetLine(true); ISPTarget_ChangeTargetResetLine(true);
ISPProtocol_DelayMS(Enter_ISP_Params.PinStabDelayMS);
/* Continuously attempt to synchronize with the target until either the number of attempts specified /* Continuously attempt to synchronize with the target until either the number of attempts specified
* by the host has exceeded, or the the device sends back the expected response values */ * by the host has exceeded, or the the device sends back the expected response values */
while (Enter_ISP_Params.SynchLoops-- && (ResponseStatus != STATUS_CMD_OK) && !(TimeoutExpired)) while (Enter_ISP_Params.SynchLoops-- && !(TimeoutExpired))
{ {
uint8_t ResponseBytes[4]; uint8_t ResponseBytes[4];
@ -86,12 +87,14 @@ void ISPProtocol_EnterISPMode(void)
if (!(Enter_ISP_Params.PollIndex) || (ResponseBytes[Enter_ISP_Params.PollIndex - 1] == Enter_ISP_Params.PollValue)) if (!(Enter_ISP_Params.PollIndex) || (ResponseBytes[Enter_ISP_Params.PollIndex - 1] == Enter_ISP_Params.PollValue))
{ {
ResponseStatus = STATUS_CMD_OK; ResponseStatus = STATUS_CMD_OK;
break;
} }
else else
{ {
ISPTarget_ChangeTargetResetLine(false); ISPTarget_ChangeTargetResetLine(false);
ISPProtocol_DelayMS(Enter_ISP_Params.PinStabDelayMS); ISPProtocol_DelayMS(Enter_ISP_Params.PinStabDelayMS);
ISPTarget_ChangeTargetResetLine(true); ISPTarget_ChangeTargetResetLine(true);
ISPProtocol_DelayMS(Enter_ISP_Params.PinStabDelayMS);
} }
} }

@ -174,9 +174,14 @@ void XPROGTarget_SendIdle(void)
static void XPROGTarget_SetTxMode(void) static void XPROGTarget_SetTxMode(void)
{ {
/* Wait for a full cycle of the clock */ /* Need to do nothing for a full frame to send a BREAK - only one cycle should be needed, however
while (PIND & (1 << 5)); * there are reports that sometimes the interface will get stuck in some environments. */
while (!(PIND & (1 << 5))); for (uint8_t i = 0; i < BITS_IN_USART_FRAME; i++)
{
/* Wait for a full cycle of the clock */
while (PIND & (1 << 5));
while (!(PIND & (1 << 5)));
}
PORTD |= (1 << 3); PORTD |= (1 << 3);
DDRD |= (1 << 3); DDRD |= (1 << 3);

Loading…
Cancel
Save