Writing to the QSPI Flash of MCXN947 using write_image_win.bat

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

Writing to the QSPI Flash of MCXN947 using write_image_win.bat

1,856 次查看
takagi_y
Contributor III

I am using write_image_win.bat to write to the QSPI Flash of MCXN947.

However, writing to a brand new board fails.

The situation is as follows.

・When writing to a brand new board using the bat file, the process that displays "Erase memory before writing image" displays "failed".

・Boards that have already been written to using the SEC tool can be written to using the bat file.

I would like to ask the following.

1. Why can't I write to a brand new board using the bat file?

2. Is there something I need to do to write to a brand new board using the bat file?

3. Is there a difference between a board that has already been written to using the SEC tool and a brand new board?

Please answer.

Best regards

标签 (1)
0 项奖励
回复
11 回复数

1,803 次查看
marek-trmac
NXP Employee
NXP Employee

Hi,

what board is it?

Can you send a details (log) with the error message?

May be the erasing flash fails, if the flash was already erased.

Regards,
Marek


NOTE: If you find the answer useful, kindly click on [ACCEPT AS SOLUTION] button
0 项奖励
回复

1,778 次查看
takagi_y
Contributor III

Thank you for your reply.

The board I am using is a custom MCXN947 board.

The log showing the error is attached below.

### Parse input arguments ###
### Check connection ###
blhost -t 2000 -u 0x1FC9,0x014F -j -- get-property 1 0
{
"command": "get-property",
"response": [
1258488320
],
"status": {
"description": "0 (0x0) Success.",
"value": 0
}
}
blhost succeeded
### Configure FlexSPI NOR memory using options on address 0x20020000 ###
blhost -t 5000 -u 0x1FC9,0x014F -j -- fill-memory 0x20020000 4 0xC0000002 word
{
"command": "fill-memory",
"response": [],
"status": {
"description": "0 (0x0) Success.",
"value": 0
}
}
blhost succeeded
blhost -t 5000 -u 0x1FC9,0x014F -j -- configure-memory 9 0x20020000
{
"command": "configure-memory",
"response": [],
"status": {
"description": "0 (0x0) Success.",
"value": 0
}
}
blhost succeeded
### Erase flash ###
blhost -t 50211 -u 0x1FC9,0x014F -j -- flash-erase-region 0x80000000 21168 0
{
"command": "flash-erase-region",
"response": [],
"status": {
"description": "20106 (0x4e8a) FlexSPINOR: Command Failure.",
"value": 20106
}
}
blhost failed

 

I heard that if the flash is erased, erasure may fail, so I erased the QSPI flash on a board that was working, then ran write_image_win.bat, but no errors occurred.

Is there any difference between a board with the flash erased and a new board?

Also, is there any processing required to write to a new board using write_image_win.bat?

Best regards

0 项奖励
回复

1,766 次查看
marek-trmac
NXP Employee
NXP Employee

Hi,

1) can you please specify what QSPI flash are you using? What producer is it and what type is it?

2) can you try to reproduce the same problem in with erased flash: Open the Flash Programmer (main menu > Tools > Flash Programmer), press "Configure external memory" button and then select "Erase all". And then try to apply "write_image_win.bat" script again? 

Regards,
Marek


NOTE: If you find the answer useful, kindly click on [ACCEPT AS SOLUTION] button
0 项奖励
回复

1,759 次查看
takagi_y
Contributor III

Thank you for your reply.

The manufacturer of the flash is Macronix, and the model number is MX25L3233F.

I erased the flash of the board that can be written to using the method you mentioned, and wrote to it using write_image_win.bat, but no errors occurred.

Does clearing the board's flash make it the same as a new one?

Best regards

0 项奖励
回复

1,742 次查看
marek-trmac
NXP Employee
NXP Employee

Hi,

can you try configuration word 0xC0000102 instead of 0xC0000002?

marektrmac_0-1745315306136.png

 

Regards,
Marek


