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.

Error connecting to the target: Unable to access the DAP

Other Parts Discussed in Thread: UNIFLASH, EK-TM4C1294XL, TM4C1294NCPDT, LMFLASHPROGRAMMER

Hi,

Target: TM4C129ENCPDT Tiva processor

Emulator: XDS100v2

IDE: Code Composer 5.5

Application Background: In this device we have an application that provides a user interface to our main product controller.  It receives/responds to messages over RS485 and USB ports while it communicates to the main controller over CAN.  This is all working fine.

I was given the task to add the proper enable and kick the watchdog to provide us with a safe reset in case the application hangs.  But after adding the code I thought was needed to enable the dog then I can no longer connect with Code Composer to flash/debug the next build over JTAG.  I receive the following error: Error connecting to the target: (Error - 1170 @ 0x0) Unable to access the DAP.  Reset the device, and retry the operation.

Here are the initialization steps in my watcdhog init function:

 

1
2
3
4
5
6
7
8
9
10
11
//Enable the peripheral
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_WDOG0);
 
// Load WDTLOAD with desired timeout count ~2.240M
ROM_WatchdogReloadSet(WATCHDOG0_BASE, WATCHDOG_TIMEOUT_COUNT);
 
// Configure watchdog timer to generate a reset by setting the
// RESEN bit in the WDTCTL register
ROM_WatchdogResetEnable(WATCHDOG0_BASE);
 
// Enable the watchdog timer
ROM_WatchdogEnable(WATCHDOG0_BASE);

I later realized that my watchdog kick function in my last build was nothing but an empty prototype so I assume or would expect the device to be constantly reset. However I can connect over our USB interface and the application seems to be working properly.

I am pretty sure this locked up condition was triggered when I added this line ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_WDOG0);.  In my first watchdog flash attempt the board was pretty much dead which correlates to my empty kick function, but I was able to re-build and flash a new version and the only code I added was this line.

How can I recover this board and re-gain JTAG flash/debug capability?

How can I keep the board in boot mode so that I can attach Code Composer or UniFlash to clear the bad applicaiton?

