Ef(5). Flash verify operation failed.

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

Ef(5). Flash verify operation failed.

3,577件の閲覧回数
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by bkastel1 on Mon Jul 22 11:31:37 MST 2013
Hi,

I have a strange problem. Whenever I include IRQ handler rutine for GPIO (EINT1_IRQn - using port 1 pin 10) I get the above mentioned error and also this:

Nc: NXP: LPC1114/302  Part ID: 0x00000000
Pc: ( 65) Chip Setup Complete
Nt: Connected: was_reset=false. was_stopped=false
Cr:v Registered license, download limit of 128K
Pc: ( 70) License Check Complete
Nt: Loading ELF file 'Test_V1.axf' at location 00000000
Nt: Writing 5424 bytes to 0000 in Flash (assumed clock: 12.0MHz)
Pb: 1 of 1 (  0) Writing pages 0-1 at 0x00000000 with 5424 bytes
Ps: (  0) Page  0 at 00000000
Ps: (  0) Page  0 at 00000000: 4096 bytes
Wc: Verify of Flash failed at 00000000.
Pb: (100) Writing Flash ended with an error.
Ed:05: File 'Test_V1.axf' load failure: Ef(5). Flash verify operation failed.
Nc: nSRST assert (if available)
Nc: Executing in user flash.

Sometimes it also puts that the Verify of Flash failed at 000004, where Reset Vector is located. If I remove the function for IRQ handling (PIOINT1_IRQHandler) I can flash the file without any problems. Does anybody here have an idea what is wrong? I'm using Keil for writing code, I only use lpcxpresso for flashing.

Thanks
0 件の賞賛
返信
9 返答(返信)

3,492件の閲覧回数
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by bkastel1 on Thu Jul 25 13:20:46 MST 2013
Hi,

the config_pll_power() looks like this:

uint32_t config_pll_power(POWER_PROFILE *profile) {

#ifdef LPC11xxL
volatile uint32_t i;
#endif /* LPC11xx */

rom = (ROM **)0x1FFF1FF8;
/*
*1: Call set_power API routine to switch to default mode @ 50MHz
*2: Switch MAINCLKSEL to sys_pllclkin with AHBCLKDIV = 1 (12Mhz)
*3: Call set_pll API routine for the new freq
*4: Call set_power to the desired power mode
*/

/****Config set_power to default mode @ 50Mhz ****/
command[0] = 50;
command[1] = PARAM_DEFAULT;
command[2] = profile->current_system_clock / 1000000;
(*rom)->pPWRD->set_power(command, result);
/****************************************************/

/*Add the required delay after using set_power */
DELAY_SET_POWER;

if(result[0])
return result[0];

/****Required by the Power Profiles set_pll API ****/
/*Switch to the sys_pllclkin to the main clock */
LPC_SYSCON->MAINCLKSEL = 0x1;
LPC_SYSCON->MAINCLKUEN = 0x0;
LPC_SYSCON->MAINCLKUEN = 0x1;
/* Wait until updated */
while ( !(LPC_SYSCON->MAINCLKUEN & 0x01) );

/*Specify AHBCLKDIV = 1 */
LPC_SYSCON->SYSAHBCLKDIV = 1;
/******************************************************/

/****Update the POWER_PROFILE struct with the new system free of SYS_PLLCLKIN_FREQ ****/
profile->current_system_clock = SYS_PLLCLKIN_FREQ;

/****Call set_pll routine ****/
command[0] = profile->current_system_clock / 1000;//12000kHz from sys_pllclkin
command[1] = profile->new_system_clock / 1000;//New kHz freq
command[2] = CPU_FREQ_APPROX;                //Use CPU_FREQ_APPROX
command[3] = profile->new_system_clock / 1000000;   //Number of loop cycles to wait
(*rom)->pPWRD->set_pll(command, result);    //Apply new freq.
/********************************/

if(result[0])
return result[0];
else
/****Update the current_clock var with the new main clock freq ****/
profile->current_system_clock = result[1] * 1000;//result[1] is in kHz

/****Call the set_power routine ****/
command[0] = result[1] / 1000;//Current freq in MHz
command[1] = profile->power_mode;//Use the designated power mode
command[2] = 50;//Change the set_power from previous 50MHz to new mode
(*rom)->pPWRD->set_power(command, result);//Apply new power mode
/**************************************/

if(result[0])
return result[0];

return 0; //SUCCESS
}
0 件の賞賛
返信

3,492件の閲覧回数
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by lpcxpresso-support on Thu Jul 25 10:43:00 MST 2013
You mentioned you've lowered the clock rate. Can you post your code here?

EDIT: To be specific, the config_pll_power() code.
0 件の賞賛
返信

