Author Topic: P89V51 IAP routine crashes with interrupt routine  (Read 4870 times)

CodeGuy

  • Jr. Member
  • **
  • Posts: 3
    • View Profile
P89V51 IAP routine crashes with interrupt routine
« on: September 05, 2006, 04:02:02 am »
I have written IAP routines for data writing and reading in flash memory.  The routines work fine, it able to write to and read back the data from the internal flash rom.

My problem is when there is serial interrupt occurs, during the program access the IAP routine; the mcu execution will hang and never get back to the main ruotine again.

Can anyone show me how to avoid this problem.

Thanks in advance.

Je Gold

  • Full Member
  • ***
  • Posts: 135
    • View Profile
Re: P89V51 IAP routine crashes with interrupt routine
« Reply #1 on: September 05, 2006, 06:05:44 am »
This is probably not the forum for such a question as Flashmagic deals with ISP (in-system-programming)..Programming from the serial port etc.

Any way... when using IAP   - all events - such as interupts, watchdogs etc should be disbaled while IAP is active.

When the interupt occurs all crcitical registers are not saved on the stack  (unless you save them) etc...and so, a return from interupt has incorrect register values.

Also IAP may require critical timing of the flash programming parameters and your interupt routine has interupted this timing.


Highly recommend you dont interupt flash programming routines like IAP.

Joe

CodeGuy

  • Jr. Member
  • **
  • Posts: 3
    • View Profile
Re: P89V51 IAP routine crashes with interrupt routine
« Reply #2 on: September 06, 2006, 12:50:49 am »
Hi Joe,

Thanks for your help.

Sorry, I do not sure that which forum I should go to raise my IAP question. Came to this forum, hopefully could find helps from the experts like you.

Now I know interrupt is not an option to add to the routines with IAP access. I got to find another way to receive data from serial port, i have no idea how to receive serial data without using serial interrupt. Any idea?

Joe, do your mind telling me that what is the access time to write a byte to flash rom using IAP? I could get this information from datasheet.

Thank you,

Kelvin

Jan Waclawek

  • Full Member
  • ***
  • Posts: 220
    • View Profile
    • EFTON homepage
Re: P89V51 IAP routine crashes with interrupt routine
« Reply #3 on: September 06, 2006, 02:34:14 am »
CodeGuy wrote:

> Sorry, I do not sure that which forum I should go to raise my
> IAP question. Came to this forum, hopefully could find helps
> from the experts like you.

I'd recommend to move to 8052.com's Forum.

It would be nice to discuss it on Philips' (or, now rather NXP's) Forum, but that is ... ehm ... not too well functional...

> Joe, do your mind telling me that what is the access time to
> write a byte to flash rom using IAP? I could get this
> information from datasheet.

The Philips datasheet leaves a LOT of questions behind... I often use the apparently equivalent SST part datasheet which says 30ms for sector-erase and 50us for byte programming; plus the IAP software overhead (but it also says something on inverse proportionality on programming clock, with no further indication how does this apply to IAP) - however, there is no guarantee for this figures, Philips might have have manufactured different batches of the parts at different vendors... The definitive answer shall come from Philips (NXP).

A nice way would be to have a copy of your interrupt service routines in Block1, running properly during the programming. Again, the documentation provided by Philips (more precisely, the lack of it) prevents to do this properly.

Jan Waclawek

CodeGuy

  • Jr. Member
  • **
  • Posts: 3
    • View Profile
Re: P89V51 IAP routine crashes with interrupt routine
« Reply #4 on: September 07, 2006, 12:20:31 am »
Hi Jan,

Thanks for the help. My engineering works become easier with the helps from you guys.

I must admit that I really had the hard time to study philipps datasheet with all these grey area.

I will go to your suggested forum to further discuss my problem.

I'm using flash magic too, I will come back to this forum later ..

Kelvin