We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
I am using the app note "AN029" and following the steps in the c8051f33x.pdf document regarding erasing the flash at 0x1a00. The lock byte has 0xFF in it. I am using the latest Cygnal drivers and the latest release of uVison2 (Keil). All conditions are met but the bank is not set to 0xFF? unsigned char xdata * pwrite; // pointer to FLASH used for writes //unsigned char xdata * idata pwrite; // pointer to FLASH used for writes // NOTE: this pointer must be located // in <data> or <idata> space! unsigned char *pread; // pointer to RAM used for reads //unsigned char code *preadCode; // pointer to FLASH used for reads char EA_save; // saves the current state of the ushort idata mySize; uchar idata myCheckSum = 0; PCA0MD &= 0xBF; // disable the watchdog: WDTE //pwrite = (unsigned char xdata *) 0x1DFF; //*pwrite = 0xFF; // interrupt enable bit. // disable watchdog timer //WDTCN = 0xde; //WDTCN = 0xad; ////////////////////////////////////////////////////////////// // PART A -- erase the FLASH page at SYSTEM_PARAMETERS address // initialize write/erase pointer pwrite = (unsigned char xdata *) SYSTEM_PARAMETERS; EA_save = EA; // save interrupt status EA = 0; // 1) disable interrupts (precautionary) PSCTL |= 0x02; // 2) Set the PSEE bit (register PSCTL). PSCTL |= 0x01; // 3) Set the PSWE bit (register PSCTL). FLKEY = 0xA5; // 4) Write the first key code to FLKEY: 0xA5. FLKEY = 0xF1; // 5) Write the second key code to FLKEY: 0xF1. PET_THE_DOG; *pwrite = 0xF5; // 6) Step 6. Using the MOVX instruction, write a data byte to any // location within the 512-byte page to be erased PET_THE_DOG; PSCTL = 0; // 7) Clear the PSWE and PSEE bits. // user software EA = EA_save; // re-enable interrupts