[SOLVED] -readchip erases my chip memory

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

  • [SOLVED] -readchip erases my chip memory

    Hello,

    Using the command line interface command "-readchip" my chip memory is erased and the read memory is consequently full of "FF". This does not happend if I perform this action manually (Target > Manual Programming > Read Back > Entire chip), in this case the action is done perfectly and the memory is correctly read.

    I have seen a difference between both processes. In the manual case, when the action is selected, the message box with the question "Do you want to perform an erase...?" appears and I select 'No', but in the automatic case this answer does not appear and always perform a previous erase.

    I do not know if I have to select something previously or if I should change any option in my project settings, but I can not use this automatic feature.

    In order to provide more information, I am using a J-Link EDU with J-Flash 6.44 and a MK64FN1M0 microchip.

    Thank you for the help!!
  • Hello,

    Thank you for your inquiry.
    It appears that your target devices Flash is locked by the application you have programmed in earlier. When setting up target connection the next time J-Link will detect this and ask you if you want to unlock the device. That will trigger a mass erase of Flash as this is the only way to recover the control of the device.
    This is due to the Flash protection config area on Kinetis devices is unfortunately at 0x400 in Flash. So if you program an application there this can lead to unexpected locking of the Flash.
    We recommend skipping that area from 0x400-0x40F in your application image to avoid such issues.

    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 Nino,

    First of all, thank you very much for your feedback.

    You are right about the fact that the memory range between 0x400-0x40F contains the microprocessor security bytes but if I enable this security the manual reading process is not allowed too, so that, I think that this is not the reason why this -readchip command is not working properly. Moreover, I need to read the entire chip, even this aforementioned memory range, therefore, I still do not understand why I can read the entire chip using JFlash.exe manually and not using the command -readchip or -readrange if the project is the same. I think that the same dialog context asking about perform an erase should appear or at least the possibility of configure it through the JFlash project.

    Deleting this memory range from my image is not an option because without it the application won't work properly.

    Thank you very much in advance.
  • For more information, using application JLink.exe it is also possible to read and save the memory, but in this case the problem is that it is only possible to save the file in .bin and I would like to have it in .srec or .s19
  • Hello,

    cBrownie wrote:

    Moreover, I need to read the entire chip, even this aforementioned memory range, therefore, I still do not understand why I can read the entire chip using JFlash.exe manually and not using the command -readchip or -readrange if the project is the same. I think that the same dialog context asking about perform an erase should appear or at least the possibility of configure it through the JFlash project.
    Default for automated mode is "Yes" when using command line options. You can force "No" by selecting this manually once and checking the "Do not show this message again" checkbox.
    Then when calling -readchip the Flash should no longer we deleted.

    cBrownie wrote:

    Deleting this memory range from my image is not an option because without it the application won't work properly.
    Not sure why this would be an issue. Does your application utilize 100% of Flash? If not you can simply skip that memory range in your linker file for code generation or write a specific array in there with allowed data that would not lock the Flash accidentally.
    Generally we recommend "sacrificing" this 1 byte of data in Kinetis Flash and program a fixed non locking config into Flash than having to deal with constant locking or unlocking of the Flash when debugging or reflashing the device.

    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.