LPC54113 IAP strange behavior ( Hangs )

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

LPC54113 IAP strange behavior ( Hangs )

Jump to solution
640 Views
andreasruetten
Contributor III

Hello,
my program hangs if i use IAP commands ...
But only without debugger. Without Debugger it hangs, and never comes back again

Clock is 120Mhz

MCUXpresso 11.8.1

Debugger j-link

Code :

unsigned int lpc5410x_prepare_sector(unsigned int sector)

{

unsigned int command[COMMAND_LENGTH];

unsigned int result[RESULT_LENGTH];

iap iap_entry = (iap) IAP_LOCATION;

command[0] = COMMAND_PREPARE;

command[1] = sector;

command[2] = sector;

(*iap_entry)(command, result);

printf("The result of prepared sector number (%d) is %d", sector, result[0]);

return result[0];

}

 

Called from :

int SaveEepromVal(uint32_t Val)

{

uint8_t Data[256];

 

Data[0] = (uint8_t) (Val & 0xff);

Val = Val >> 8;

Data[1] = (uint8_t) (Val & 0xff);

Val = Val >> 8;

Data[2] = (uint8_t) (Val & 0xff);

Val = Val >> 8;

Data[3] = (uint8_t) (Val & 0xff);

 

__disable_irq();

 

Blink() ;

 

 

Val = lpc5410x_prepare_sector(7);

 

 

Val = lpc5410x_erase_sector(7);

 

Val = lpc5410x_prepare_sector(7);

 

Val = lpc5410x_program_sector( BOOT_VAL_ADDR, &Data, 256);

 

__enable_irq();

 

return 0;

}

 

Any Ideas, what the difference with segger j.link and without?

Andreas

 

 

0 Kudos
Reply
1 Solution
620 Views
andreasruetten
Contributor III

Hello,
i found my problem by myself...
It was the printf which causes the crash...
Andreas

View solution in original post

0 Kudos
Reply
2 Replies
623 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello @andreasruetten 

 

Without a debugger, which way to communicate with the device for programming purpose?Please present all the specific steps involved.

 

BR

Alice

0 Kudos
Reply
621 Views
andreasruetten
Contributor III

Hello,
i found my problem by myself...
It was the printf which causes the crash...
Andreas

