Alex Dowad

Branches don't work after erasing flash in simulator!

Discussion created by Alex Dowad on Jan 29, 2009
Latest reply on Feb 1, 2009 by Alex Dowad
Hi everyone,

I am writing an embedded application for the MC9S08SH8. I want to use one page of FLASH memory for non-volatile storage of user settings. I have allocated a 512-byte constant block starting at E030 (the beginning of a FLASH page). However, when I erase this page of FLASH in the simulator, the MCU suddenly ignores all branches, breezing past them and executing data.

The instruction summary says this about BRA:

BRA rel -- Branch Always (if I = 1)

I have tried turning I on, off, off and on, on and off, but whatever I do, branches don't work after erasing FLASH.

I am using the FlashErase1 routine from page 60 of the HCS08 Family Reference Manual. Any input would be much appreciated.

Alex Dowad