CodeWarrior Flash Programming issue with LS1043A QSPI

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

CodeWarrior Flash Programming issue with LS1043A QSPI

Jump to solution
3,892 Views
Tao2022
Contributor III

Hi, 

I am trying to use CodeWarrior (Version: 11.5.5) to burn my QSPI flash (MT25QU256ABA), and seems I am having some random timeout issue, the fl_erase works with small memory range fine, but it will fail if I tried to erase large chunk of flash memory, and the upper limit is random, sometimes I can erase up to 640KB, sometimes only up to 320KB, it depends on luck.

When I use fl_write to burn my image to flash, it never succeeds, always stuck for about 5 minutes and return with error (FP: wait for target callback not set or not working). I do verified that the first few hundreds of KB are written to flash successfully though, then written bytes stays after power cycling the target board.

See some printout on console of fl_erase and fl_write:

....first round....

(qspi) fl_erase 0x0 0x10000
Erasing...Done
Erased 64.00KB in 0.18s
(qspi) fl_erase 0x0 0x20000
Erasing...Done
Erased 128.00KB in 0.07s
(qspi) fl_erase 0x0 0x30000
Erasing...Done
Erased 192.00KB in 0.08s
(qspi) fl_erase 0x0 0x40000
Erasing...Done
Erased 256.00KB in 0.08s
(qspi) fl_erase 0x0 0x50000
Erasing...Done
Erased 320.00KB in 0.08s
(qspi) fl_erase 0x0 0x60000
Erasing...0%
Flash programming operation failed.

......2nd round....

(qspi) fl_erase 0x0 0x80000
Erasing...Done
Erased 512.00KB in 0.22s
(qspi) fl_erase 0x80000 0x20000
Erasing...Done
Erased 128.00KB in 0.07s
(qspi) fl_erase 0x100000 0x10000
Erasing...Done
Erased 64.00KB in 0.07s
(qspi) fl_write 0x0 "qspi_2019.img"
Writing...0%
Flash programming operation failed.

Any suggestion for where the root cause is or what might go wrong?

Thanks in advance.

 

0 Kudos
Reply
1 Solution
3,824 Views
Tao2022
Contributor III

Update for someone who might have the same problem as I did.

I found the solution of this flash programmer freeze problem, it's caused by that the QSPI speed is too fast, incurs mis-sync at HW level, I fixed it by setting "Half Speed serial flash clock Enable" bit within QuadSPI_SMPR register (0x1550108h). You can do this within Target Initialization File:

###################################################################
# QSPI Initialization
###################################################################
def Init_QSPI():
# QSPI_CFG
CCSR_BE_M(0x157015C, 0x20100000)

# SMPR, enable "Half Speed serial flash clock"
CCSR_BE_M(0x1550108, 0x00000001)

......

Now my flash programmer can erase and write 16MB QSPI successfully.

 

Tao2022_0-1666368306758.png

Tao2022_1-1666368618833.png

 

 

 

View solution in original post

7 Replies
2,165 Views
indravathi
Contributor I

same problem we are using nor flash(MT28FW02GBBA1HPC) and hadcoded rcw(0x9f) we are getting NOT verify in codewarrior

0 Kudos
Reply
3,877 Views
yipingwang
NXP TechSupport
NXP TechSupport

In "Target Initialization File", please configure "QSPI_BOOT = 0" and "USE_SAFE_RCW = True" to enable QSPI lines.

Please modify the following configuration to try whether there is progress.

if QSPI_BOOT:
# Add QSPI device
fl.add_device({"alias": "qspi", "name": "MT25QU128ABA", "address": 0x40000000, "ws_address": 0x10000000, "ws_size": 0x1FFFF, "geometry": "8x1", "controller": "QSPI"})

=>

fl.add_device({"alias": "qspi", "name": "MT25QU512ABA", "address": 0x40000000, "ws_address": 0x10000000, "ws_size": 0x1FFFF, "geometry": "8x1", "controller": "QSPI"})

In addition, when you click flash programing icon, CCS(CodeWarrior Connection Server) console will be popped up on the right bottom of the Windows task bar, please open it and type "log v", then click flash programming icon again, the low level CCS log will be printed out, would you please capture this CCS log to me to do more investigation?

0 Kudos
Reply
3,872 Views
Tao2022
Contributor III

Hi, Yiping,

  Thanks for the quick response, I did following things (partially following your suggestion because my case is a little different).

1) "USE_SAFE_RCW = True" was set in my target init script all the time, and I use it to set the RCW words as well as to adapt to our board's setting (please let me know if you see problem) :

  # add here if you need to override other particular RCW values
TA.rcw.set_data({1: 0x0810000e, 5: 0x24550002, 6: 0x80004002, 8: 0xc1002000, 9: 0x00000000, 12: 0x08038e48, 13: 0x20004500, 14: 0x08001000})

