Unable to read the data from very first 512 bytes via ISP

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

Unable to read the data from very first 512 bytes via ISP

Jump to solution
7,274 Views
at-nakano
Contributor II

Hi,

I'm using LPC1763 and wanted to read from flash via ISP interface.
When I read data from any address greater than 512 byte was fine, but unable to read "correct" data from very first 512 bytes.

The flow of communication are listed below:
      Host                          LPC1763
01. "?"
02.                                  "Synchronized\r\n"
03. "Synchronized\r\n"
04.                                  "OK\r\n"
05. "12000\r\n"
06.                                  "OK\r\n"
07. "R 228 8\r\n"
08.                                  "0\r\n"
09.                                  "<UU-encode data>\r\n"
10.                                  "<CheckSum>\r\n"
11.                                  "OK\r\n"

The return code and/or respose from LPC1763 is always fine, but received 8 bytes (at step 09) are all zero, and this happens at any other address and length in the case of first 512 bytes.

Curiously, the code above is works fine LPC4087.
Is there some additional command required, or the procedure above is not correct?

0 Kudos
Reply
1 Solution
6,901 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello @at-nakano 

About "1. Is the conclusion in the link correct?", I have confirmed with our AE, yes,

for LPC176x, please follow the Flash Magic to get the first 512 bytes of the flash. the link your provide is correct.

 

BR

Alice

View solution in original post

0 Kudos
Reply
15 Replies
7,264 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello @at-nakano 

 

Please check whether  enabled the first 512 bytes protection ? 

 

BR

Alice

0 Kudos
Reply
7,258 Views
at-nakano
Contributor II

Hi Alice,

Thank you for your reply.

You mean, "code read protection"?

I do not activate any level of CRP, and if I did so, I think I must receive "CODE_READ_PROTECTION_ENABLED" as a return code for "R" ISP command. 

Would you please let me know more in detail?

BR

 

0 Kudos
Reply
7,156 Views
at-nakano
Contributor II

Thank you for your support and explanation.

The commands on "Read_228_8_Success" was from command list of Flash Magic...
Please find attached file, this is the command sequence of Flash Magic when read first 4095 bytes.
As you can see, Flash Magic does same thing...

The commands below are from UM and AN11299
?
Sychronized
12000
R 228 8
And as I mentioned first, this command set was works fine with LPC4078.

Anyway, using Flash Magic for debug purpose is okay, but I need to update/verify LPC1763 from the host system in our product, so I need to know complete command set to read the data from first 512 byte.

Best,

0 Kudos
Reply
7,124 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello @at-nakano 

 

I think only can ask BOOT ROM team, it need some time, for now , you can refer to the command from Fla sh Magic. 

Could you please tell me how to get the log from Flash Magic?

 

BR

Alice

0 Kudos
Reply
7,109 Views
at-nakano
Contributor II

Hi Alice,

Thank you for your continuous support, I'm look forward to hearing back from BOOT ROM team.

Regarding log from Flash Magic, please refer to the file I attached.

Best,

0 Kudos
Reply
7,064 Views
at-nakano
Contributor II

Hi Alice,

Please see the link below:

https://www.embeddedrelated.com/showthread/lpc2000/56296-2.php

According to the information in the link, it seems like "boot rom remapping" issue.
When we read first 512 byte, we should disabling memory mapping sequence by bootrom, using "Memory Mapping Control Register (MEMMAP - 0x400F C040)", and re-enabling right after the complete read.

Note that the data bytes are slightly different against my case, but I think last 3 bytes are not used, so the actual data is exactly same.
Link : 0`DA/\`$!`6!P1P``0,`/0%V[
My case: 0`DA/\`$!`6!P1P``0,`/0```

Now, my questions are:
1. Is the conclusion in the link correct?
2. If the conclusion is correct, would you please tell me what does "0`DA/\`$!`6!P1P``0,`/0%V[" mean.
The link said that the "0`DA/\`$!`6!P1P``0,`/0%V[" is set "1" to bit0 for 0x400F C040, but how does this data bytes translated into control MEMMAP resiter?, I need to understand more in detail.

3. Why LPC 4078 can read first 512 bytes without disable/enable memory mapping?
Both 176x and 407x has memory mapping control register, and the boot sequence is seems like same.

0 Kudos
Reply
6,902 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello @at-nakano 

About "1. Is the conclusion in the link correct?", I have confirmed with our AE, yes,

for LPC176x, please follow the Flash Magic to get the first 512 bytes of the flash. the link your provide is correct.

 

BR

