[SOLVED] JLinkExe flashing PSoC CY8C4247 gives error

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

  • [SOLVED] JLinkExe flashing PSoC CY8C4247 gives error

    Hello,
    Trying to flash a Cypress PSoC CY8C4247 device using J-Link. Everything seems to work but I always get an error message when doing loadfile:

    Source Code

    1. > JLinkExe -if SWD -device CY8C4247XXX-LXXX -speed 1000
    2. [halt/reset/erase etc]
    3. J-Link>loadfile program.hex
    4. Downloading file [program.hex]...
    5. Comparing flash [100%] Done.
    6. Erasing flash [100%] Done.
    7. Programming flash [100%] Done.
    8. Verifying flash [100%] Done.
    9. J-Link: Flash download: Flash programming performed for 1 range (131072 bytes)
    10. J-Link: Flash download: Total time needed: 3.940s (Prepare: 0.289s, Compare: 0.103s, Erase: 0.058s, Program: 3.171s, Verify: 0.103s, Restore: 0.215s)
    11. Writing target memory failed.
    Display All



    However, after resetting, the system seems to start up just fine. It doesn't matter if I decrease the speed, it always gives the error like above.

    What may cause this error message?

    Thanks, Jacob
  • Hi Jacob,


    thanks for your inquiry.
    Could please provide us with the following information?:

    - Which OS do you use? (macOS / Linux)
    - Which J-Link model do you use? Can you please provide the S/N?
    - Which version of the J-Link software do you use?
    - Does this issue also occur with the most recent version of the J-Link software & documentation pack?


    Best regards,
    Niklas
    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.
  • Hello,
    Linux
    J-Link EDU, S/N 269402077
    SEGGER J-Link Commander V6.14c
    Yes.


    Also, I sometimes get this:

    Source Code

    1. Downloading file [program.hex]...
    2. Comparing flash [100%] Done.
    3. Erasing flash [100%] Done.
    4. Programming flash [100%] Done.
    5. Verifying flash [100%] Done.
    6. J-Link: Flash download: Restarting flash programming due to program error (possibly skipped erasure of half-way erased sector).
    7. J-Link: Flash download: Skip optimizations disabled for second try.
    8. Writing target memory failed.


    Your forum messes up newlines in code..!




    Downloading file [program.hex]...
    Comparing flash [100%] Done.
    Erasing flash [100%] Done.
    Programming flash [100%] Done.
    Verifying flash [100%] Done.
    J-Link: Flash download: Restarting flash programming due to program error (possibly skipped erasure of half-way erased sector).
    J-Link: Flash download: Skip optimizations disabled for second try.
    Writing target memory failed.

    Thanks, Jacob

    The post was edited 3 times, last by wifijacob ().

  • Hi Jacob,


    the forum software does not work well with \n line endings in code tags, it needs \r\n .
    It will fix your post accordingly.
    Could you please provide us with a J-Link logfile of a session?

    wiki.segger.com/J-Link_DLL#Enable_J-Link_Log_File


    Best regards,
    Niklas
    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 Jacob,


    the "Writing target memory failed." output is caused by write to memory which is called after the flash programming:

    C Source Code

    1. TF12C5700 021:031 JLINK_WriteMem(0x90400000, 0x0040 Bytes, ...) - Data: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ... -- CPU_WriteMem(64 bytes @ 0x90400000) returns 0xFFFFFFFF (1519ms, 1900ms total)

    Does your data file contain data for the address 0x90400000 and / or 0x90300000?

    Best regards,
    Niklas
    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.
  • The documentation states:

    Source Code

    1. 0x9030 0000 – Checksum (2 bytes).
    2. This is the checksumof the entire user flash section—the arithmetical sum ofevery byte in the user’s flash.
    3. Only the two least significantbytes (LSB) of the result are saved in this section, in big-endian format (most significant byte is first).
    4. The program-mer must use this to check the integrity of the hex file and toverify the quality of the programming.
    5. In this context, “integ-rity” means that the Checksum and User Flash sectionsmust be correlated in this file.
    6. At the end of programming,the checksum of flash (2 LSB) is compared to the checksumfrom the hex file.
    7. 0x9040 0000 – Flash Protection (32 bytes maximum).
    8. Thisdata is programmed into supervisory rows of the flash mac-ros (see Figure 2-1 on page 6).
    9. Every bit defines the write-protection setting for the corresponding user row.
    10. The num-ber of bytes to be read from this section depends on theflash size.
    Display All
  • Hi Jacob,


    the data file you provide to "loadfile" must only contain the data to be programmed by J-Link.
    Both Checksum and Flash Protection are not memory mapped at these addresses, the Cypress Tools (?) just know what they should represent.

    Stripping everything higher then 0x8000 from the hex file before programming will resolve the issue.

    Best regards,
    Niklas
    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 Jacob,


    thanks for the update.
    /Closed

    Best regards,
    Niklas
    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.