3,492件の閲覧回数
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by bkastel1 on Wed Jul 24 12:56:00 MST 2013
UPDATE: If I comment out this part of the code:

profile.new_system_clock     = 3000000UL;   //in HZ
profile.current_system_clock = 12000000UL;       //in Hz
profile.power_mode           = PARAM_EFFICIENCY;

if (config_pll_power(&profile)) {
SystemInit();
while(1);
} else {
SystemCoreClock = profile.current_system_clock;
}

SystemCoreClockUpdate();

I have no more problems with the flashing, I can use all IRQ's and also I can flash all example projects in lpcxpresso. So what did I do wrong then I was lowering clock? I need to do that because of the current consumption. Thanks
0 件の賞賛
返信

3,492件の閲覧回数
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by bkastel1 on Wed Jul 24 12:32:24 MST 2013
Hi,

first thanks for all the answers. I tested today Blinky example on another xpresso board I have and that didn't had my code on it and flashing is done without problems. Later I tested gain on the board that gave me problems (also full lpcxpresso board, not something I made) and I wasn't able to make Full erase - it reported an error about not being able to erase while core regs are active?? The only way to erase it was going into ISP mode. Then also this board was able to normally erase without ISP mode and flashing Blinky.axf on it. Up until I flashed my code again... Then again not possible to make full erase and/or flashing failed. So as soon as I tried flashing my own code I can do it only using Keil ULINK2 or thru serial bootloader but not using lpcxpresso. Here is the output after flashing:

Ni: LPCXpresso Debug Driver v5.2 (Jul  5 2013 11:31:21 - crt_emu_lpc11_13_nxp.exe build 15)
Pc: (  0) Reading remote configuration
Nc: Looked for chip XML file in C:/nxp/LPCXpresso_5.2.6_2137/lpcxpresso/bin/LPC1114/302.xml

Nc: Looked for vendor directory XML file in C:/nxp/LPCXpresso_5.2.6_2137/lpcxpresso/bin/nxp_directory.xml

Nc: Found generic directory XML file in C:/nxp/LPCXpresso_5.2.6_2137/lpcxpresso/bin/crt_directory.xml

Pc: (  5) Remote configuration complete
Pc: ( 30) Emulator Connected
Pc: ( 40) Debug Halt
Pc: ( 50) CPU ID
Nc: Emu(0): Conn&Reset. DpID:  BB11477. Info: HID64HS12
Nc: SWD Frequency: 250 KHz. RTCK: False. Vector catch: False.
Nc: Packet delay: 0  Poll delay: 0.
Nc: Loaded LPC11_12_13_32K_8K.cfx: LPC11_12_13 (32K Flash, min 8K RAM) Apr 22 2013 12:14:02  On-chip Flash Memory

Nc: NXP: LPC1114/302  Part ID: 0x00000000
Pc: ( 65) Chip Setup Complete
Nt: Connected: was_reset=false. was_stopped=true
Cr:v Registered license, download limit of 128K
Pc: ( 70) License Check Complete
Nt: Loading ELF file 'Lumu_V1.axf' at location 00000000
Nt: Writing 6296 bytes to 0000 in Flash (assumed clock: 12.0MHz)
Pb: 1 of 1 (  0) Writing pages 0-1 at 0x00000000 with 6296 bytes
Ps: (  0) Page  0 at 00000000
Ps: (  0) Page  0 at 00000000: 4096 bytes
Wc: Verify of Flash failed at 00000000.
Pb: (100) Writing Flash ended with an error.
Ed:05: File 'Lumu_V1.axf' load failure: Ef(5). Flash verify operation failed.
Nc: nSRST assert (if available)
Nc: Executing in user flash.

Then I did a mass erase and tried flashing Blinky again and no success. Only after going into ISP mode was I able to "regain" control over MCU and I was able to flash Blinky again. I tried using an lpcxpresso example to download (systick example) after I tried to flash my code with the Flash failed error  and the result was:

15: Target error from Commit Flash write
Flash verify operation failed.

I had to go into ISP mode again to be able to download axf file (it looks like that in ISP mode I get the part "back" into normal behavior). So does anybody have an idea what might cause the problem? I have a feeling that is has to do with interrupt handlers - in my project I'm using I2C handler, timer16_0 IRQ, SysTick and GPIO. One of this causes this issue. If I have only I2C and timer16 all is ok. When I added SysTick (executing SysTick_Config(RELOAD_LOW);) Flash failed. And SysTick is very simple:

volatile uint32_t TimerTick;

/*----------------------------------------------------------------------------
  SysTick IRQ: Executed periodically (10ms)
*----------------------------------------------------------------------------*/
void SysTick_Handler (void) {
  TimerTick++;
}

