Flashing LPC802 with pyOcd

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Flashing LPC802 with pyOcd

463 Views
JeanMichel
Contributor I

Hello,

I'm working with an LPC802, using MCUXpresso IDE and some external scripts relying on PyOcd v0.34.3. I'm connecting to the LPC802 with an MCU-link probe connected through the SWD pins.

The program I've developped works fine when I'm flashing it from MCUXpresso, but doesn't work when flashed with pyOcd. I tried writting the most basic program with pyOcd, but it still fails to work properly. My program : 

 
options={"frequency": 1000000, "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()

I should just be able to write a single word  into flash.

After mass erase (pyocd erase --mass -t LPC802), running my script and using pyocd commander (pyocd commander -t LPC802 --connect=pre-reset) to check the value, i can see it's not written properly :

Connected to LPC802 [Halted]:
pyocd> read32 0x400
00000400: 50040a0a

After running my program a second time, the value is finally wirtten properly :

Connected to LPC802 [Halted]:
pyocd> read32 0x400
00000400: ddccbbaa

The intermediate value is not always the same. I'm facing the same issue with other LPC802. 

I tried different things, but now I'm clueless on how to keep investigating on this subject. I would really appreciate if you had any idea of what is going on here.

Thank you for your response.

0 Kudos
Reply
2 Replies

440 Views
EdwinHz
NXP TechSupport
NXP TechSupport

Hi @JeanMichel,

pyOCD is not a tool recommended or fully supported by NXP to be used on our MCUs. I highly recommend using MCUXpresso IDE instead.

That said, here's a thread that might be useful for your inquiry: How to flash a LPC1114 with pyocd or openocd using mcu-link probe? - NXP Community.

0 Kudos
Reply

419 Views
JeanMichel
Contributor I

Thank you for your response. I've already done all the setup part of making pyOcd and NXP probe/microcontrollers work together, as the scripts I'm using were working fine on other NXP microcontrollers (LPC55S06 and LPC824). I understand that NXP doesn't support pyOcd though, so I'll try to get support on the pyOcd community. 

0 Kudos
Reply