verify PFlash_Program()

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

verify PFlash_Program()

802 Views
tafengchung
Contributor II

How can i verify flash program?

I use this PFlash_Program() function to program s12xep100

But, I can't see any change in memory windows.

Tags (1)
0 Kudos
Reply
2 Replies

672 Views
ZhangJennie
NXP TechSupport
NXP TechSupport

Hi tafeng,

when you launch debugger, click "Hotsync" button in P&E connection manager for each target connection.

The Hotsync button in the Connection Assistant allows the user to connect to an already running target. thus you can check the debugger memory window, if your flash is successful programmed.

pastedImage_1.png


Have a great day,
Jennie Zhang

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos
Reply

672 Views
tafengchung
Contributor II

1) flash_program()

2) flash_Verfy

/******************************************************************************/
#pragma CODE_SEG RAM_CODE

unsigned char PFlash_Program(unsigned long address, unsigned short *ptr)
{
  unsigned char i;
  while((FSTAT & FSTAT_CCIF_MASK) == 0);  //wait if command in progress
   FSTAT = 0x30;       //clear ACCERR and PVIOL
  FCCOBIX = 0x00;
  FCCOB = 0x0600 | ((address & 0x007F0000)>>16);
  FCCOBIX = 0x01;
  FCCOB = (address & 0x0000FFFF);
  for(i=2; i<6; i++)  
  {
    FCCOBIX = i;
    FCCOB = 0xAA;
  }
 
  FSTAT = 0x80;       //launch command
  while((FSTAT & FSTAT_CCIF_MASK) == 0);  //wait for done
 
  if((FSTAT & (FSTAT_ACCERR_MASK | FSTAT_FPVIOL_MASK)) != 0)
    return FlashProgramError;
  else
    return noErr;
}
#pragma CODE_SEG DEFAULT   

/******************************************************************************/

uint8_t FLASH_Read_Byte(uint8_t * Address)
{

    return (*Address);
}

0 Kudos
Reply