Commeting out SysTick solved the problem. I tried adding gpio IRQ (I'm using gpio irq to measure time interval between two events on the gpio) but again flashing failed. Like I can only use two IRQ's or something. GPIO IRQ is:

void PIOINT1_IRQHandler(void)
{
  uint32_t regVal;


  regVal = GPIOIntStatus(PORT1, 10);
 
  if (regVal)
  {
    if (!measureON) {                                                /* no running measurement             */
      enable_timer32(0);                                             /* start counting                     */
      measureON = 1;
    } else {                                                         /* we have running measurement        */
      disable_timer32(0);
      timerMeasurements[p1_10_counter] = LPC_TMR32B0->TC;            /* save current measurement           */
      p1_10_counter++;
      if (p1_10_counter == 8) {
        p1_10_counter = 0;
        if (120 < timerMeasurements[1] && timerMeasurements[3] < 150) {
          newSysTickVal = RELOAD_HIGH;
        } else if (180 < timerMeasurements[5] && timerMeasurements[7] < 230 ) {
          newSysTickVal = RELOAD_LOW;
        }
      }

      reset_timer32(0);
      measureON = 0;
    }
    GPIOIntClear(PORT1, 10);
  }
  return;
}

I'm using IRC for clock and then I also clock it down to 3MHz using:

profile.new_system_clock     = 3000000UL;       //in HZ
profile.current_system_clock = 12000000UL;       //in Hz
profile.power_mode           = PARAM_EFFICIENCY;

if (config_pll_power(&profile)) {
  SystemInit();
  while(1);
} else {
  SystemCoreClock = profile.current_system_clock;
}

SystemCoreClockUpdate();

to save power. Can these interfere with normal operation of the MCU? So for sure there is something wrong with my code and I have no clue what. Most probably something with interrupts but no idea what. Can somebody give me an advice?

Thanks for your valuable insights.
0 件の賞賛
返信

3,492件の閲覧回数
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by lpcxpresso-support on Wed Jul 24 00:48:04 MST 2013
I can repeatedly program your Blinky.axf files to an LPCXpresso11 board here using the GUI flash programmer without any problem at all here. I suspect that your image is not the problem ( though I don't see any LED blink, despite the file name).

Thus I suppose the question here is - are you using an unmodified LPCXpresso board (with its built in target MCU), or have you split the LPC-Link off and are programming a different board?

I would also suggest booting into ISP as suggested by "TheFallGuy"...

http://support.code-red-tech.com/CodeRedWiki/DebugAccessChip

If you are still having problems please:

1) Confirm the details of your board and debug probe.

2) Confirm whether you can build and debug an application all within the LPCXpresso IDE down to your board (ie import one of the standard examples).

3) Provide the "full" log output from the GUI flash programmer when your image fails to program (copy'n'paste the text out).

4) Confirm whether booting into ISP mode before programming helped.

Regards,

LPCXpresso Support

0 件の賞賛
返信

3,492件の閲覧回数
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by TheFallGuy on Tue Jul 23 13:48:07 MST 2013
Try ISP mode on your target before attempting to download flash. If that works it is definitely something in your code that is causing the problem. What is your interrupt handler doing? Perhaps you can post the code? (including any changes to the setup).
0 件の賞賛
返信

3,492件の閲覧回数
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by bkastel1 on Tue Jul 23 12:58:32 MST 2013
UPDATE: new version also reports the same problem. So this didn't solved the issue.
0 件の賞賛
返信

3,490件の閲覧回数
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by bkastel1 on Tue Jul 23 12:12:46 MST 2013
Hi,

currently I'm using v5.2.4 [Build 2122] [2013-04-29]. Will try downloading latest build and I will report back. Attached are axf and map file with pictures showing the issue. I'm using standard lpcxpresso board. I tried also mass erase and still the same problem. I also tried with simple Blinky from Keil (made for LPC1114/302 like it is on xpresso board - axf and map files in the attached zip) and also not ok. This is very strange.

0 件の賞賛
返信

3,490件の閲覧回数
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by lpcxpresso-support on Tue Jul 23 00:49:41 MST 2013
What version of LPCXpresso IDE are you using for flashing? Note that the latest version is v5.2.6 - if you aren't using this, please install and see if you see the same problem.

Are you programming a standard LPCXpresso1114 board, or is this a separated LPC-Link talking to your own board (or something else)?

It would be interesting to know whether, if you do a full mass erase before programming your image, do you still see the same error?

http://support.code-red-tech.com/CodeRedWiki/GuiFlashProgramming

Can you supply an image that shows up the problem, preferably with a corresponding map file generated by the linker?

Regards,
LPCXpresso Support
0 件の賞賛
返信