Still waiting for your marketing department to send an NDA so that we can see the library source code. We cannot use the F021 Library for certification reasons.
I am trying to erase a FLASH sector and I get a PCV error. Do I need to precondition the FLASH somehow? Am I accessing the UNDOCUMENTED FsmSector register correctly?
Test call:
CpfSelectFlashBank(1); // Verified: FMAC == 1
CpfEraseSector(1, 0); // FAILS: PCV == 1
static void CpfEraseSector(UINT32 uBankNum, UINT32 uSectorNum)
{
ASSERT(uBankNum==1)
while (CpfIsBankBusy(uBankNum)); // TODO: add timeout
// Set FBSE - 1's = sector enabled for Wr/Erase
// ------------------------------------------------
cpfL2F -> Fbprot.u32Register = 1; // Enable FBSE access
cpfL2F -> Fbse.u32Register = (UINT32)0xFFFF; // Enable all sectors
cpfL2F -> Fbprot.u32Register = 0; // Disable FBSE access
CpfClearStatus();
// Set Write enable to sector to be erased only
// ----------------------------------------------------------
cpfL2F -> FsmWrEna.u32Register = 5; // Enables access to FSM_SECTOR
UINT32 uMask = ~(0x10000<<uSectorNum);
cpfL2F -> FsmSector.u32Register = uMask; // UNDOCUMENTED REGISTER: High bits seem to map to FSM_SECTOR1
cpfL2F -> FsmWrEna.u32Register = 0; // Disables access to FSM_SECTOR
// Set address register to any within sector
cpfL2F -> Faddr.u32Register = (0x00200000 * uBankNum) + 0x20000 * uSectorNum;
CpfSetCmd(F021Cmd_EraseSector); // COMMAND = ERASE_SECTOR
CpfExecute(); // GO
}
Regards,
Mark Samarin
AFuzion, Inc.
