Hello
I Have developed a small simple set of functions to use the IAP services. All the IAP functions work as long as I do not start the OS. Once I start the OS All functions work except for erase. The erase actually happens but the call does not return properly. When I stop the cpu it is sometimes in the Dabt vector. I can step or run over all other functions except erase. I am using IDISABLE and IENABLE around the call. Using latest library and IDE. Has anyone heard of such a problem ?
LOL. I just managed to do that yesterday, before I noted that my app was linked with the wrong scatter file. There was no hole available in the binary to store my configuration in :)
LOL Nope, but you had me checking anyway. I've tried many different sectors but my favorites are 7,13. It's kind of strange I can even single step int the bootrom but I just never return once I continue for an erase.
Also my code is very small only the first task is running, os_sys_init(init) only, I've tried doing erase from one more small task but the results are the same.
OK - More obvious questions :-
Stack - do you have enough for the IAP code to use ?
RAM - I believe the IAP code reserves some locations near the top of RAM. Have you checked that your application (or OS) isn't using it ? This shouldn't prevent a return from the IAP call, but may result in corruption.
Timing - Check carefully the timing parameter for the IAP call. I screwed this up once and had major problems with IAP. If I recall, I was specifying 12000000 when I should have specified 12000 ! i.e. It expects KHx, not Hz !!!
David
Stack - Had enough RAM - Had enough Timing - was in kHz
But I got it working at least for the time being. I ended up doing this.........
//read enabled interrupts ihold = VICIntEnable;
//clear the enabled bits VICIntEnClr = ihold;
//enter boot rom iap_entry (command, result);
//restore interrupts after return VICIntEnable = ihold;
Seems timer0 was still interrupt enabled. I did read somewhere that just disabling main interupts doesn't stop them from happening, and that they need to be disabled in the vic. Is something like this done in the Keil FlashFS that we can't see ? Maybe this should be added to docs for NXP LPC internal flash use.
Thanks for the moral support !
Hi Michael,
Glad to hear you got it working.
It shouldn't be neccessary (but also shouldn't cause any harm) to disable the interrupt sources at the VIC.
When I use the IAP functions, I just make sure that IRQ & FIQ are masked (and restored afterwards !). This has worked for me without problems. I'm not using an OS, but that really shouldn't be a factor (unless, of course, the OS has some critical timing requirements that can't be met while the IAP functions are running).
Disabling IRQ & FIQ doesn't stop the interrupt sources signalling - it just stops them from getting through to the CPU. Depending on how your interrupt system is configured, any pending interrupts may be called as soon as you re-enable IRQ & FIQ.
Out of interest, which OS are you using ?
I'm using the KEIL RL-RTX. It looks alot like from what i remember as CMX's RTXC along time ago.
Thanks again