0 Kudos
Reply
%3CLINGO-SUB%20id%3D%22lingo-sub-2079419%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3ELPC54113%20IAP%20strange%20behavior%20(%20Hangs%20)%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2079419%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHello%2C%3CBR%20%2F%3Emy%20program%20hangs%20if%20i%20use%20IAP%20commands%20...%3CBR%20%2F%3EBut%20only%20%3CEM%3E%3CSTRONG%3Ewithout%3C%2FSTRONG%3E%3C%2FEM%3E%20debugger.%20Without%20Debugger%20it%20hangs%2C%20and%20never%20comes%20back%20again%3C%2FP%3E%3CP%3EClock%20is%20120Mhz%3C%2FP%3E%3CP%3EMCUXpresso%2011.8.1%3C%2FP%3E%3CP%3EDebugger%20j-link%3C%2FP%3E%3CP%3ECode%20%3A%3C%2FP%3E%3CDIV%3E%3CDIV%3E%3CP%3E%3CSPAN%3Eunsigned%3C%2FSPAN%3E%20%3CSPAN%3Eint%3C%2FSPAN%3E%20%3CSPAN%3Elpc5410x_prepare_sector%3C%2FSPAN%3E%3CSPAN%3E(%3C%2FSPAN%3E%3CSPAN%3Eunsigned%3C%2FSPAN%3E%20%3CSPAN%3Eint%3C%2FSPAN%3E%3CSPAN%3E%20sector)%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3E%7B%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3Eunsigned%3C%2FSPAN%3E%20%3CSPAN%3Eint%3C%2FSPAN%3E%3CSPAN%3E%20command%5BCOMMAND_LENGTH%5D%3B%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3Eunsigned%3C%2FSPAN%3E%20%3CSPAN%3Eint%3C%2FSPAN%3E%3CSPAN%3E%20result%5BRESULT_LENGTH%5D%3B%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3Eiap%3C%2FSPAN%3E%3CSPAN%3E%20iap_entry%20%3D%20(%3C%2FSPAN%3E%3CSPAN%3Eiap%3C%2FSPAN%3E%3CSPAN%3E)%20IAP_LOCATION%3B%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3Ecommand%5B0%5D%20%3D%20COMMAND_PREPARE%3B%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3Ecommand%5B1%5D%20%3D%20sector%3B%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3Ecommand%5B2%5D%20%3D%20sector%3B%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3E(*iap_entry)(command%2C%20result)%3B%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3Eprintf%3C%2FSPAN%3E%3CSPAN%3E(%3C%2FSPAN%3E%3CSPAN%3E%22The%20result%20of%20prepared%20sector%20number%20(%25d)%20is%20%25d%22%3C%2FSPAN%3E%3CSPAN%3E%2C%20sector%2C%20result%5B0%5D)%3B%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3Ereturn%3C%2FSPAN%3E%3CSPAN%3E%20result%5B0%5D%3B%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3E%7D%3C%2FSPAN%3E%3C%2FP%3E%3CBR%20%2F%3E%3CP%3ECalled%20from%20%3A%3C%2FP%3E%3CDIV%3E%3CDIV%3E%3CP%3E%3CSPAN%3Eint%3C%2FSPAN%3E%20%3CSPAN%3ESaveEepromVal%3C%2FSPAN%3E%3CSPAN%3E(%3C%2FSPAN%3E%3CSPAN%3Euint32_t%3C%2FSPAN%3E%3CSPAN%3E%20Val)%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3E%7B%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3Euint8_t%3C%2FSPAN%3E%3CSPAN%3E%20Data%5B256%5D%3B%3C%2FSPAN%3E%3C%2FP%3E%3CBR%20%2F%3E%3CP%3E%3CSPAN%3EData%5B0%5D%20%3D%20(%3C%2FSPAN%3E%3CSPAN%3Euint8_t%3C%2FSPAN%3E%3CSPAN%3E)%20(Val%20%26amp%3B%200xff)%3B%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3EVal%20%3D%20Val%20%26gt%3B%26gt%3B%208%3B%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3EData%5B1%5D%20%3D%20(%3C%2FSPAN%3E%3CSPAN%3Euint8_t%3C%2FSPAN%3E%3CSPAN%3E)%20(Val%20%26amp%3B%200xff)%3B%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3EVal%20%3D%20Val%20%26gt%3B%26gt%3B%208%3B%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3EData%5B2%5D%20%3D%20(%3C%2FSPAN%3E%3CSPAN%3Euint8_t%3C%2FSPAN%3E%3CSPAN%3E)%20(Val%20%26amp%3B%200xff)%3B%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3EVal%20%3D%20Val%20%26gt%3B%26gt%3B%208%3B%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3EData%5B3%5D%20%3D%20(%3C%2FSPAN%3E%3CSPAN%3Euint8_t%3C%2FSPAN%3E%3CSPAN%3E)%20(Val%20%26amp%3B%200xff)%3B%3C%2FSPAN%3E%3C%2FP%3E%3CBR%20%2F%3E%3CP%3E%3CSPAN%3E__disable_irq()%3B%3C%2FSPAN%3E%3C%2FP%3E%3CBR%20%2F%3E%3CP%3E%3CSPAN%3EBlink()%20%3B%3C%2FSPAN%3E%3C%2FP%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CP%3E%3CSPAN%3EVal%20%3D%20lpc5410x_prepare_sector(7)%3B%3C%2FSPAN%3E%3C%2FP%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CP%3E%3CSPAN%3EVal%20%3D%20lpc5410x_erase_sector(7)%3B%3C%2FSPAN%3E%3C%2FP%3E%3CBR%20%2F%3E%3CP%3E%3CSPAN%3EVal%20%3D%20lpc5410x_prepare_sector(7)%3B%3C%2FSPAN%3E%3C%2FP%3E%3CBR%20%2F%3E%3CP%3E%3CSPAN%3EVal%20%3D%20lpc5410x_program_sector(%20BOOT_VAL_ADDR%2C%20%26amp%3BData%2C%20256)%3B%3C%2FSPAN%3E%3C%2FP%3E%3CBR%20%2F%3E%3CP%3E%3CSPAN%3E__enable_irq()%3B%3C%2FSPAN%3E%3C%2FP%3E%3CBR%20%2F%3E%3CP%3E%3CSPAN%3Ereturn%3C%2FSPAN%3E%3CSPAN%3E%200%3B%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3E%7D%3C%2FSPAN%3E%3C%2FP%3E%3CBR%20%2F%3E%3CP%3E%3CSPAN%3EAny%20Ideas%2C%20what%20the%20difference%20with%20segger%20j.link%20and%20without%3F%3CBR%20%2F%3E%3CBR%20%2F%3EAndreas%3C%2FSPAN%3E%3C%2FP%3E%3C%2FDIV%3E%3C%2FDIV%3E%3C%2FDIV%3E%3C%2FDIV%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2079776%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3ERe%3A%20LPC54113%20IAP%20strange%20behavior%20(%20Hangs%20)%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2079776%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHello%2C%3CBR%20%2F%3Ei%20found%20my%20problem%20by%20myself...%3CBR%20%2F%3EIt%20was%20the%20printf%20which%20causes%20the%20crash...%3CBR%20%2F%3EAndreas%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2079773%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3ERe%3A%20LPC54113%20IAP%20strange%20behavior%20(%20Hangs%20)%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2079773%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHello%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F122063%22%20target%3D%22_blank%22%3E%40andreasruetten%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CBR%20%2F%3E%0A%3CP%3E%3CSPAN%3EWithout%20a%20debugger%2C%20which%20way%20to%20communicate%20with%20the%20device%20for%20programming%20purpose%3FPlease%20present%20all%20the%20specific%20steps%20involved.%3C%2FSPAN%3E%3C%2FP%3E%0A%3CBR%20%2F%3E%0A%3CP%3E%3CSPAN%3EBR%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%3EAlice%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E