Hi,
I was looking at the bootloader protection, you don't need that 2nd check. The first one catches both erase and write operations in the bootloader area.
Instead of bra vfail you could add a new response:
.equ BLPROT, 'P' /*bl protection tripped*/
;bra vfail ;Main ;fail silently
SendL BLPROT
bra main1
Here's the changed code that goes into c# engine to handle the new bl protection response. I will include this in the next official release.
public const char cBlProtTrip = 'P';
//---------------------------------------------------------------------
// ProcessWriteResponse()
//---------------------------------------------------------------------
static private void ProcessWriteResponse( clsSerialPort pobjPort, ref int piRetries, int piTabLevel, string pstrWriteType, ref bool pbRetry, ref bool pbResult )
{
int iResponse = -1;
pbResult = false;
// Get response
bool bGetResponseResult = false;
iResponse = GetResponse( pobjPort, ref bGetResponseResult );
if ( bGetResponseResult == false ) {
return;
}
// Check response
if ( iResponse != cOK ) {
if ( ++piRetries == 3 ) {
OnDownloading( new clsDownloadingEventArgs(clsDownloadingEventArgs.EventType.error, "download failed", -1) );
return;
} else {
if ( iResponse == cChecksumErr ) {
OnDownloading( new clsDownloadingEventArgs(clsDownloadingEventArgs.EventType.error, "checksum error," + piRetries.ToString() + " try", -1) );
pbRetry = true;
} else if ( iResponse == cVerifyErr ) {
OnDownloading( new clsDownloadingEventArgs(clsDownloadingEventArgs.EventType.error, "verify error," + piRetries.ToString() + " try", -1) );
pbRetry = true;
} else if ( iResponse == cBlProtTrip ) {
OnDownloading( new clsDownloadingEventArgs(clsDownloadingEventArgs.EventType.error, "bl protection tripped", -1) );
pbRetry = false;
return;
} else {
OnDownloading( new clsDownloadingEventArgs(clsDownloadingEventArgs.EventType.error, "unknown response," + piRetries.ToString() + " try", -1) );
pbRetry = true;
}
OnDownloading( new clsDownloadingEventArgs(clsDownloadingEventArgs.EventType.info, "Writing flash...", piTabLevel) );
}
} else {
pbRetry = false;
}
pbResult = true;
}// ProcessWriteResponse()