NOTE: If you find the answer useful, kindly click on [ACCEPT AS SOLUTION] button
0 项奖励
回复

1,712 次查看
takagi_y
Contributor III

Thank you for your reply.

I have checked the "Resulting word" value with 0xC0000102, 0xC0000101, and 0xC0000001, but the result is the same.

I was able to write by executing write_image_win.bat after performing "Test" of "Boot Memory Configuration" on a new board.

Does "Test" of "Boot Memory Configuration" set any settings on the chip?

Best regards

0 项奖励
回复

1,703 次查看
marek-trmac
NXP Employee
NXP Employee

Hi,

just to be sure after you change resulting word, did you update write_image_win.bat? The configuration word should have "Quad SPI mode" bit set (mask 0x100). Usually for a new memory, this bit is not configured and needs to be set during first flash access. The bit is non-volatile, once set, it will remain configured. We suspect, this might be an issue.

About "Test" in boot memory configuration:
- it configures the memory, see script ext_memory_setup.bat in the workspace
- it reads the memory using blhost
- it checks the memory configuration using blhost

Regards,
Marek


NOTE: If you find the answer useful, kindly click on [ACCEPT AS SOLUTION] button
0 项奖励
回复

1,665 次查看
marek-trmac
NXP Employee
NXP Employee

Hi,

the "Test" should not set anything in the processor. It just configures the external flash and checks the access.

I tried to make summary of the issue in the table to understand the problem. Kindly review the table and/or add additional details.

Board status Write script result with config word C0000002 Write script result with config word C0000102
New board, first time write script executed Failure Failure
New board, write script started second time without power on reset Pass Pass
New board, write script started second time with power on reset ?? ??
New board, write script started after Test without power on reset Pass Pass
New board, write script started after Test and after power on reset Pass Pass
Regards,
Marek


NOTE: If you find the answer useful, kindly click on [ACCEPT AS SOLUTION] button
0 项奖励
回复

1,649 次查看
takagi_y
Contributor III

Thank you for your reply.

I have added the information to the table you provided.

Board statusWrite script result with config word C0000002Write script result with config word C0000102
New board, first time write script executedFailureFailure
New board, write script started second time without power on resetFailureFailure
New board, write script started second time with power on resetFailureFailure
New board, write script started after Test without power on resetPassPass
New board, write script started after Test and after power on resetPassPass

 

In addition, on a brand new board, if you run ext_memory_setup.bat and then run write_image_win.bat, you will be able to write.

Best regards

0 项奖励
回复

1,624 次查看
marek-trmac
NXP Employee
NXP Employee

Hi again,

so, based on your table, my understanding is, if you run memory configuration

@echo ### Configure FlexSPI NOR memory using options on address 0x20020000 ###
call "%blhost%" %blhost_connect% -j -- fill-memory 0x20020000 4 0xC0000102 word
if errorlevel 2 exit /B 2
call "%blhost%" %blhost_connect% -j -- configure-memory 9 0x20020000
if errorlevel 2 exit /B 2

twice, everything works. If you run it only once, flash erase fails. Can you confirm?

 

Also, if you run "Test" in memory configuration dialog after power on reset, the test pass. Can you confirm?

 

Can you share the schema (HW design), how the memory is connected to the processor? 

 

We do not see the issue on our boards. We'd like to test. Anything you can help to reproduce the issue on our side?

Regards,
Marek


NOTE: If you find the answer useful, kindly click on [ACCEPT AS SOLUTION] button
0 项奖励
回复

1,387 次查看
takagi_y
Contributor III

Thank you for your reply.

When using a brand new board, you can write by performing a total of two memory configurations, once with ext_memory_setup.bat and once with write_image_win.bat.

Once you have performed the above writing, you will be able to write to that board using only write_image_win.bat.

The "Test" after powering on will pass even on a brand new board.

You can write to a brand new board by running ext_memory_setup.bat and write_image_win.bat in succession.

I don't see any problems in this situation.

Best regards

0 项奖励
回复