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.
Hi,
I need help. I'm using the IAP, secondary bootloader. I'm having a problem erasing sectors. When I try to erase a sector, it hangs at function "iap_entry(command, result)" in erase function.
It passes through Prepare function successfully.
The code:
#define IAP_LOCATION 0x7FFFFFF1 #define IAP_CLK 48000000 #define AP_ADDR 0x10000// where the user app located typedef void (*FP)(void);/* run the user application from pre-specified address*/ #define iap_entry(a, b) ((void (*)())(IAP_LOCATION))(a, b) unsigned long command[5]; unsigned long result[3];
The ERASE FUNCTION:
unsigned long IAP_EraseSec (unsigned long StartSecNum, unsigned long EndSecNum) { if (EndSecNum < StartSecNum) return IAP_STA_INVALD_PARAM; command[0] = IAP_CMD_EraseSec; command[1] = StartSecNum; command[2] = EndSecNum; command[3] = IAP_CLK / 1000; _printf("\r\n*******ERASE3************"); iap_entry(command, result); _printf("\r\n*******ERASE4************"); return result[0]; }
The PREPARE FUNCTION:(that one works ok)
unsigned long IAP_PrepareSec (unsigned long StartSecNum, unsigned long EndSecNum) { if (EndSecNum < StartSecNum) return IAP_STA_INVALD_PARAM; command[0] = IAP_CMD_EraseSec; command[1] = StartSecNum; command[2] = EndSecNum; command[3] = IAP_CLK / 1000; _printf("\r\n*******ERASE3************"); iap_entry(command, result); _printf("\r\n*******ERASE4************"); return result[0]; }
Can anyone help me?
thanks
Yeah.. I've already tried that way, but also without success...
One weird thing I discover is: In the 3rd parameter of ERASE command, "System Clock Frequency in kHz", when cclk = 24000 (24MHz) the program stops..
But when I put a really small value in this parameter, like cclk=24. The program doesn't stop but also doesn't erase the sectors...
What should be de cfgs of IRAM1 and IRAM2 for the sec bootloader code?
At the moment the Secondary Bootloader share the same config of User code Both code are configured : IRAM1 = 0x40000040 Size: 0x8000 IRAM2 = 0x7FD00000 Size: 0x2000
... since you have not seen fit to reveal which chip.
sector erase is very chip dependent. And I do not recognize your IRAM settings matching any chip I know
Erik
Sorry.. It is LPC2368.