cant write more than 512 bytes to hyperflash on rt1062

cancel
Showing results for 
Search instead for 
Did you mean: 

cant write more than 512 bytes to hyperflash on rt1062

1,056 Views
fischer_larry
Contributor I
Im working with a custom board that is modeled around the rt1062 eval. We have a S26KS512SDPBHI02 1.8V hyperflash chip.  Ive been trying to program this flash chip, and Im having a problem.  Im able to program up to 0x200 bytes at a time.  After that, I see garbage, and I get an error.  Im using a combination of NXP-MCUBootUtility in master mode, and blhost from the command line.  I get the flashloader running on the target, and can talk to it directly via blhost.  I can erase all of flash, no problem.  
 
Here, I was writing a small amount of memory - foo.dat contained less than 0x200 characters and succeeded.  The contents is: "The quick brown fox jumped over the lazy sleeping dog."
C:\trash>C:\nxp\NXP-MCUBootUtility-master\tools\blhost2_3\win\blhost -t 5242000 -u 0x15A2,0x0073 -j -- write-memory 0x60001000 c:\trash\foo.dat
{
   "command" : "write-memory",
   "response" : [],
   "status" : {
      "description" : "0 (0x0) Success.",
      "value" : 0
   }
}

Here I was writing a larger amount.   Same contents repeated.  I had erased all of memory prior to this attempt.     
 
C:\trash>C:\nxp\NXP-MCUBootUtility-master\tools\blhost2_3\win\blhost -t 5242000 -u 0x15A2,0x0073 -j -- write-memory 0x60001000 c:\trash\foo.dat
{
   "command" : "write-memory",
   "response" : [],
   "status" : {
      "description" : "7000 (0x1B58) Unknown error code (7000)",
      "value" : 7000
   }
}
 
Its not a question of location - I can walk my writes up thru flash, as long as I keep them to 0x200 bytes or less.    I bet there is a simple explanation for this.
0 Kudos
13 Replies

830 Views
fischer_larry
Contributor I

Well, I finally made a bit of progress on this.  

I found a post on hyperflash and the eval boards that mentions that in addition to using the
1050 eval hyperflash driver on the 1062 eval board,
one needs to change the contents of the evkmimxrt1060_flexspi_nor_config.c file. 
I tried this on the eval board and our target hardware but wasnt able to make things work. 
However, it got me to thinking.  I tried running the flash tool from mcuxpresso and used the
1050_connect script on the target hardware.  I was able to successfully program the flash on
our target board.  I have confirmed that the contents are correct.  I cant program directly from
MCUXpresso, nor can I debug from there, but I can burn the flash.  After doing so, I switched
programmers to a JLink, and used NXP MCUBoot Utility to connect to the rom, which presumably
sets the correct registers for accessing hyperflash.  I then set the PC and stack pointers by hand from
JLink commander, and was able to run my program from flash. 

So clearly, the flash is working. 
There is one standard tool - flashburner - that knows how to program flash correctly.
I can execute from flash if I set things up manually.

The next questions are: Why cant MCUXpresso burn the flash directly?
Probably the same answer to - How can I debug from MCUXpresso?
And the follow-on question is probably answered in an appnote - how to set up my target
system/image so that it boots from hyperflash?  I dont have acces to the boot config GPIO
pins - the only thing I can do is burn fuses.

Thoughts on any of this data?

0 Kudos

820 Views
jeremyzhou
NXP TechSupport
NXP TechSupport

Hi,
Thanks for your reply.
According to your description, we can get that the issue seems to be nothing related to hardware.
As you mentioned above, it should adapt the evkmimxrt1060_flexspi_nor_config.c file to fit for hyperflash, in addition, it also needs to select the MIMXRT1060_SFDP_HYPERFLASH.cfx (as the below figure shows) when using MCUXpresso IDE to debug.

jeremyzhou_0-1615625129179.png


Have a great day,
TIC

-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!

 

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 Kudos

