This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

F28M36P63C2: DSS script erase flash results in error. Device held in reset.

Part Number: F28M36P63C2
Other Parts Discussed in Thread: CCSTUDIO, , UNIFLASH

Hello,

I am using DSS to load bootloaders (.out) to both the M3 and the C28 on this chip. This works well. However I would also like to provide an option to only erase both cores, this is a seperate js DSS script. When I run the erase only script it completes without any errors but then when I run the script to load the bootloaders I keep running into the following error:

SEVERE: Cortex_M3_0: Error connecting to the target: (Error -1266 @ 0x0) Device is held in reset

Would these need to be erased using two seperate sessions?

Please see code below.

Thank you

Ryan

  • /*
    * CCSv4: <INSTALL DIR>\ccsv4\scripting\docs\GettingStarted.htm
    * CCSv5: <INSTALL DIR>\ccsv5\ccs_base\scripting\docs\GettingStarted.htm
    * CCSv6: <INSTALL DIR>\ccsv6\ccs_base\scripting\docs\GettingStarted.htm
    */

    // Import the DSS packages into our namespace to save on typing
    importPackage(Packages.com.ti.debug.engine.scripting)
    importPackage(Packages.com.ti.ccstudio.scripting.environment)
    importPackage(Packages.java.lang)

    // Configurable Parameters
    var deviceCCXMLFile = System.getenv("HOME") + "/bootloader/F28M36P63C2.ccxml";
    // Create our scripting environment object - which is the main entry point into any script and
    // the factory for creating other Scriptable ervers and Sessions
    var script = ScriptingEnvironment.instance();

    // Create a debug server
    var server = script.getServer("DebugServer.1");

    // Set the device ccxml
    server.setConfig(deviceCCXMLFile);

    // Open a debug session
    var sessionM3 = server.openSession(".*M3.*");
    var sessionC28 = server.openSession(".*C28.*");

    // Create a log file in the current directory to log script execution
    script.traceBegin("BootLoaderInstallLog.xml", "DefaultStylesheet.xsl");

    /* Connect to target M3
    */
    script.traceWrite("Connecting to M3 device...");
    sessionM3.target.connect();
    script.traceWrite("Connected.");

    /* Reset target M3
    */
    script.traceWrite("Resetting M3 device...");
    sessionM3.target.reset();
    script.traceWrite("Reset Complete.");

    /* Connect to target C28
    */
    script.traceWrite("Connecting to C28 device...");
    sessionC28.target.connect();
    script.traceWrite("Connected.");

    /* Reset target C28
    */
    script.traceWrite("Resetting C28 device...");
    sessionC28.target.reset();
    script.traceWrite("Reset Complete.");

    /* Connect to target C28
    */
    script.traceWrite("Connecting to C28 device...");
    sessionC28.target.connect();
    script.traceWrite("Connected.");

    try{
    /* Erase C28 */
    sessionC28.flash.options.setString("FlashEraseSelection", "Selected Sectors Only"); //"Selected Sectors Only" could be "Entire Flash"
    sessionC28.flash.options.setBoolean("FlashC28Bank0Sector0",true);
    sessionC28.flash.options.setBoolean("FlashC28Bank0Sector1",true);
    sessionC28.flash.options.setBoolean("FlashC28Bank0Sector2",true);
    sessionC28.flash.options.setBoolean("FlashC28Bank0Sector3",true);
    sessionC28.flash.options.setBoolean("FlashC28Bank0Sector4",true);
    sessionC28.flash.options.setBoolean("FlashC28Bank0Sector5",true);
    sessionC28.flash.options.setBoolean("FlashC28Bank0Sector6",true);
    sessionC28.flash.options.setBoolean("FlashC28Bank0Sector7",true);
    sessionC28.flash.options.setBoolean("FlashC28Bank0Sector8",true);
    sessionC28.flash.options.setBoolean("FlashC28Bank0Sector9",true);
    sessionC28.flash.options.setBoolean("FlashC28Bank0Sector10",true);
    sessionC28.flash.options.setBoolean("FlashC28Bank0Sector11",true);
    sessionC28.flash.options.setBoolean("FlashC28Bank0Sector12",true);
    sessionC28.flash.options.setBoolean("FlashC28Bank0Sector13",true);

    script.traceWrite("Erase flash...");
    sessionC28.flash.erase();
    script.traceWrite("Flash erase done...");
    }
    catch(err)
    {
    script.traceWrite("SEVERE: error in erasing C28 flash.");
    }

    /* Connect to target C28
    */
    script.traceWrite("Connecting to C28 device...");
    sessionC28.target.connect();
    script.traceWrite("Connected.");

    /* Reset target C28
    */
    script.traceWrite("Resetting C28 device...");
    sessionC28.target.reset();
    script.traceWrite("Reset Complete.");

    /* Connect to target M3
    */
    script.traceWrite("Connecting to M3 device...");
    sessionM3.target.connect();
    script.traceWrite("Connected.");

    try{
    /* sectors to erase */
    sessionM3.flash.options.setString("FlashEraseSelection", "Entire Flash"); //"Selected Sectors Only" could be "Entire Flash"

    /* flash operations */
    script.traceWrite("Erase flash...");
    sessionM3.flash.erase();
    script.traceWrite("Flash erase done...");
    }
    catch(err)
    {
    script.traceWrite("SEVERE: error in erasing M3 flash.");
    }

    /* Reset target M3
    */
    script.traceWrite("Resetting M3 device...");
    sessionM3.target.reset();
    script.traceWrite("Reset Complete.");

    sessionC28.target.disconnect();
    sessionM3.target.disconnect();

    // server.stop();
    sessionC28.terminate();
    sessionM4.term inate();
    server.stop();
    script.traceEnd();

  • Hi,

    We will have an engineer respond to you shortly.

    sal
  • Ryan,
    Just wanted to touch base from the TI side, we are still looking into this on our end. Trying to understand if this is a aspect of DSS or the flash flow itself.

    If you use the flash tools embedded in Code Composer and you do a similar operation wrt the M3 flash, does the emulator also report a similar error in terms of held in reset as the DSS server?

    Best,
    Matt
  • Hi Matt,

    I tried with Uniflash first. I will try CCS next and update.

    Uniflash:

    Test 1: Erase C28 then M3 in same session, unplug then load bootloaders to M3 then C28

    T1 Results: C28 and M3 flash erase successful - unplug/start new session - M3 program successful, C28 failed Error no target connected, unplug/reboot/started new session C28 programming succcessful

    Test 2: Erase C28 then M3 then try to load code to M3 and C28 all in same session

    T2 Results: Both erases successful and both program loads successful

    Test 3: Erase C28 then M3, unplug/reboot/start new session, then load code to C28 then M3

    T3 Results: Both erases successful - unplug/reboot/start new sesssion - C28 loading hangs (error C28xx_0 GEL Error OnTargetConnect(): target is not connected - M3 program successful - try to program C28 again, again fail - unplug/reboot/start new session - C28 program successful

    Thanks,

    Ryan

  • Ryan,

    How are the boot mode pins configured on your board?
    Can you try wait-in-reset mode, if not already?

    Thanks and regards,
    Vamsi
  • Hi Matt,

    To finish your question: When I erase with DSS (code above) then got into CCS then launch target configuration then try to connect to M3 I get this:

    Error connecting to the target:
    (Error -1266 @ 0x0)
    Device is held in reset. Take the device out of reset, and retry the operation.
    (Emulation package 6.0.407.3)

    When I then try to connect to C28 I get this in the console:
    C28xx_0: Failed CPU Reset: (Error -1137 @ 0x6) Device is held in reset. Take the device out of reset, and retry the operation. (Emulation package 6.0.407.3)
  • Hi Vamsi,

    The boot mode pins are configured for boot from flash. Would prefer to not change hardware but I'll look into it.

    Thank you
  • Ryan,

    If you have boot pins set to flash boot, then CPU will start fetching invalid opcodes causing resets.
    Please see if this post helps: e2e.ti.com/.../500995

    Thanks and regards,
    Vamsi
  • Hi Vamsi,

    I tried to activate wait-in-reset by going to Run - Advanced - enable halt on reset but this option is greyed out.

    Usually after I get the errors mentions above in ccs I am able to select "show all cores" then connect to DAP, afterwhich I am usually able to load the bootloaders to each core.
  • Ryan,

    I think you can try wait-in-reset option (EMU0/EMU1 options) from the emulator connection properties in the target configuration window.
    Please try that.

    Thanks and regards,
    Vamsi
  • Hi Vamsi,

    I tried erasing with my DSS script (which seems to erase fine, blinking led stops as planned) then rebooted the system, opened CCS, went to Target Configuration > Connection Properties > and set the Power-On-Reset Boot-Mode to Enabled - EMU1 high, EMU0 low, then launched that configuration.  I got a similar result. Console print out below.

    Cortex_M3_0: GEL Output: Memory Map Initialization Complete

    Cortex_M3_0: Error connecting to the target: (Error -1266 @ 0x0) Device is held in reset. Take the device out of reset, and retry the operation. (Emulation package 6.0.407.3)

    C28xx_0: GEL Output:

    Memory Map Initialization Complete

    C28xx_0: GEL Output:

    RAM Initialization Complete

    C28xx_0: Failed CPU Reset: (Error -1137 @ 0x6) Device is held in reset. Take the device out of reset, and retry the operation. (Emulation package 6.0.407.3)

    C28xx_0: Trouble Reading Register PC: (Error -1137 @ 0x0) Device is held in reset. Take the device out of reset, and retry the operation. (Emulation package 6.0.407.3)

    C28xx_0: Trouble Reading Register ST1: (Error -1137 @ 0x6) Device is held in reset. Take the device out of reset, and retry the operation. (Emulation package 6.0.407.3)

    C28xx_0: GEL: Error while executing OnReset(1): Target failed to read register ST1

    at (ST1&~(0x0100)) [f28m36p63c2_c28.gel:368]

    at C28x_Mode() [f28m36p63c2_c28.gel:31]

    at OnReset(1)

    C28xx_0: Trouble Reading Register ST1: (Error -1137 @ 0x6) Device is held in reset. Take the device out of reset, and retry the operation. (Emulation package 6.0.407.3)

    C28xx_0: Failed CPU Reset: (Error -1137 @ 0x0) Device is held in reset. Take the device out of reset, and retry the operation. (Emulation package 6.0.407.3)

    C28xx_0: Trouble Reading Register PC: (Error -1137 @ 0x0) Device is held in reset. Take the device out of reset, and retry the operation. (Emulation package 6.0.407.3)

    C28xx_0: Trouble Reading Register ST1: (Error -1137 @ 0x6) Device is held in reset. Take the device out of reset, and retry the operation. (Emulation package 6.0.407.3)

    C28xx_0: GEL: Error while executing OnReset(1): Target failed to read register ST1

    at (ST1&~(0x0100)) [f28m36p63c2_c28.gel:368]

    at C28x_Mode() [f28m36p63c2_c28.gel:31]

    at OnReset(1)

    C28xx_0: Error occurred during flash operation: CPU Reset error. Error code 1

    C28xx_0: Trouble Writing Memory Block at 0x4024 on Page 1 of Length 0x2: (Error -1137 @ 0x4026) Device is held in reset. Take the device out of reset, and retry the operation. (Emulation package 6.0.407.3)

    C28xx_0: Error occurred during flash operation: Target failed to write 0x00004024@Data

    C28xx_0: Trouble Writing Memory Block at 0x4020 on Page 1 of Length 0x2: (Error -1137 @ 0x4022) Device is held in reset. Take the device out of reset, and retry the operation. (Emulation package 6.0.407.3)

    C28xx_0: Error occurred during flash operation: Target failed to write 0x00004020@Data

    C28xx_0: Trouble Reading Register ST1: (Error -1137 @ 0x6) Device is held in reset. Take the device out of reset, and retry the operation. (Emulation package 6.0.407.3)

    C28xx_0: Error occurred during flash operation: Target failed to read register ST1

    C28xx_0: Trouble Writing Register ST1: (Error -1137 @ 0x6) Device is held in reset. Take the device out of reset, and retry the operation. (Emulation package 6.0.407.3)

    C28xx_0: Error occurred during flash operation: Target failed to write register ST1

    C28xx_0: Trouble Writing Register ST1: (Error -1137 @ 0x6) Device is held in reset. Take the device out of reset, and retry the operation. (Emulation package 6.0.407.3)

    C28xx_0: Error occurred during flash operation: Target failed to write register ST1

    C28xx_0: Trouble Writing Memory Block at 0x4300 on Page 1 of Length 0x2: (Error -1137 @ 0x4302) Device is held in reset. Take the device out of reset, and retry the operation. (Emulation package 6.0.407.3)

    C28xx_0: Error occurred during flash operation: Target failed to write 0x00004300@Data

    C28xx_0: Trouble Writing Memory Block at 0x4300 on Page 0 of Length 0x2: (Error -1137 @ 0x6) Device is held in reset. Take the device out of reset, and retry the operation. (Emulation package 6.0.407.3)

    C28xx_0: Error occurred during flash operation: Target failed to write 0x04300@Program

    C28xx_0: Trouble Writing Memory Block at 0x4000 on Page 1 of Length 0x2: (Error -1137 @ 0x4002) Device is held in reset. Take the device out of reset, and retry the operation. (Emulation package 6.0.407.3)

    C28xx_0: Error occurred during flash operation: Target failed to write 0x00004000@Data

    C28xx_0: Trouble Writing Memory Block at 0x4300 on Page 0 of Length 0x2: (Error -1137 @ 0x6) Device is held in reset. Take the device out of reset, and retry the operation. (Emulation package 6.0.407.3)

    C28xx_0: Error occurred during flash operation: Target failed to write 0x04300@Program

    C28xx_0: Trouble Reading Register ST1: (Error -1137 @ 0x6) Device is held in reset. Take the device out of reset, and retry the operation. (Emulation package 6.0.407.3)

    Thank you,

    Ryan

  • Ryan,

    Ok.

    Quick questions:

    1) In your script, why do you have multiple connect statements for M3 and C28x?  Why do you need multiple connects when there is no disconnect?

    2) Also why do you terminate M4 (Should use M3 - correct?)

    3) Also, you don't need to reset after erase.

    Try above mentioned changes along with WIR mode.

    If you still see the issue, I would suggest a free run after reset and before loading.  

    Free run causes BootROM code to run and bring the device to a known condition.  If it does not halt after free run, you can halt it after a brief delay.

    Thanks and regards,
    Vamsi

  • Ryan,

    See this: e2e.ti.com/.../1966879

    Thanks and regards,
    Vamsi
  • Hi Vamsi,

    1: I did not initially have these....this was attempting to ensure everything was connecting after each command while debugging.

    2: Thats a typo...correcting

    3: I will correct this as well

    I will update after trying your suggestions.

    Thank you,

    Ryan
  • Hi Vamsi,

    Did you mean using the free run in my erase only script in this thread, after reset before erasing? Or in my loading script?

    I added it after reset in my erase only script after reset before loading:

    sessionM3.target.runAsynch();
    sessionC28.target.runAsynch();

    Thread.sleep(1000);

    sessionM3.target.halt();
    sessionC28.target.halt();

    This seemed to work once (erase worked then rebooted the system and was able to reprogram with programming script which is where I run into the issue) but then I erased again and then tried to read memory using uniflash and it reported target in reset again (or target not connected).

    Thanks,

    Ryan
  • Ryan,

    Which version of CCS and UniFlash are you using?
    There is an option in latest UniFlash versions which allows target to run after load. May be you should disable it to avoid execution after load.

    Edit: Note added on March 3rd: Please note that I will not be able to check your reply until March 6th.


    Thanks and regards,
    Vamsi

  • Hi Vamsi,

    I am using CCS v 6.2 and UniFlash v 4.6. Sorry for the delay...got sidetracked with some other deadlines. Will be getting back to this end of this week.

    Thank you,

    Ryan

  • Ryan,

    In UniFlash, can you check if the option "Run Target After Program Load/Flash Operation" is enabled or disabled?

    Thanks and regards,
    Vamsi
  • Ryan,

    Regarding your question:  "Did you mean using the free run in my erase only script in this thread, after reset before erasing? Or in my loading script?".

    I would suggest to do it after every reset and before doing any further flash operation.

    Thanks and regards,

    Vamsi

  • Ryan,

    Do you have any update on this debug?

    Thanks and regards,
    Vamsi
  • Ryan,

    Since I didn't hear from you for the last two weeks, I am assuming that you are able to resolve this issue using our suggestions.
    I am closing this post for now. If you still face this issue, you can reopen the thread (if it not locked). If the thread gets locked, you can click on "Ask a related question" button at the top right corner of this webpage and post the details.

    Thanks and regards,
    Vamsi