OPENOCD : timeout waiting for algorithm to complete [solved]

The story so far:

  1. Got Olimex ARM-USB-OCD working with OPENOCD under Linux.

  2. Developed PWM / Led blink code for LPC2119.

  3. Successfully managed to erase and download to flash using OPENOCD.

  4. Got debugging with Eclipse/gdb working a treat.

  5. Ported RTOS code + example to LPC2119.

  6. Tried downloading RTOS to flash using existing (successful) methods; failed with Openocd server reporting :

Error: armv4_5.c:591 armv4_5_run_algorithm(): timeout waiting for algorithm to complete, trying to halt target

Same error occurs when erasing flash.

  1. Tried hacking flash bank xtal frequencies to reflect xtal rather than pll freq’s. Tried every combination of power offs, resets/inits I could think of. No good.

  2. Went back to original PWM / Led blink code; now got same erase/write timeout errors with Openocd.

  3. Erased flash, and downloaded original PWM code to flash successfully using Philips LPC2000 serial utility. Runs fine.

  4. Tried debugging: Cannot access memory at address 0xfffffffb (this might be a red herring though).

  5. Stuck!

What is this “timeout waiting for algorithm to complete” business?

Any thoughts gratefully received!

[Edit] It’s necessary to do one or more hardware resets (reset run_and_halt) before several openocd commands (mdw, flash erase, flash write, lpc2000 part_id etc.) work correctly; they may seem to work but without the reset the results are incorrect and no warning is given via a telnet session or gdb.[/Edit]