|
|
@ -216,10 +216,19 @@ bool XMEGANVM_WriteByteMemory(const uint8_t WriteCommand, const uint32_t WriteAd
|
|
|
|
XMEGANVM_SendNVMRegAddress(XMEGA_NVM_REG_CMD);
|
|
|
|
XMEGANVM_SendNVMRegAddress(XMEGA_NVM_REG_CMD);
|
|
|
|
XPROGTarget_SendByte(WriteCommand);
|
|
|
|
XPROGTarget_SendByte(WriteCommand);
|
|
|
|
|
|
|
|
|
|
|
|
/* Send new memory byte to the memory to the target */
|
|
|
|
/* Send new memory byte to the memory of the target */
|
|
|
|
XPROGTarget_SendByte(PDI_CMD_STS | (PDI_DATSIZE_4BYTES << 2));
|
|
|
|
XPROGTarget_SendByte(PDI_CMD_STS | (PDI_DATSIZE_4BYTES << 2));
|
|
|
|
XMEGANVM_SendAddress(WriteAddress);
|
|
|
|
XMEGANVM_SendAddress(WriteAddress);
|
|
|
|
XPROGTarget_SendByte(Byte);
|
|
|
|
XPROGTarget_SendByte(Byte);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Lock bytes need a special confirmation sequence for the write to complete */
|
|
|
|
|
|
|
|
if (WriteCommand == XMEGA_NVM_CMD_WRITELOCK)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
/* Set CMDEX bit in NVM CTRLA register to start the Lock Byte write sequence */
|
|
|
|
|
|
|
|
XPROGTarget_SendByte(PDI_CMD_STS | (PDI_DATSIZE_4BYTES << 2));
|
|
|
|
|
|
|
|
XMEGANVM_SendNVMRegAddress(XMEGA_NVM_REG_CTRLA);
|
|
|
|
|
|
|
|
XPROGTarget_SendByte(1 << 0);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|