975 Views
fischer_larry
Contributor I

I am in the process of doing the same thing.  If it works, then I know we have a HW challenge.  If it doesnt, then the flashloader image I have has some quirk.  I will let you know.  Thanks for chasing.


Larry

0 Kudos

972 Views
fischer_larry
Contributor I

And one last question - where did you get your flashloader image file?  That is the program doing all of the work here.  Do they have version numbers?  I want to use the same image as you are using.

Thanks,

larry

0 Kudos

967 Views
jeremyzhou
NXP TechSupport
NXP TechSupport

Hi,
Thanks for your reply.
1) Where did you get your flashloader image file?
-- The flashloader image resides in the NXP-MCUBootUtility directory, for instance, \NXP-MCUBootUtility-xxx\src\targets\MIMXRT1062\ivt_flashloader.bin.
Note: the version of NXP-MCUBootUtility is 2.3.0.
Have a great day,
TIC

-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!

 

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 Kudos

1,043 Views
fischer_larry
Contributor I

I changed the file to a predictable binary pattern.  You can see the corruption starting at 0x200

0x60000000 00 11 22 33 44 55 66 77 88 99 aa bb cc dd ee ff .."3DUfw........
0x60000010 00 11 22 33 44 55 66 77 88 99 aa bb cc dd ee ff .."3DUfw........
0x60000020 00 11 22 33 44 55 66 77 88 99 aa bb cc dd ee ff .."3DUfw........
0x60000030 00 11 22 33 44 55 66 77 88 99 aa bb cc dd ee ff .."3DUfw........
0x60000040 00 11 22 33 44 55 66 77 88 99 aa bb cc dd ee ff .."3DUfw........
0x60000050 00 11 22 33 44 55 66 77 88 99 aa bb cc dd ee ff .."3DUfw........
0x60000060 00 11 22 33 44 55 66 77 88 99 aa bb cc dd ee ff .."3DUfw........
0x60000070 00 11 22 33 44 55 66 77 88 99 aa bb cc dd ee ff .."3DUfw........
0x60000080 00 11 22 33 44 55 66 77 88 99 aa bb cc dd ee ff .."3DUfw........
0x60000090 00 11 22 33 44 55 66 77 88 99 aa bb cc dd ee ff .."3DUfw........
0x600000a0 00 11 22 33 44 55 66 77 88 99 aa bb cc dd ee ff .."3DUfw........
0x600000b0 00 11 22 33 44 55 66 77 88 99 aa bb cc dd ee ff .."3DUfw........
0x600000c0 00 11 22 33 44 55 66 77 88 99 aa bb cc dd ee ff .."3DUfw........
0x600000d0 00 11 22 33 44 55 66 77 88 99 aa bb cc dd ee ff .."3DUfw........
0x600000e0 00 11 22 33 44 55 66 77 88 99 aa bb cc dd ee ff .."3DUfw........
0x600000f0 00 11 22 33 44 55 66 77 88 99 aa bb cc dd ee ff .."3DUfw........
0x60000100 00 11 22 33 44 55 66 77 88 99 aa bb cc dd ee ff .."3DUfw........
0x60000110 00 11 22 33 44 55 66 77 88 99 aa bb cc dd ee ff .."3DUfw........
0x60000120 00 11 22 33 44 55 66 77 88 99 aa bb cc dd ee ff .."3DUfw........
0x60000130 00 11 22 33 44 55 66 77 88 99 aa bb cc dd ee ff .."3DUfw........
0x60000140 00 11 22 33 44 55 66 77 88 99 aa bb cc dd ee ff .."3DUfw........
0x60000150 00 11 22 33 44 55 66 77 88 99 aa bb cc dd ee ff .."3DUfw........
0x60000160 00 11 22 33 44 55 66 77 88 99 aa bb cc dd ee ff .."3DUfw........
0x60000170 00 11 22 33 44 55 66 77 88 99 aa bb cc dd ee ff .."3DUfw........
0x60000180 00 11 22 33 44 55 66 77 88 99 aa bb cc dd ee ff .."3DUfw........
0x60000190 00 11 22 33 44 55 66 77 88 99 aa bb cc dd ee ff .."3DUfw........
0x600001a0 00 11 22 33 44 55 66 77 88 99 aa bb cc dd ee ff .."3DUfw........
0x600001b0 00 11 22 33 44 55 66 77 88 99 aa bb cc dd ee ff .."3DUfw........
0x600001c0 00 11 22 33 44 55 66 77 88 99 aa bb cc dd ee ff .."3DUfw........
0x600001d0 00 11 22 33 44 55 66 77 88 99 aa bb cc dd ee ff .."3DUfw........
0x600001e0 00 11 22 33 44 55 66 77 88 99 aa bb cc dd ee ff .."3DUfw........
0x600001f0 00 11 22 33 44 55 66 77 88 99 aa bb cc dd ee ff .."3DUfw........
0x60000200 11 1d aa b3 ec d5 ee 77 bd 9b fe bf cc ff ee ff .......w........
0x60000210 d7 b3 be bb ef f6 e7 ff ae 9b ef ff fd fd ee ff ................
0x60000220 d5 19 ab bf e5 ff ee f7 aa 9b ff f7 dc df ee ff ................
0x60000230 9c b5 a2 33 ec f5 6e ff ae dd bf ff ce dd ee ff ...3..n.........
0x60000240 53 19 ba b3 5e 7d 66 ff a8 99 ee bb cd ff ee bf S...^}f.........
0x60000250 40 31 67 33 c4 ff 6f f7 ea bb ee ff ec df ee ff @1g3..o.........
0x60000260 70 1d a2 33 4f 55 e6 7e b8 bf ef ff ef ff ee ff p..3OU.~........
0x60000270 20 1b 23 33 d4 5d 6e 77 ab db ee bf ee fd ee ff .#3.]nw........