Alice

0 Kudos
Reply
6,895 Views
at-nakano
Contributor II

Hi Alice,

Thank you for your reply.

I understand the steps from Flash Magic is correct.

I still wonder why it does not happened on LPC4078, but will follow Flash Magic.

Anyway, thank you for your continuous support!

BR

Nakano

 

 

0 Kudos
Reply
7,058 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello @at-nakano 

Thanks for your sharing. I will check.

About the received data meaning, you can refer to below AN:

https://www.nxp.com.cn/docs/en/application-note/AN11229.pdf  

About other issue, I have escalate, will tell you after get any update, thanks!

 

BR

Alice

0 Kudos
Reply
7,238 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello @at-nakano 

‘Which tool do you use to communicate with MCU? I can try to test on my side with your tool, so could you please tell more, thanks.

I use Flash Magic test, can read data correctly:

 

Alice_Yang_0-1667790028553.png

 

BR

Alice

 

0 Kudos
Reply
7,221 Views
at-nakano
Contributor II

Hi Alice,

Thank you for your offer, but the tool we used to read/write data from/to LPC1763 is running on our own product, so I can not send it to you,

At the same time, I'm tried with terminal software, and the result is same as I informed.

The data bytes stored in 228 are:
97 2A 00 00 DC DB 02 00
But the data bytes retrieved via ISP are all zero.
Here's the command and response.
R 228 8
0
(```````````
0
OK

If I read data from 528, it works fine.
The data bytes stored in 228 are:
80 B4 00 AF
And the data bytes retrieved via ISP are:
80 B4 00 AF
Here's the command and response.
R 528 4
0
$@+0`KZ^O
483
OK
UU decoded data and CRC are correct.

I also confirmed that the Flash Magic can read first 512 bytes correctly, and our software is correctly works with LPC4078.
So, I wonder if LPC1763 has some specific command and/or restriction to read first 512 byte.

0 Kudos
Reply
7,191 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello @at-nakano 

Could you please take a screenshot about the steps and result on your  terminal software, 

it's better includes all the commands you used, and also "If I read data from 528, it works fine.".

Also could you please send a download linker about your terminal, I will install it on my side to reproduce, and then  I can escalate this issue, thanks.

 

BR

Alice

 

0 Kudos
Reply
7,178 Views
at-nakano
Contributor II

Hi Alice,

Thank you for your continuous support, it really appreciated.

First off, I have successfully read 8 byte of data from address 0xe4.

I'm checking the commands when Flash Magic read 4095 bytes of data from address 0, and use these commands to read the data from 0xe4.

Please see the screen-shots.
Read_228_8_Fail and Read_512_8_Success are the one you requested.
When I issue the command based on "Flash Magic Based", the result is Read_228_8_Success.

Although the issue is seems like solved, I have an additional question.
According to the commands from Flash Magic, I should write and execute data at 0x1000 0200 before read data from first 512 bytes area, but I have not found any document about this condition.
It is much appreciated if you tell me what "W" and "G" commands does, and showing resources and/or document explaining this requirement.

Anyway, I don't think the issue was caused by tool, but in case, the terminal software I used is teraterm, and the download link is:
https://ttssh2.osdn.jp/index.html.en

0 Kudos
Reply
7,163 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello @at-nakano 

1) About "Read_228_Success", I don't think this is correct, because from UM , you can see command G is used to execute a program residing in RAM or flash, it is meaning exit from ISP mode, so after G, all the ISP commands  can not communicate with terminal, so I think there is something wrong with below command R 228 8:

Alice_Yang_0-1668503469643.png

2) I test with LPC1769, as below:

Alice_Yang_1-1668503613744.pngI

I also test with other flash address, sometime it returns 0.

So I think use ISP command communicate with Terminal is unstable, recommend you directly use Flash Magic to read. 

 

BR

Alice

 

 

 

0 Kudos
Reply
7,151 Views
at-nakano
Contributor II

Thank you for your support and explanation.

The commands on "Read_228_8_Success" were based on commands from Flash Magic.
Please find attached log, this is original command list of Flash Magic, and as you can see, Flash Magic sends W and G for 0x1000 0200.

On the other hand, the commands I wrote on my first post(see below), were from UM and AN11229, so I think this codes should be works, and yes, this works with LPC4078.

Anyway, I understand Terminal is unstable, and using Flash Magic for debug purose is okay, but I need to implement write/read function on the host of LPC1763 board, so I need right procedure to read from first 512 bytes area of LPC1763.

Best,

0 Kudos
Reply