Skip to content

Flashing an LPC802 #1826

@valesync

Description

@valesync

Hello

I'm working with an LPC802 with pyOcd v0.34.3. I'm developping with MCUXpresso and using pyOcd for flashing. I've used the same pyOcd scripts with other microcontrollers (LPC824, LPC55S06) without any problems, but somehow things are going wrong with the LPC802. At this point all I want to do is make this very basic script work :

options={"frequency": 100000, "target_override": "LPC802", "hide_programming_progress": False}
with ConnectHelper.session_with_chosen_probe(options=options) as session:
target = session.board.target
  	target.reset_and_halt()
  
  	loader = FlashLoader(session, chip_erase="chip")
  	loader.add_data(0x400, [0xAA,0xBB,0xCC,0xDD])
  	loader.commit()

Just writing a single 32 bits word on flash. So i run a mass erase (pyocd erase --mass -t LPC802), run my script, then connect with commander (pyocd commander -t LPC802 --connect=pre-reset then read32 0x400 to check the value in flash and get wrong values, like 0x554cfbaa. But running my script a second time the right value is finally written. It feels like some of the bits were written, but not all of them. The intermediate value is not always the same, like trying this a second time I get the intermediate value 0x55ccabaa.

Here are the things I tried to investigate :

  • I've seen the same behaviour on a different LPC802. The one I'm using is flashed properly when using MCUXpresso IDE.
  • When I run a mass erase the flash is erased from 0x200 to 0x3f80, which looks ok to me (under 0x200 are specific values used by the microcontroller and over 0x3f80 is whatever, I guess). It's erased with 0x00, not with 0xFF, but I don't think it should matter ?
  • I tried upgrading pyocd to 0.37, but this version doesn't seem to like LPC. 0.34.3 worked with the LPC824 and LPC55S06 so I stick with it.
  • I tried reducing the frequency, it doesn't change anything.

At this point I don't know if something's wrong with the way I'm interacting with my microcontroller, or if something's wrong with pyOcd. Any help would be really appreciated, thank you for your responses.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions