[SOLVED] JFlashSPI_CL in Linux for NOR flash memory

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

  • [SOLVED] JFlashSPI_CL in Linux for NOR flash memory

    Hello,

    I'm attempting to use the JLink Plus with the JFlashSPI_CL utility under Linux to erase and program an n25q256a SPI flash memory from Micron. However, I cannot get it to work. I attempt to run the following command:

    $ JFlashSPI_CL -connect -open working_base_image.bin 0x0 -speed 20000 -auto
    SEGGER J-Flash SPI V6.22d Command Line Version
    JLinkARM.dll V6.22d (DLL compiled Dec 14 2017 18:34:21)


    Creating new project file [Default.jflash] ...
    - New project created successfully
    Connecting ...
    - Connecting via USB to J-Link device 0
    - VTarget = 3.320V
    - Read SPI Flash Id = 0x20 BA 19
    - Found SPI Flash: Micron N25Q256A
    - Connected successfully
    Executing init sequence ...
    - Executed successfully
    Opening data file [working_base_image.bin] ...
    - Data file opened successfully (14155776 bytes, 1 range)
    Auto programming target (14155776 bytes, 1 range) ...
    - Reading affected sectors ...
    - Target memory read successfully. (14155776 bytes, 1 range)
    - Erasing affected sectors ...
    - ERROR: Communication timed out: Requested 2 bytes, received 0 bytes !
    - ERROR: Emulator does not support SPI.


    If I try to use the GUI version of JFlash SPI under windows, all works well as expected. Is there something I'm missing here or does anyone have any pointers?

    Thankful for any help!</infinite>
  • Hello,

    Thank you for your inquiry.
    The issue was reproducible and is already fixed in our internal build. A fixed release is expected by the end of the week.

    Sorry for any inconveniences caused.

    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.
  • Hello again Nino,

    I've tried out the new version of the application (V630) and it now works better. However it still does not work completely. When programming the flash memory using JFlashSPI_CL under either Windows or Linux the programmed memory does not represent the binary file that were supposed to be programmed, i.e. when using the GUI version of JFlash to read out the memory contents after programming with JFlashSPI_CL the verification fails. However, when asking JFlashSPI_CL to verify it reports that the verification succeeds (even though I can see that is it not a matched when reading the read out memory using a different tool).

    Do you have any idea of what I can do to fix this problem?

    Best regards,

    Jesper Lindgren
  • Hello Jesper,

    I tried to reproduce this scenario with the latest available J-Link version V6.30a and the issue was not reproducible.
    The testfile I used is attached.
    Could you try programming that file?
    Does a verify work now with the Gui and CL version?

    Could you provide the file you were trying to program for reference?

    Best regards,
    Nino
    Files
    • testbin.bin

      (1.05 MB, downloaded 358 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.
  • Hello Nino,

    Using the file you provided it works reliably. However I still cannot get the process to work using my binary file. Sometimes it works, sometimes it fails during erase, and sometimes it fails during verification. Below is a printout from JFlashSPI_CL in Ubuntu 16.04 running in VirtualBox under Windows 10.

    Source Code

    1. time JFlashSPI_CL -openprj s25fl256s.jflash
    2. -open _build/img-s25fl256s.bin 0 -auto
    3. SEGGER J-Flash SPI V6.30 Command Line Version
    4. JLinkARM.dll V6.30 (DLL compiled Jan 30 2018 18:46:34)
    5. Creating new project file [Default.jflash] ...
    6. - New project created successfully
    7. Close project
    8. - Project closed
    9. Opening project file [s25fl256s.jflash] ...
    10. - Project opened successfully
    11. Opening data file [_build/img-s25fl256s.bin] ...
    12. - Data file opened successfully (14155776 bytes, 1 range)
    13. Auto programming target (14155776 bytes, 1 range) ...
    14. - Connecting ...
    15. - Connected successfully
    16. - Executing init sequence ...
    17. - Executed successfully
    18. - Reading affected sectors ...
    19. - Target memory read successfully. (14155776 bytes, 1 range)
    20. - Erasing affected sectors ...
    21. - Erase operation completed successfully.
    22. - Programming target (14153728 bytes, 5 ranges) ...
    23. - Target programmed successfully.
    24. - Verifying target (14153728 bytes, 5 ranges) ...
    25. - ERROR: Verification failed @ address 0x0000041F (Read: 0x00, Expected: 0x02)
    26. - ERROR: Failed to verify target.
    27. - Executing exit sequence ...
    28. - ERROR: Failed to auto program target.
    29. Disconnecting ...
    30. - Disconnected
    31. Close project
    32. - Project closed
    33. real 1m5.432s
    34. user 0m12.295s
    35. sys 0m0.850s
    Display All


    I've attached the settings file I'm using. The binary is 13 MB large and I cannot attach it to the forum post as it is too large.

    Maybe I'm simply misunderstanding how I should use the tools, but regardless I'm highly appreciative of your help.

    Best regards,

    Jesper
    Files
    • s25fl256s.jflash

      (984 Byte, downloaded 329 times, last: )
  • Hi Jesper,

    Thank you for providing the project and binary.
    Programming the provided binary worked with both GUI and CL version flawless and the binary content was later also in Flash.

    Looking through the jflash project you provided i noticed that it is configured for a Spansion s25fl256 Flash instead of Micron n25q256a as you initially wrote.
    It looks like you are trying to program the Micron chip with settings from the Spansion Flash which will not work as they have different commands.

    Could you check your project settings once more?

    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.