0 Kudos

1,023 Views
jeremyzhou
NXP TechSupport
NXP TechSupport

Hi,

Thank you for your interest in NXP Semiconductor products and for the opportunity to serve you.
According to your reply, it seems that foo.dat should be less or equal to 0x200 (512) bytes then be able to be programmed to the Hyperflash, otherwise, it will encounter the write fail.
In further, you find that the content seems to be corrupted start from the 0x200 in the foo.dat.
Is my understand right?
If yes, I was wondering if you can share the schematic of connecting the HyperFlash, meanwhile, demonstrates the steps of programming in detail.
Looking forward to your reply.

Have a great day,
TIC

-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!

 

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 Kudos

1,019 Views
fischer_larry
Contributor I

Hi Jeremy,

Thank you for responding.  Just to clarify, I am able to write to flash as long as the size is less than or equal to 512 bytes.  Anything beyond that gets corrupted.  This seems to be an issue with the flashloader that I download  to the target system.  

I have written a PC application that writes in blocks of 512 bytes, and it works perfectly.  I dont have a problem writing to any part of flash - its just that if I try to write a chunk that is greater than 512, it fails.  So if I ask blhost to write a file that has more than 512, it fails.


I will ask my client if I can share the schematic.


Thank you,
Larry

0 Kudos

1,008 Views
fischer_larry
Contributor I

Here are the hyperflash connections for this board 

hyperflash-proc.png

hyperflash.png

0 Kudos

1,000 Views
jeremyzhou
NXP TechSupport
NXP TechSupport

Hi,

Thanks for your reply.
After having a brief review of the attached schematic, I think it's right.
So I was wondering if you can demonstrate the steps of programming in detail, and in the custom board, whether the S26KS512SDPBHI02 would work as the boot-up flash device which likes the QSPI in the MIMXRT1060-EVK board.
Looking forward to your reply.
Have a great day,
TIC

-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!

 

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

 

0 Kudos

991 Views
fischer_larry
Contributor I

Jeremy,

