"Edit MCU" done wrong results in "Wire ACK Fault in DAP access" when programming

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

"Edit MCU" done wrong results in "Wire ACK Fault in DAP access" when programming

1,134 Views
danielholala
Senior Contributor II

Hello all,

flashing my custom board using LPC5526 failed with:

(100) Finished writing Flash successfully.
Flash Write Done
Loaded 0x2220 bytes in 176ms (about 49kB/s)
Reset target (romstall)
Starting execution using system reset with a stall address
Retask read watchpoint 1 at 0x50000040 to use for boot ROM stall
state - running or following reset request - re-read of state failed - rc Nn(05). Wire ACK Fault in DAP access

error closing down debug session - Nn(05). Wire ACK Fault in DAP access

It's a rather misleading error message. At first, I thought I that my debug interface could be connected in a wrong way. Soon I found out that it's all a configuration issue.

The code I'm programming was based on example code of LPC55S28 board. So to run this code I had to switch CPU.

This is done in project settings, right click on MCU and select "Edit MCU".

Edit MCU wizard windowEdit MCU wizard window

As you can see, after switching the MCU the flash memory size is still set to 0x80000 although the LPC5526 has only 256 kBytes. 

This is due to the fact that "Preserve memory configuration" was checked when switching MCUs. Mind you, this option is checked by default.

I don't know why or how a wrong memory configuration could lead to a message like "Finished writing Flash successfully.". This message lures you into believing that programming was successful. And "Wire ACK Fault in DAP access" is not helpful at all.

So what worked for me was:

To switch MCU correctly, you have to first uncheck "Preserve memory configuration" and then select the new MCU.

 

0 Kudos
2 Replies

1,121 Views
lpcxpresso_supp
NXP Employee
NXP Employee

The behavior of "Preserve Memory Configuration" is described in the User Guide and has the implications you described. Not sure what is to be done here.

Regarding the flash programming discussion, flash was most likely successfully programmed in both situations (only 0x2220 bytes according to your log). If I'm not mistaken, the same flash driver is used for both MCUs. Problems seem to appear once target reset and execution is attempted with the incorrect MCU specified in the project.

Greetings,
MCUXpresso IDE Support

1,097 Views
danielholala
Senior Contributor II

@lpcxpresso_supp wrote:

The behavior of "Preserve Memory Configuration" is described in the User Guide and has the implications you described. Not sure what is to be done here.

As a threshold matter, you should explain the reasoning why this option is checked by default. I guess I'm not experienced enough as I don't see any use case for preserving memory configuration.

Second, instead of only stating the obvious ("Preserve memory configuration - ... memory settings will be preserved."), the manual should elaborate when to use this option and when not. It should add use cases as examples. 

Further, name the implications. That is, don't write warning like "Changing selected MCU to a different one will modify project settings and may prevent project building and debugging". That's not helpful. The user changes the MCU on purpose (in my example, to convert demo code for MCU A to use with MCU B). If the project does not build after switching MCU, the user needs some guidance on how to fix this. That should be in the manual.

 

@lpcxpresso_supp further wrote:

Regarding the flash programming discussion, flash was most likely successfully programmed in both situations (only0x2220 bytes according to your log). If I'm not mistaken, the same flash driver is used for both MCUs. Problems seem to appear once target reset and execution is attempted with the incorrect MCU specified in the project.

Regarding "flash driver", for both MCUs the log message reads: "Opening flash driver LPC55xx.cfx (already resident)"

I understand that the flash driver may happily program code that does not match the correct RAM layout and thus does not execute. All I observed was that with "Preserve memory configuration" checked, the code did not execute even after power cycle or reset button on my board. So maybe a warning when switching MCUs while preserving standard memory configurations would be indicated.

0 Kudos