Dear Friends,
Hello,
I want to read/write flash memory of lpc1752. But it was not working So i tried to read the part id. But when i debug my code in keil uvision4 my code stuck in HardFault_Handler here is my code :
typedef void (*IAP)(unsigned long [],unsigned long[]); IAP iap_entry; IAP iap_entry = (IAP) IAP_LOCATION; unsigned long iap_read_part_id(void) { unsigned long command[5]; unsigned long result[5]; command[0] = 54; iap_entry(command,result); printf("result = %X\r\n",result[1]); return result[1]; }
Please help me to find out why HardFault_Handler occurs and how to resolve this problem Thank You ...
What's the value for IAP_LOCATION, better be ODD?
IAP_LOCATION is 0x1FFF1FF1UL as mentioned in the user manual
the code which i posted in my 1 post I tried it on my board and it worked.
Now my question is why it got stuck in HardFault_Handler while debugging.
Is this exception depends on hardware????
Debugging in the simulator or debugging on the real hardware?
If in the simulator: Does the simulator actually contain a copy of the NXP boot loader that performs all IAP actions?
Debugging in Simulator.
Q:Does the simulator actually contain a copy of the NXP boot loader that performs all IAP actions? A: I am using keil uvision4, but I am not sure whether it has the copy of the NXP boot loader or not.
How do I check that??? And if it does not have copy of the NXP boot loader then what should I do??? Do I need to install any other version of Keil?? or need to Install extra packages???
Well, it was just my guess/assumption that Keil only simulate the chip based on the hardware documentation available, and not based on secret firmware code written by the chip manufactuer.
If your simulator doesn't have any NXP IAP firmware then no other Keil simulator has it either.
What to do? Use a real chip. Only a real chip is guaranteed to perform 100% as a real chip...
To : Per Westermark
I understood your point and agree with it.
I am testing my code on hardware since afternoon which is working on hardware.
Now I am able to write into flash memory :)
Thank You Westonsupermare Pier and Per Westermark for your help.