2) "QSPI_BOOT = 0" doesn't work, it will skip QSPI_BOOT related script code, so I have to set "QSPI_BOOT = True" to make QSPI enabled and corresponding device selected, am I doing it right?

3) Instead of  "MT25QU128ABA" and "MT25QU512ABA", we actually have "MT25QU256ABA" QSPI chip, so I added QSPI device as:

fl.add_device({"alias": "qspi", "name": "MT25QU256ABA", "address": 0x40000000, "ws_address": 0x10000000, "ws_size": 0x1FFFF, "geometry": "8x1", "controller": "QSPI"})

Note: we do have flashing algorithm and pattern files created and put into corresponding folders of CW, so far it didn't complaint anything.

4) Setting "log v" in CCS does provide more information (thank you for the good suggestion) when I tried to erase 2M memory on QSPI flash, it says: ERROR(4): Cable disconnected (target power not detected)

Flash Programmer screen capture:

Tao2022_0-1666018841476.png

CCS Printout with "log v" command and write_memory actions:

Tao2022_1-1666019818498.png

CCS printout when error returns:

Tao2022_2-1666020007743.png

 

So, my question would be: why this doesn't happen when erase small chunk of QSPI memory? do I need different power cable for my target device? Any suggestion will be deeply appreciated.

0 Kudos
Reply
3,855 Views
yipingwang
NXP TechSupport
NXP TechSupport

1. Have you tried the default RCW hard-coded configuration in CW initialization file?

2. Please configure QSPI_BOOT = 1

3. It seems that CodeWarrior doesn't include flash algorithm for flash MT25QU256ABA.

Please use the following to do verification.

fl.add_device({"alias": "qspi", "name": "MT25QU128ABA", "address": 0x40000000, "ws_address": 0x10000000, "ws_size": 0x1FFFF, "geometry": "8x1", "controller": "QSPI"}

or 

fl.add_device({"alias": "qspi", "name": "MT25QU512ABA", "address": 0x40000000, "ws_address": 0x10000000, "ws_size": 0x1FFFF, "geometry": "8x1", "controller": "QSPI"}

0 Kudos
Reply
3,838 Views
Tao2022
Contributor III

First, appreciated that you looking into my question, please see my following results according to your suggestions:

1. Have you tried the default RCW hard-coded configuration in CW initialization file?

Result: Yes, I tried both default RCW and our own RCW configuration, same result, seems RCW configurations doesn't matter to Flash Programmer.

2. Please configure QSPI_BOOT = 1

Result: Yes, set QSPI_BOOT = 1 works, same result as QSPI_BOOT = True

3. It seems that CodeWarrior doesn't include flash algorithm for flash MT25QU256ABA.

Note: We got the flash algorithm from NXP, we do have it and copied files to corresponding CW folders.

Please use the following to do verification.

fl.add_device({"alias": "qspi", "name": "MT25QU128ABA", "address": 0x40000000, "ws_address": 0x10000000, "ws_size": 0x1FFFF, "geometry": "8x1", "controller": "QSPI"}

or 

fl.add_device({"alias": "qspi", "name": "MT25QU512ABA", "address": 0x40000000, "ws_address": 0x10000000, "ws_size": 0x1FFFF, "geometry": "8x1", "controller": "QSPI"}

Result: Tried both MT25QU512ABA and MT25QU128ABA, same result, could erase small chunk, but not large chunk. See following screen capture:

 

Tao2022_0-1666274246112.pngTao2022_1-1666274388535.png

 

0 Kudos
Reply
3,825 Views
Tao2022
Contributor III

Update for someone who might have the same problem as I did.

I found the solution of this flash programmer freeze problem, it's caused by that the QSPI speed is too fast, incurs mis-sync at HW level, I fixed it by setting "Half Speed serial flash clock Enable" bit within QuadSPI_SMPR register (0x1550108h). You can do this within Target Initialization File:

###################################################################
# QSPI Initialization
###################################################################
def Init_QSPI():
# QSPI_CFG
CCSR_BE_M(0x157015C, 0x20100000)

# SMPR, enable "Half Speed serial flash clock"
CCSR_BE_M(0x1550108, 0x00000001)

......

Now my flash programmer can erase and write 16MB QSPI successfully.

 

Tao2022_0-1666368306758.png

Tao2022_1-1666368618833.png

 

 

 
3,860 Views
Tao2022
Contributor III

Update, I found that the "ERROR(4): Cable disconnected (target power not detected)" was caused by our hardware watchdog, when flash programming progress stuck, the watchdog kickoff after two minutes, then the CW complaints that the target lost power.

After disabled the hardware watchdog, the "target power not detected" error is gone, but the flash programming process will stuck forever (if I erase/write more than 1M bytes), till I manually power off the target board.

Anyone has any suggestion? thanks in advance.

 

0 Kudos
Reply