Reading bad instruction from RAM

Hi,

We use modul RCM 2200 (with flash memory SST 39SF020A) and DC9.21P. In our code we are using function EraseFlashSect from Flashwr.lib for erasing some sectors of FLASH. But erasing of some sectors (eg. 3th) does not work on some boards (now we have 3 such boards from 100 pieces). We debug problem carefully and find out that processor reads bad instruction from RAM.

More details:

  • we are deleting sector 2-4, in this sector is only our code
  • first calling of function EraseFlashSect works fine and sector 2 is erased
  • second calling of function EraseFlashSect could delete sector 3, but it does not work
    • we monitor the second calling of EraseFlashSect on logic analyzer
    • function EraseFlashSect is writing 6 byte command sequence to flash, but processor loads bad instruction from RAM after writing 4. byte (AAh to 5555h) to flash
      • there should be load instruction (see Flashwr.lib):
        ld a, (_FlashInfo+flashXPC)
        • so bytes 3AE8CB should be read
      • but first read byte is BAh instead 3A (MSB is 1 but should be 0)
      • and so next loaded instructions are of course bad too…
  • using analog oscilloscope we see that MSB is correct signal (no any hazardous signal)
  • other signals (RAM CS, RD, WR; FLASH CS, RD, WR) are correct too
  • we are not using wait states (… NUM_RAM_WAITST 0 , NUM_FLASH_WAITST 0 …)
  • power voltage is too OK
  • on data bus and address bus is not any our device

We really have no idea about this problem. It seems that it can be any problem in hardware. Eg. is there any possibility that ethernet controller RTL8019AS can damage data on data bus?

Can you please help us?