The issue seems to be with the flashloader image (ivt_flashloader.bin) that I download to the target board.  It is able to write only one page (512 bytes) of memory. The following log is from NXP MCUBootUtility.  If you are familiar with that utility, you can see me going thru the various stages:

 - connect to bootrom

 - Connect to flashloader (which downloads the flashloader)

 - Configure Boot device

 - Load bootable image

At the bottom, as I try to write the image, it fails.

---------------------------

'Connect to xxx' button is clicked – Connect to Bootrom

Executing C:\nxp\NXP-MCUBootUtility-master\tools\sdphost\win\sdphost -t 50000 -u 0x1FC9,0x0135 -j -- error-status

Executing C:\nxp\NXP-MCUBootUtility-master\tools\sdphost\win\sdphost -t 50000 -u 0x1FC9,0x0135 -j -- read-register 1075790864 32 4 C:\nxp\NXP-MCUBootUtility-master\tools\sdphost\win\vectors\readReg.dat

Executing C:\nxp\NXP-MCUBootUtility-master\tools\sdphost\win\sdphost -t 50000 -u 0x1FC9,0x0135 -j -- read-register 1075790880 32 4 C:\nxp\NXP-MCUBootUtility-master\tools\sdphost\win\vectors\readReg.dat

Executing C:\nxp\NXP-MCUBootUtility-master\tools\sdphost\win\sdphost -t 50000 -u 0x1FC9,0x0135 -j -- read-register 1074757636 32 4 C:\nxp\NXP-MCUBootUtility-master\tools\sdphost\win\vectors\readReg.dat

Executing C:\nxp\NXP-MCUBootUtility-master\tools\sdphost\win\sdphost -t 50000 -u 0x1FC9,0x0135 -j -- read-register 1074757660 32 4 C:\nxp\NXP-MCUBootUtility-master\tools\sdphost\win\vectors\readReg.dat

Executing C:\nxp\NXP-MCUBootUtility-master\tools\sdphost\win\sdphost -t 50000 -u 0x1FC9,0x0135 -j -- read-register 1074757660 32 4 C:\nxp\NXP-MCUBootUtility-master\tools\sdphost\win\vectors\readReg.dat

Executing C:\nxp\NXP-MCUBootUtility-master\tools\sdphost\win\sdphost -t 50000 -u 0x1FC9,0x0135 -j -- write-file 539001344 C:\nxp\NXP-MCUBootUtility-master\src\targets\MIMXRT1062\ivt_flashloader.bin

Executing C:\nxp\NXP-MCUBootUtility-master\tools\sdphost\win\sdphost -t 50000 -u 0x1FC9,0x0135 -j -- jump-address 539001344

'Connect to xxx' button is clicked Connect to Flashloader

Executing C:\nxp\NXP-MCUBootUtility-master\tools\blhost2_3\win\blhost -t 50000 -u 0x15A2,0x0073 -j -- get-property 1 0

Executing C:\nxp\NXP-MCUBootUtility-master\tools\blhost2_3\win\blhost -t 50000 -u 0x15A2,0x0073 -j -- efuse-read-once 5

Executing C:\nxp\NXP-MCUBootUtility-master\tools\blhost2_3\win\blhost -t 50000 -u 0x15A2,0x0073 -j -- efuse-read-once 6

Executing C:\nxp\NXP-MCUBootUtility-master\tools\blhost2_3\win\blhost -t 50000 -u 0x15A2,0x0073 -j -- efuse-read-once 7

Executing C:\nxp\NXP-MCUBootUtility-master\tools\blhost2_3\win\blhost -t 50000 -u 0x15A2,0x0073 -j -- efuse-read-once 6

Executing C:\nxp\NXP-MCUBootUtility-master\tools\blhost2_3\win\blhost -t 5242000 -u 0x15A2,0x0073 -j -- read-memory 1074446400 4 C:\nxp\NXP-MCUBootUtility-master\tools\blhost2_3\win\vectors\readReg.dat 0

