PDI NVM enable is fast enough that bare polling is enough without a fixed delay in between each attempt. Make sure the USART transmitter is enabled explicitly when the USART is configured, so that repeated attempts to re-enter PDI mode don't fail due to TXEN not being set.
This commit is contained in:
@@ -115,11 +115,9 @@ static void PDIProtocol_EnterXPROGMode(void)
|
||||
PDITarget_SendByte(PDI_NVMENABLE_KEY[i - 1]);
|
||||
|
||||
/* Poll the STATUS register to check to see if NVM access has been enabled */
|
||||
uint8_t NVMAttemptsRemaining = 150;
|
||||
uint8_t NVMAttemptsRemaining = 255;
|
||||
while (NVMAttemptsRemaining)
|
||||
{
|
||||
_delay_ms(1);
|
||||
|
||||
PDITarget_SendByte(PDI_CMD_LDCS | PD_STATUS_REG);
|
||||
if (PDITarget_ReceiveByte() & PDI_STATUS_NVM)
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user