Thank you.

  • Hello Rafael,

    You would need to wire-out a EK-TM4C1294XL to Unlock the device as XDS100 does not support Unlock Sequence.

    Regards
    Amit
  • Amit,
    I do not understand your answer. It sounds like you are suggesting I need to purchase this product: TM4C1294 Connected LaunchPad and I need to wire-out this device. What does this mean?

    Please elaborate.

    Thank you.
  • Hello Rafael,

    When a device lockout happens (as you mentioned), the only way is to get the device in factory condition is to run the Unlock Sequence. The Unlock Sequence requires the ICDI (or LM3S FTDI boards). Since there is no standalone ICDI you would need to use a EK-TM4C1294 or a EK-TM4C123G LaunchPad which has the feature.

    Regards
    Amit
  • Hi Amit,

    Section 4.3.4.3 Recovering a “Locked” Microcontroller from the TM4C1294NCPDT Data Sheet document SPMS433M provides details on how to force the device to a full reset including flash memory erase.  This sounds like what I need to do.  Correct?

    This sequence (which I assume is all over the JTAG port) requires specific clocking and signals over the TCK/SWCLK and TMS/SWDIO pins repeated 10 times while holding the RST pin low.

    Can I do this with Code Composer 5.5 and the XDS100v2 emulator?

    Is your suggestion that we use a EK-TM4C1294XL evaluation kit so that we can modify it (as described in section 2.3.1 of SPMU365A document http://www.ti.com/lit/ug/spmu365a/spmu365a.pdf) and use it to talk to our board over JTAG and send this reset sequence?

    Thank you.

    Rafael

  • Hello Rafael,

    You have correctly identified the sequence. However XDS100v2 does not provide the sequence, unless there is a driver which can allow to do custom JTAG via XDS100v2. That is why I suggested using a LaunchPad. You can use either of TM4C123 or TM4C129 (former being the cheaper one).
    Or if you have another working TM4C board with you, you can do GPIO Bit banging to emulate the sequence.

    Regards
    Amit
  • Hi Amit,
    So Code Composer and the XDS100v2 do not support this reset, GREAT! Do other more advance (and expensive) emulators provide this advanced operations to the JTAG port?
    We have a few eval kits in house, I will move forward with this solution and get the resistors removed.
    I also have a working board with a Stellaris processor. Based on your GPIO Bit banging it sounds like I should be able to configure/wire at least 3 GIPO pins to control RST, TCK and TMS pins on the JTAG interface and emulate the sequence. Correct?

    Thanks.
    Rafael
  • Hello Rafael,

    XDS200 has the feature for SWD and JTAG s/w for Unlock but the drivers are not integrated (Been working with CCS and UNIFLASH Team to see if they can implement it).

    As for the wire out approach, it will work. I have done this on a FPGA a year back, perhaps can help build the code for you.

    Regards
    Amit
  • Hi Amit,

    I finally got my Evaluation Kit (EK) this weekend.

    I proceeded to remove all 8 resistors (6-8, 10, 11, 15, 18 and 40) called out in the SPMU365a.pdf document paragraph 2.3.1.  However, I now realize is that R40 is probably required in order for me to program the board as Code Composer fails to connect to the device with a debug session.

    Questions:

    1. Do I need Resistor 40 to program the Eval Kit board?

    2. Do I need any of the other resistors (or jumpers) in place to program the EK?

    3. I doubt that I am the first TI customer to lock the board with bad code.  Is the code to do this JTAG unlock sequence from using the ICDI available?

    4. Is there any other method (simpler hopefully) to unlock this board?  (In another one of our custom boards we use the 28335 processor.  In that one this unlock process seems much simpler.  We hold a couple of pins to ground and the processor is held in boot allowing the debugger to reconnect to the board from boot).

    5. Why is that a call like ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_WDOG0) causes the board to enter this state?

    6. The removed resistors are tiny.  What is their resistance level? Will a simple wire jumped between pins be sufficient?

    Thank you.

    Rafael

  • Hello Rafael,

    Attached is a snapshot of the board modification I have made. I have only removed the R6-8, 10, 11, 15 and 16 as shown in the red-box and then taken the JTAG/SWD from the purple marked side (after mounting a 2x7 header). No other change required.

    The code is not available but the seuqnence to unlock the part is available in the data sheet section for JTAG. I am not sure whith what was there on the custom board so really I would not comment on that. The resistances are all 0 Ohms, and so will be a shunt (almost 0).

    I am not sure why the WDOG enable would cause the device to go into such a loop unless the value programmed into it is very small causing the device to reset before a debug can be enabled.

    Regards

    Amit

  • Amit,

    I am stuck with the eval kit as I removed too many resistors (R40 per TI documentation) and now CC cannot connect to the target.  I will experiment with another EK at some other point.

    For now I am using another board and I have a couple of GPIO pins set for me to do the bit banging approach.

    Question: Does the JTAG-SWD and SWD-JTAG switch commands (0xE79E and 0xE73C) over the TMS/SWDIO signal require any type of start and stop bits like in a RS-485 or this is just raw 16 bit transmission?

    Thank you.

    Rafael

  • Hello Rafael

    No. The SWD-JTAG switch does not require a start bit. Did you remove any other resistor other than that mentioned in the picture. Also if you have the berg pin headers mounted, you can use a shunt to get back CC function on the ICDI. I do that all the time with my modified board (as shown in picture)

    Regards
    Amit
  • Hi Amit,
    Yes I removed R-40 as it is listed as one of the 8 resistor to remove in TI's document. In the same section it later indicates that R-40 is needed to connect the debugger. Yesterday I attempted to solder a piece of wire over the R-40 contacts and by mistake heated C5 (I assume this is a capacitor) and it fell off. So now I think that my EK board is in need of repairs beyond my abilities and equipment. I will ask the tech at the plant next week to take a look at it and see if he can fix it.

    Do you know what is the capacity of C5?

    Thank you.
    Rafael
  • Hello Rafael,

    That is listed in the BOM. C5 = 0.1uF 16V 10% 0402 X7R

    Come on you can solder it!!!

    Regards
    Amit
  • Hi Amit,
    I appreciate the vote of confidence on my soldering abilities but these components are tiny. Hopefully our tech with his expertise and tools can fix it. Otherwise we will have to toss this one out. We have a few more of EK boards in the shelve at the office.

    One more question: The Tiva TM4C1294NCPDT datasheet section 27.5 list the TCK operational clock frequency from 0-10MHz. With this I assume that any frequency less that 10MHz will work. I am approaching this clocking sequence with a 100Hz frequency on the TCK. Will this work, or do you recommend any other specific frequency?

    Thank you.
    Rafael
  • Hello Rafael,

    We normally run it at 100KHz. Please note that the requirement of 0-10MHz is because the device can work up to 120MHz. The JTAG Clock must be up to 1/10 of the System Clock Frequency.

    Regards
    Amit
  • Hi Amit,
    Late last week I was able to use one of our other products (based on a TI 28335 processor) to unlock my Tiva Processor. I used 2 GPIO pins (one to control the TCLK pin and another to control the TMS pin in the JTAG connector while holding the reset down) to generate the proper bit-bang sequence as you suggested.

    This sequence is adequately described in the Tiva Data Sheet section 4.3.4.3 Recovering a "Locked" Microcontroller.

    Thank you.
    Rafael
  • Hello Rafael,

    Thank you. For quite some time we have been advocating use of existing uC boards to be able to run the sequence. Elpotronic has a neat program-unlock standalone unit (though costly) but can do more than what LMFlashProgrammer does.

    Regards
    Amit