Executing C:\nxp\NXP-MCUBootUtility-master\tools\blhost2_3\win\blhost -t 5242000 -u 0x15A2,0x0073 -j -- read-memory 1075791568 4 C:\nxp\NXP-MCUBootUtility-master\tools\blhost2_3\win\vectors\readReg.dat 0

'Connect to xxx' button is clicked Configure Boot Device

Executing C:\nxp\NXP-MCUBootUtility-master\tools\blhost2_3\win\blhost -t 5242000 -u 0x15A2,0x0073 -j -- fill-memory 538976256 4 3223531527 word

Executing C:\nxp\NXP-MCUBootUtility-master\tools\blhost2_3\win\blhost -t 5242000 -u 0x15A2,0x0073 -j -- fill-memory 538976260 4 0 word

Executing C:\nxp\NXP-MCUBootUtility-master\tools\blhost2_3\win\blhost -t 50000 -u 0x15A2,0x0073 -j -- configure-memory 9 538976256

Executing C:\nxp\NXP-MCUBootUtility-master\tools\blhost2_3\win\blhost -t 5242000 -u 0x15A2,0x0073 -j -- read-memory 1610612736 1024 C:\nxp\NXP-MCUBootUtility-master\tools\blhost2_3\win\vectors\flexspiNorCfg.dat 9

'Generate Bootable Image' button is clicked

Original image file is a bootable image file

Bootable image is generated: C:\nxp\NXP-MCUBootUtility-master\gen\bootable_image\ivt_evkmimxrt1060_target_iled_blinky - sram_extracted_unsigned.bin

'Load Bootable Image' button is clicked Load unsigned image

Executing C:\nxp\NXP-MCUBootUtility-master\tools\blhost2_3\win\blhost -t 2048000 -u 0x15A2,0x0073 -j -- flash-erase-region 1610612736 20480 9

Executing C:\nxp\NXP-MCUBootUtility-master\tools\blhost2_3\win\blhost -t 5242000 -u 0x15A2,0x0073 -j -- fill-memory 538980352 4 4026531855 word

Executing C:\nxp\NXP-MCUBootUtility-master\tools\blhost2_3\win\blhost -t 50000 -u 0x15A2,0x0073 -j -- configure-memory 9 538980352

Executing C:\nxp\NXP-MCUBootUtility-master\tools\blhost2_3\win\blhost -t 5242000 -u 0x15A2,0x0073 -j -- write-memory 1610616832 C:\nxp\NXP-MCUBootUtility-master\gen\bootable_image\ivt_evkmimxrt1060_target_iled_blinky - sram_extracted_unsigned_nopadding.bin 9

Executing: C:\nxp\NXP-MCUBootUtility-master\tools\blhost2_3\win\blhost -t 5242000 -u 0x15A2,0x0073 -j -- write-memory 1610616832 C:\nxp\NXP-MCUBootUtility-master\gen\bootable_image\ivt_evkmimxrt1060_target_iled_blinky - sram_extracted_unsigned_nopadding.bin 9

toolStatus: 0

commandOutput: {

   "command" : "write-memory",

   "response" : [],

   "status" : {

      "description" : "7000 (0x1B58) Unknown error code (7000)",

      "value" : 7000

   }

}

 

 

0 Kudos

979 Views
jeremyzhou
NXP TechSupport
NXP TechSupport

Hi,

Thanks for your reply.
I change the MIMXRT1060 to enable the onboard Hyperflash feature and Hyperflash connecting is as same as your board, then I try to replicate your phenomenon on my site.
However, it works well actually, the attachment is log file.
Hope this is clear.
Have a great day,
TIC

-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!

 

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 Kudos

974 Views
fischer_larry
Contributor I

Actually, Im waiting on a HW guy to ID the exact resistors.  I dont have a layout file that I can read and the labels on the board are not exactly obvious to me.  Can you point me to a picture that shows which are the resistors to change?

0 Kudos