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:
parent
66201a05e9
commit
33a46b243a
2 changed files with 6 additions and 6 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue