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.

WDT prevents XDS100v2 connecting

Other Parts Discussed in Thread: TM4C1294KCPDT, LMFLASHPROGRAMMER, UNIFLASH

Target: proprietary board with TM4C1294KCPDT chip.  Emulator is Blackhawk XDS100v2 ARM.  CCS is 6.1.2.00015. TI-RTOS 2.16.0.8. NDK 2.25.0.9.

Long story, but I managed to get the on-chip FLASH on the target programmed with the WDT timers set for about 1 second and enabled right at the start of main().

When I try to start a debug session, the WDT reset trips and the emulator issues:

Error connecting to the target:
(Error -154 @ 0x0)
One of the FTDI driver functions used to
write data returned bad status or an error.
(Emulation package 6.0.83.1)

Is there some way to setup things up so that the emulator can get control of the target? 

I downloaded LMFlashProgrammer, but it seems to want a .bin file and I cannot find one in my project even after a full build.  This was just a guess because, as I understand it, that will ultimately fail as well because the target is somehow getting the emulator to reset...

Suggestions?

Tom

  • Hello Tom,

    Please download and install TivaWare. Then using "LM Flash Programmer", program a .bin file of any example (in "<TivaWare Install Folder>/examples/boards/<Board Being Used>/<Any Example>/). See if you are able to program the example.

    If not, you might have to unlock the device using "LM FLASH Programmer" under the "Other Utilities" tab, under the section "Debug Port Unlock". Note that by using this option all the contents in the memory will be erased, including non-volatile registers (like User Registers which store MAC address).

    Thanks,
    Sai
  • Hi Sai,

    I have not been able to recover the board.

    Ultimately, I tried the LM FLASH Programmer Debug Port Unlock without success.  It puts a warning message box about losing stored value and I clicked OK.  Next it puts up a message box that says "Assert and hold reset while powering up the device."  I have done so, but I always get "**ERROR** Failed to unlock connected device!"  I have tried clicking OK on the "Assert..."box both before and after releasing reset.

    I have LM Flash Programmer build 1613.  I have tried the following configuration tab settings with Speed (Hz) = 1000000, Using selected crystal value 25 MHz (matches the target board):  {Tried with Other Utitilites | Debug Port Unlock | radio buttions set in both positions}

    Quick Set = Manual Configuration, Interface ICD1, port JTAG

    Quick Set = Manual Configuration, interface ICD1, port SWD

    Quick Set = Manual Configuration, Interface Red Probe, port JTAG

    Quick Set = Manual Configuration, interface Red Probe, port SWD

    Quick Set = TM4C1294XL LaunchPad

    None of these have worked.

    What should all these LM Flash Programmer settings be?  What else can we try?

    Tom

  • Hello Tom,

    The Quick Set setting is "TM4C1294XL LaunchPad".

    The error message you got while trying to unlock could be due to the fact that "LM Flash Programmer" cannot detect the connection to the ICDI device.

    Are you sure the devices drivers are installed when you tried to unlock? Open device manager and see if the following drivers are installed:
    1) Stellaris ICDI DFU Device (under "Stellaris In-Circuit Debug Interface")
    2) Stellaris ICDI JTAG/SWD Interface (under "Stellaris In-Circuit Debug Interface")
    3) Stellaris Virtual Serial Port (under "Ports (COM & LPT)")

    If the above mentioned drivers are installed, when the LaunchPad is connected, then please view the "Driver Date" and "Driver Version" by using the Properites option. If the drivers are older than 12/31/2015, try to update to the latest version using the link: www.ti.com/.../stellaris_icdi_drivers

    Alternatively, if you have another LaunchPad board, try to program a binary from TivaWare into the board and see if it working.

    Thanks,
    Sai
  • Tom Farmer said:
    What should all these LM Flash Programmer settings be?  What else can we try?

    You said you were using a XDS100v2 emulator, but LM Flash Programmer doesn't support a XDS100v2.

    Instead, there is a command line option in CCS to perform a device unlock using a XDS100v2 - see https://e2e.ti.com/support/microcontrollers/tiva_arm/f/908/t/475655#1714727

  • Tom Farmer said:
    What else can we try?

    Another possibility is to use a GEL script to disable the watchdog - see the last post in https://e2e.ti.com/support/development_tools/code_composer_studio/f/81/t/310868. However, depending upon how quickly the watchdog gets enabled by the device, not sure if the GEL script will be able to disable the watchdog in time to allow the debugger to connect. 

  • Hi Sai,

    The board is not a launchpad; it is a proprietary board.  The emulator worked fine with the board until I managed to install firmware that causes the watchdog to trip early in the boot-up process.  I do not have a launchpad board.

    As for drivers, none of the Stellaris drivers appear.  All that appears are under Universal Serial Bus Controllers -- TI XDS100 Channel A and TI XDS100 Channel B.

    Tom

  • Hello Tom,

    I apologize for not reading your post completely and asking you to do a bunch of steps.

    The LM Flash Programmer requires the ICDI interface to communicate with the MCU. The LaunchPad come with this ICDI interface. Since your board is a proprietary board, this solution won't work.

    I will forward you post to my colleague who might be able to help you.

    Thanks,
    Sai
  • Hello Tom,

    Chester has already provided the solution. Thank you Chester.

    Regards
    Amit
  • More likely - a (potential) solution has been provided. (as poster Chester noted)
    Enabling the watchdog so early w/in main is very risky practice! (just as is (early) JTAG switch-over to GPIO)

    Poster did not justify that (early) action - and (now) pays the price.

  • Hello cb1,

    Since the LMFlashProgrammer and Uniflash were very much tied to ICDI (earlier), having additional unlock tools would was required (as ICDI binary could not be released)

    Regards
    Amit
  • Hi Amit,

    Thank you - appreciated - yet "no" ICDI resides on poster's (custom) board. (stated, opening post, this thread)

    Are you stating that the Gel script is able to halt the WDT's "launch" - (even) when WDT enable occurs SO early w/in user's program? (I believe that was (both) Chester's & my concern)
  • Hello cb1

    I did not suggest that.

    Regards
    Amit
  • Amit Ashara said:
    Chester has already provided the solution.

    Here's where our communication breaks down:

    • Chester (I believe properly) noted that there was (some) chance that his "Gel Script" method may not achieve "Command/Control" w/the offensive code placed so early w/in the code bank.
    • Your quote (above) appears to "over-ride" Chester's caution.
    • I noted that conflict - sought clarification

    Too short answers - even from a master - rarely, fully/properly succeed.   (or prove convincing)

    Phrased differently (for uber clarity) is it your belief that a "Gel Script" will ALWAYS enable errant (suspect) code to be halted - (even) when such code is "immediately" executed?   AND (especially when such code is "immediately" executed!)

    I've "no dog" in this fight - simply believe a correctly detailed answer will prove useful to thread originator & many (others)...

  • cb1_mobile said:
    Here's where our communication breaks down:

    In an attempt to clarify, I made two suggestions:

    1) Use a CCS command line tool to perform a device unlock using the XDS100v2 emulator. This has the advantage that a device unlock is requested by JTAG-to-SWD and SWD-to-JTAG switch sequences while holding the microcontroller in reset, meaning it occurs while the software is not running. The disadvantage is that all non-volatile information is erased (e.g. erases the MAC address non-volatile registers)

    2) Use a GEL script to attempt to disable the watchdog while attaching the debugger. The disadvantage is that the GEL script may not be able to disable the watchdog in time to allow the debugger to attach. The advantage is that won't erase the non-volatile registers and EEPROM.

  • Indeed you did make two suggestions. Note that they appeared (separately - w/in different postings) and such is never as effective as a complete listing - w/in one single (summarizing) post.

    Might it be that you missed the fact that my request for "clarification" was aimed at Amit?    His assertion of a "solution" (provided by you) flew (somewhat) in the face of your (still proper) uncertainty that the Gel script could, "seize control."  

    And - as you've provided two suggestions - is it not fair/proper to ask Amit (which solution/suggestion) is the one he believes and/or favors?   

  • Hello cb1,

    Absolutely. My direction ought to have been for the E2E forum link that had the exact command line option and emulation package that was required for using XDS100 to run the unlock sequence.

    Regards
    Amit
  • Hi Amit,

    Thank you - appreciated - your (more detailed) writing now proves (far) more understandable.

    That said - "Unlock" is brutal - and causes the loss of pre-programmed data - placing "added load" upon users.

    Poster Chester's (second) idea (GEL script) - if it (could) succeed - seemed inspired and places less "wear/tear" upon hapless user...

    As an added point to the (always) dreaded, "Cannot Connect" - would not (near) universal use of past program, "GPIO-JTAG.c" placed atop all (other) program code - provide a "SAFETY/DEFENSE MECHANISM" - insuring that users can (most always) HALT their MCU?   (firm/I do just that - and along w/IAR & J-Link - we've NOT been "Connect Challenged" for past 2+ years...)

  • Hello cb1

    Let it be noted, that in the Serial Boot Loader application note, the first code that is put is a recovery mechanism using BOOTCFG. A safe method to bypass the application code and keep the device in a known good state.

    Regards
    Amit
  • Hi Amit,

    And - let it be (equally) noted - poster's first few postings make "No mention" of Bootloader nor BOOTCFG. If that appears (somewhere) in this long, back-forth mix - I've missed it.

    Further - for those Apps NOT using bootloader - does not forgotten/discounted, "GPIO-JTAG.c" rise to, "Head of the (always) connected class?"

  • Hello cb1,

    Yes, it does. I am merely keeping options visible for the user.

    Regards
    Amit
  • Thanks to all who suggested fixes but I was not able to recover the board.  Rather than spend more time with this, we decided to have our CM replace the chip.

    As for the question about why we got into this mode, there were two reasons.  One was that there was a recommendation somewhere in the TI documentation to invoke the watchdog as soon as possible. 

    The second reason was that our board is used in an industrial application and is subject to severe EMC.  We had problems with our original Stellaris-version hanging when exposed to ESD and radiated-immunity testing.  With this new TIVA-version, we are starting a lot of tasks and we were concerned that a single task might hang (due to EMC effects) while the rest of the tasks continued to run fine.  This has a high risk of happening in radiated-immunity testing because the stimulus that caused a watchdog reset might still be being applied as the board returned from the watchdog-initiated reset.

    Note that I made the wrong assumption that the XDS100v2 emulator worked like various in-circuit emulators I have used in the past with other chips.  These emulators power up with complete control of the device and can even be used to hardware debugging.  Unfortunately, the XDS100v2 seems to have much less capability but it also is dramatically lower in cost.  (Other than this reset issue, the XDS100v2 has met all of my other needs; this is not a complaint about the XDS100v2.)

    For completeness -- each of our tasks has a flag that it sets every time the task is executed.  Our "idle" tasks waits until all the flags are set.  Once that happens it reloads the watchdog down counter and clears all of the task flags.  There is an arbitration mechanism in place to avoid write conflicts.  End result is that the watchdog will eventually timeout if any of the tasks fails to set its flag.

  • Hello Tom.

    Does it mean that the Unlock sequence with XDS100v2 did not work? This surprises me as the thread that Chester pointed to was a tested one.

    Regards
    Amit
  • Hi Amit,

    I was not able to get that to work.  Coming out of reset, the WDT would fire before the emulator seemed to connect to the target.

    Tom

  • Hello Tom,

    When powering up the part the reset must remain asserted. While the reset is asserted, the flash code will never execute. Now if the unlock sequence is run and then the reset released, the unlock operation will erase the main flash bank, so that when CPU reaches to execute the code there is none in the flash.

    Regards
    Amit
  • Might poster "Tom" be able to assert "Reset" externally (and manually) due to the (apparent) inability of his JTAG probe to perform that role?

    Has this "external hold of Reset" during the Unlock Process been attempted? (cannot hurt - hard to spoil an (already) rotten egg.)
  • I tried exactly that, but the emulator would not communicate with LM Flash Programmer nor with CCS.   I don't remember what the error messages were.   The impression I got was that the board-level reset signal was also resetting the emulator, but I did not tear the emulator apart to verify this...

    I am not able to try anything further because the board is currently being reworked at the CM (TIVA chip replacement).

    Tom