This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

hardware stack

hi,

i've some trouble after a firmware update procedure, some like a stack misalignment o something strange... i'm quite newby, working with 8051 family from 4 mounths. I try to explain the trouble, please forgive my bad english.

i'm using a Ds89C420 with 16kinternal flash, but my main application run from an external 29F040. When i want update this external flash, trhough a win application with a little protocol i write trough serial port some escape sequences, (i think is a quite std fashion). From the esternal flash i switch to internal changing ROMSIZE (that's is done reading carefully the ds89c420 manual specification for this particular register change) and then jump at address 0 of the internal flash. After that, from internal flash i rewrite the external flash in 512byte bloks. After the update is completed, i change again ROMSIZE and i perform a jump back in the external flash, and so the main application restart.

This procedure works quite fine, but at the restart ot the main updated application, the hardware stack seems in some way corrupted:

At the first call of a function like this:

unsigned char xdata * Int2Char(int param) {
static unsigned char cb[8];
....
return &cb[3]
}

the pointer value before and after return are:

before : x:8f6c
after : x:016c

And
Seems that after this software reboot the "return" for general pointers won't work anymore.

Every kind of help or redirection is very appreciated. Thanks Angelo

Parents
  • hi Daniel,

    many thanks for your reply.

    As you suggest, I've try to perform the watchdog reset but i still can't get the watchdog reset working... i've seen some samples on how to enable the watchdog but probably my micro model has some more sfr to set. Anyway i think is a great idea, since at the reset ROMSIZE switch back to 0K, to work with external flash as standard 8051. So i don't probably need to set it to 0 before the loop.
    I will search for a sample of ds89c420 watchdog reset.
    Infinite Thanks for now.
    Angelo

Reply
  • hi Daniel,

    many thanks for your reply.

    As you suggest, I've try to perform the watchdog reset but i still can't get the watchdog reset working... i've seen some samples on how to enable the watchdog but probably my micro model has some more sfr to set. Anyway i think is a great idea, since at the reset ROMSIZE switch back to 0K, to work with external flash as standard 8051. So i don't probably need to set it to 0 before the loop.
    I will search for a sample of ds89c420 watchdog reset.
    Infinite Thanks for now.
    Angelo

Children
No data