writing flash of KEAZN64 M0+ device via SWD

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

writing flash of KEAZN64 M0+ device via SWD

1,242 Views
danielrickers
Contributor II
Hello,

I want to flash a KEAZN64 M0+ device via SWD. This should be realized by a host processor instead of a programmer so I have to implement the host code.

The protocol basics are working and I'm already able to write and verify data in the RAM via AHB-AP but not yet into flash.

To do that I have to erase the flash first, but what is the correct sequence?

I use an appnote from another vendor AN0062 link as base and try to adapt it to the NXP KEA M0+ target.

I chose the simple variant (direct write to msc registers) without a flash driver that is loaded into the target RAM to keep it as simple as possible.

I traces the communication between the KEAZN64 and a programmer (PE Micro universal FX) but it’s hard to find the correct sequence part for erase and flash.

Maybe you can help me?

Thanks a lot

Daniel

Labels (1)
Tags (3)
4 Replies

1,031 Views
Alexis_A
NXP TechSupport
NXP TechSupport

Hi Daniel,

Please check the KEA64 Sub-Family Reference Manual section:

18.3.4.2 Command write sequence

This section explain the sequence to program the flash.

Best Regards,

Alexis Andalon

1,031 Views
danielrickers
Contributor II

Hej Alexis ,

thanks a lot for the answer.

Do I have to halt or reset the controller before I make the full erase?

Thanks

Daniel

0 Kudos
Reply

1,031 Views
Alexis_A
NXP TechSupport
NXP TechSupport

Hi Daniel,

If you already execute the SWD sequence to enable the comunication, it doesn't need it..

Best Regards,

Alexis Andalon

1,031 Views
danielrickers
Contributor II

Hi Alexis ,

thanks a lot. the description helps to create a flash sequence.

the problem no is that I always get a ACK_WAIT when I try to access the FTMRH registers

Do I need other AP settings?

thanks a lot

Daniel

Request  AccessPort Write CSW
Turnaround
ACK OK
Turnaround
WData 0x22000012 reg CSW bits DbgSwEnable=0
Data parityok
Trailing bits
Request  AccessPort Write TAR
Turnaround
ACK OK
Turnaround
WData 0x40020000 reg TAR
Data parityok
Trailing bits
Request  AccessPort Read DRW
Turnaround
ACK OK
WData 0x00000000 reg DRW
Data parityok
Request  DebugPort Read RDBUFF
Turnaround
ACK WAIT
Request  DebugPort Read RDBUFF
Turnaround
ACK WAIT
Request  DebugPort Read RDBUFF
Turnaround
ACK WAIT
Request  DebugPort Read RDBUFF
Turnaround
ACK WAIT
Request  DebugPort Read RDBUFF
Turnaround
ACK WAIT
0 Kudos
Reply