Issues with JFlash.exe Flashing 2 Daisy Chained Atmel SAMG55J19 (JLink Commander.exe would Work as Expected)

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

  • Issues with JFlash.exe Flashing 2 Daisy Chained Atmel SAMG55J19 (JLink Commander.exe would Work as Expected)

    I have two daisy-chained ATSAMG55J19 chips that I believe have been properly configured on the board. I'm using J-Link Plus programmer to program the two chips in both JFlash.exe and JLink Commander.exe and I'm getting different results in the two environments:

    1. In JFlash.exe, I can detect both devices, and I can get both programmed as long as I don't do 'start application' after I get Dev0 in the chain (Device that's closer to TDO on JTAG, Position=0, IR length=0) programmed. However even though it appears that both chips have been 'erased, programmed and verified successfully', none seems to have the application actually running no matter how many times I try to reset/power cycle the board.
    But if I 'start application' right after I get Dev0 programmed before doing Dev1, Dev0 will prevent JTAG from running properly and lock the chain, throwing out error "could not perform target reset, failed to connect could not perform custom init sequence" In such cases I will have to do a hardware erase on Dev0 in order to regain JTAG communication back.


    Also sometimes when I try to do a SW erase I get error code such as:

    - Start of erasing chip
    - End of erasing chip
    - Start of restoring
    - ERROR: Failed to erase chip @ address 0x00400000 (Algo47: Sector is locked)
    - ERROR: Failed to restore target. RAMCode never stops
    - End of restoring
    - ERROR: Failed to erase chip
    Disconnecting ...

    I then switched to JLink Commander.exe to do the SW erase and it proceeded without any issue.

    2. In JLink Commander.exe, I can get both programmed, and after cycling the power on the unit, both chips will have the application started up and running correctly. Also as mentioned above, sometimes when I run into issues using JFlash.exe, JLink Commander.exe seems to be the way to go and can almost always do the trick. However I remember in production environment, JFlash.exe is recommended over JLink Commander.exe, and also when automating in LabVIEW, I have an easier control manipulating and parsing the response from JFlash.exe than JLink Commander.exe.

    I would like to get JFlash.exe working reliably or at least get to the bottom of the few questions:

    * What different in JFlash.exe than JLink Commander.exe? Why sometimes would JFlash.exe throw me errors such as "RAMCode never stops" while JLink Commander.exe would work? Is it the init or exit step settings are different in the two programs? I'm right now using default settings (Init Steps: Reset method #0, Exit Steps: None) in JFlash.exe, and I've tried different settings (Reset method #2 etc.) but it didn't change the result.

    Thanks ahead for your inputs. Any advice would be appreciated.
  • Hi,


    Is it the init or exit step settings are different in the two programs?

    J-Link Commander does not support the feature "init / exit steps".
    JFlash.exe, and I've tried different settings (Reset method #2 etc.)

    Did you try to remove all init / exit steps?


    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.
  • Niklas,


    Thanks for the suggestion. I just tried with no init/exit steps loaded in JFlash.exe and it works like magic: both chips are properly programmed and applications start running, just like in JLink Commander.exe.

    I do have another issue coming along with removing the init steps. It looks like JTAG does not have the control over the chips if the applications are running. When I tried to connect to the target, I'm encountering error:


    Connecting ...
    - Connecting via USB to J-Link device 0
    - Target interface speed: 100 kHz (Fixed)
    - VTarget = 1.772V
    - Executing init sequence ...
    - Initialized successfully
    - Target interface speed: 1000 kHz (Fixed)
    - WARNING: Unexpected core ID. (Found: 0x00000000, Expected: 0x4BA00477, Mask: 0x0F000FFF)
    - J-Link found 0 JTAG device. Core ID: 0x00000000 (ARM9)
    - Connected successfully

    Is it possible to regain the control over the chips without having to do a hard erase to erase the contents on the chips?


    Thanks,
  • Hi,

    it looks like JTAG does not have the control over the chips if the applications are running.

    Therefore, it issues a reset by default before attempting to erase / program etc.
    It seems like the application gets the target in a state which causes issues when trying to connect.


    I am little bit confused.
    You say:
    If the applications are running, you cannot connect to the target, but you can "hard" erase it.
    How does this work?

    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.
  • Niklas,

    For the particular chip I'm talking about, it can be erased at power-up by doing following steps:

    1. Assert the ERASE pin (PB12, High).
    2. Assert the NRST pin (NRST, Low).
    3. Power cycle the device.
    4. Maintain the ERASE pin high for at least the minimum assertion time.



    Thanks,
  • Hi,


    thanks for the info.

    So the situation is as follows:

    While the applications are running you cannot do anything with J-Link to connect to the target.
    Once the internal flash is erased via the erase pin, you can connect to the target and program, unless a reset is issued, which causes the connect to fail.
    However, if the (erased) device is power cycled after a reset, you can connect again.

    Is this correct?


    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.
  • So the situation is as follows:

    While the applications are running you cannot do anything with J-Link to connect to the target.

    --Yes, and by 'running' I mean actually running, as demonstrated by being detected in USB enumeration, able to take commands and respond, etc.

    Once the internal flash is erased via the erase pin, you can connect to the target and program, unless a reset is issued, which causes the connect to fail.

    However, if the (erased) device is power cycled after a reset, you can connect again.
    --Not 100% true. The behavior is actually flaky and varies sometimes. I will try to explain more clearly:

    If Init steps is set to reset method 0 (reset target then halt):
    Starting from an erased, clean device, and I can connect to the target with no problem. I can also program one device in the chain, usually I start with dev0. I can get dev0 programmed, and then I will do one of the following two:
    1. Reset the target (Usually I just do a power cycle on the target), and dev0 would show up as have been successfully programmed and application would start running (as evidenced by being detected in USB enumeration). And now I wouldn't be able to connect to the target unless I erase dev0 via the erase pin.
    or if
    2. I do not reset the target after getting dev0 programmed, and I will still be able to connect to the target and get dev1 programmed. But this time if I reset the target (as I've mentioned above, reset the target by cycling the power on it), none of application would actually be running (nothing is detected in USB enumeration) although both were 'erased, programmed and verified ok'. Since the applications are not running, I actually am still able to connect and program the target, it's just the programming doesn't really work.. Also I've done quite a lot trials, things can get a little bit out of control and unpredictable sometimes: there are cases after I get both programmed and do a power cycle, application on dev1 would actually be running--and this is then similar to case#1 again, I would lose the communication between target and JLink unless an erase via the erase pin is done.

    Anyways, I've removed the init steps (reset 0) and now I can get both programmed, power cycle the target and both applications start up running as expected.


    Thanks,

    Shurui