[SOLVED] loadbin to QSPI Flash on NXP K81 fails

This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

  • [SOLVED] loadbin to QSPI Flash on NXP K81 fails

    I am able to load firmware with code sections on both internal flash, and external QSPI flash using, e.g., loadfile FW.hex (This functionality was available from J-Link V4.44)

    Now I need to load a single binary data file to an address in QSPI flash.

    J-Link V6.46h
    Try 1:

    J-Link>loadbin \nxp\termsettings.bin 0x68060000
    Halting CPU for downloading file.
    Downloading file [\nxp\termsettings.bin]...
    Compare method "Programmed sectors, fastest method" is not supported for this device.
    Changed to "Programmed sectors using read back"
    Verify method "Programmed sectors, fastest method" is not supported for this device.
    Changed to "Programmed sectors using read back"

    ****** Error: Timeout while checking target RAM, core does not stop. (PC = 0x1FFF119E, XPSR = 0xA1000000, SP = 0x1FFF14F8)!
    Failed to prepare for programming.
    Failed to execute RAMCode for RAM check!
    Error while determining flash info (Bank @ 0x68000000)
    Unspecified error -1
    J-Link>


    I then converted the file to an ihex file using

    c:\nxp>arm-none-eabi-objcopy.exe --change-addresses 0x68060000 -I binary -O ihex termsettings.bin termsettings.hex

    and tried:
    J-Link>loadfile \nxp\termsettings.hex

    ...which loaded the file, as expected. But the file in memory is corrupted. I am thinking that it might be the 32-little-endian versus 64-little-endian config option with the K8x QSPI.

    The post was edited 4 times, last by DenisCollis: Expanded information. Typo: V4.46 should be V6.46 ().

  • Hello,

    Thank you for your inquiry.
    Could you give the latest J-Link version a try?
    segger.com/downloads/jlink/#J-…twareAndDocumentationPack

    The version you are currently using is over 10 years old and in the meantime there have been many improvements and changes so please understand that we can't provide help for such outdated software.

    Best regards,
    Nino
    Please read the forum rules before posting.

    Keep in mind, this is *not* a support forum.
    Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
    Should you be entitled to support you can contact us via our support system: segger.com/ticket/

    Or you can contact us via e-mail.
  • Hi Nino.

    Oops, that was a typo! The version I am using is V6.46 and NOT V4.46

    However, I did as you suggested and downloaded V6.48. I now get :

    J-Link>loadfile c:\nxp\termsettings.hex

    InitTarget()
    Found SW-DP with ID 0x2BA01477
    AP map detection skipped. Manually configured AP map found.
    AP[0]: AHB-AP (IDR: Not set)
    AP[0]: Core found
    AP[0]: AHB-AP ROM base: 0xE00FF000
    CPUID register: 0x410FC241. Implementer code: 0x41 (ARM)
    Found Cortex-M4 r0p1, Little endian.
    FPUnit: 6 code (BP) slots and 2 literal slots
    CoreSight components:
    ROMTbl[0] @ E00FF000
    ROMTbl[0][0]: E000E000, CID: B105E00D, PID: 000BB00C SCS-M7
    ROMTbl[0][1]: E0001000, CID: B105E00D, PID: 003BB002 DWT
    ROMTbl[0][2]: E0002000, CID: B105E00D, PID: 002BB003 FPB
    ROMTbl[0][3]: E0000000, CID: B105E00D, PID: 003BB001 ITM
    ROMTbl[0][4]: E0040000, CID: B105900D, PID: 000BB9A1 TPIU
    ROMTbl[0][5]: E0041000, CID: B105900D, PID: 000BB925 ETM
    Downloading file [c:\nxp\termsettings.hex]...

    ****** Error: Timeout while erasing sector, core does not stop. (PC = 0x1FFF1028, XPSR = 0x21000000, SP = 0x1FFF16E8)!
    Unspecified error -1

    Switching back to V6.46, I get:

    J-Link>loadfile c:\nxp\termsettings.hex
    Downloading file [c:\nxp\termsettings.hex]...
    Compare method "Programmed sectors, fastest method" is not supported for this device.
    Changed to "Programmed sectors using read back"
    Verify method "Programmed sectors, fastest method" is not supported for this device.
    Changed to "Programmed sectors using read back"
    J-Link: Flash download: Bank 1 @ 0x68000000: 1 range affected (65536 bytes)
    J-Link: Flash download: Total time needed: 3.253s (Prepare: 0.103s, Compare: 2.151s, Erase: 0.014s, Program: 0.257s, Verify: 0.717s, Restore: 0.009s)
    O.K.


    Regards,
    Denis

    The post was edited 1 time, last by DenisCollis ().

  • Hello,

    We tried to reproduce the reported behaviour but everything was working fine using V6.48b and a TWR-POS-K81 board.
    See programming result attached. The example hex file that has been used for testing is attached as well.

    Could you give the latest J-Link software version a try? Does programming the example hex file work?
    Could you provide a J-Link log of your session?
    wiki.segger.com/Enable_J-Link_log_file

    Best regards,
    Nino
    Images
    • Capture.PNG

      62.93 kB, 677×1,050, viewed 729 times
    Files
    • test.zip

      (424.7 kB, downloaded 533 times, last: )
    Please read the forum rules before posting.

    Keep in mind, this is *not* a support forum.
    Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
    Should you be entitled to support you can contact us via our support system: segger.com/ticket/

    Or you can contact us via e-mail.
  • Hi Nino,

    I think I have everything working, if I follow the exact sequence below:

    The connection sequence:
    • insert J-Link USB
    • Insert J-Link JTAG
    • Power up boardLaunch J-Link Commander
    The connection is important:
    • J-Link> connect
    • Device: MK81FN256XXX15
    • Interface: SWD
    • Speed: 4000kHz
    It seems that in the past some of these boards were programmed with MCU "MK81FN256XXX15 enable security".
    • J-Link> unklock kinetis
    • And then load the ihex file:
    • J-Link> loadfile FW_and_Data.hex


    Thanks,
    Denis
  • Hello Denis,

    Great to hear that you are up and running again.
    As you correctly found out there is a big difference between selecting the generic k81 device name and the one allow setting the security bits.
    I assume that by using the latter some of the Flash lock bits have been set which lead to the follow up issues you have experienced.

    Make sure to use the enable security device selection only if you want to lock your target device indefinitely e.g. after production. We do not recommend using this mode during debugging.

    We will consider this thread as solved now.

    Best regards,
    Nino
    Please read the forum rules before posting.

    Keep in mind, this is *not* a support forum.
    Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
    Should you be entitled to support you can contact us via our support system: segger.com/ticket/

    Or you can contact us via e-mail.