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.

Cannot program FLASH for the second time

Other Parts Discussed in Thread: TM4C1231D5PM, TM4C1231H6PM, CCSTUDIO, TM4C123GH6PM, UNIFLASH

TivaC TM4C1231D5PM, CCS 6.0.1.00040, XDS100v2 BlackHawk.

I have produced a new pcb with TM4C1231. The first programming by CCS is without problem, but debugging or next programming FLASH is not possible. Downloaded code was running (debugging) on older pcbs without problem. I have not locked JTAG by my code!

********** Console output ***************

CORTEX_M4_0: GEL Output:
Memory Map Initialization Complete
CORTEX_M4_0: JTAG Communication Error: (Error -1170 @ 0x0) Unable to access the DAP. Reset the device, and retry the operation. If error persists, confirm configuration, power-cycle the board, and/or try more reliable JTAG settings (e.g. lower TCLK). (Emulation package 5.1.636.0)
CORTEX_M4_0: Failed to remove the debug state from the target before disconnecting. There may still be breakpoint op-codes embedded in program memory. It is recommended that you reset the emulator before you connect and reload your program before you continue debugging.

******************************************

Strange, horrible, unbelievable!

Thak for your advice!

Jan

  • Hello Jan,

    Besides JTAG pins being turned to GPIO, can you check the clock configuration, BOOTCFG or use of deep sleep mode in the code?

    Regards
    Amit
  • Hello Amit,

    I there any difference between TM4C1231h6PM and TM4C1231d5pm. May be yes.

    I used this PORTC configuration on TM4C1231H6PM. Everything worked correctly.

    // PORT C
    // 7: BUTTON4
    // 6: BUTTON3
    // 5: DMX_TXD
    // 4: DMX_RXD
    // 3: JTAG_TDO
    // 2: JTAG_TDI
    // 1: JTAG_TMS
    // 0: JTAG_TCK
    GPIO_PORTC_AHB_DIR_R = 0x00; // Set the GPIO direction as input
    GPIO_PORTC_AHB_DEN_R = 0xF0; // Enable the GPIO pin for digital function.
    GPIO_PORTC_AHB_PUR_R = 0xF0; // Pull-up resistors enable
    GPIO_PORTC_AHB_AFSEL_R = 0x3F; // Alternate Function UART + JTAG
    GPIO_PORTC_AHB_PCTL_R = GPIO_PCTL_PC4_U4RX +
    GPIO_PCTL_PC5_U4TX +
    GPIO_PCTL_PC3_TDO +
    GPIO_PCTL_PC2_TDI +
    GPIO_PCTL_PC1_TMS +
    GPIO_PCTL_PC0_TCK;


    Some other messages:

    **********************************
    Error connecting to the target:
    (Error -1063 @ 0x0)
    Device ID is not recognized or is not supported by driver. Confirm device and debug probe configuration is correct, or update device driver.
    (Emulation package 5.1.636.0)
    **********************************
    CORTEX_M4_0: GEL Output:
    Memory Map Initialization Complete
    CORTEX_M4_0: JTAG Communication Error: (Error -1170 @ 0x0) Unable to access the DAP. Reset the device, and retry the operation. If error persists, confirm configuration, power-cycle the board, and/or try more reliable JTAG settings (e.g. lower TCLK). (Emulation package 5.1.636.0)
    CORTEX_M4_0: Failed to remove the debug state from the target before disconnecting. There may still be breakpoint op-codes embedded in program memory. It is recommended that you reset the emulator before you connect and reload your program before you continue debugging
    **********************************

    Thanks
    Jan
  • Hello Jan,

    The following line has broken the JTAG function by clearing the Digital Enable function

    GPIO_PORTC_AHB_DEN_R = 0xF0; // Enable the GPIO pin for digital function.

    The actual method must have been as follows to retain JTAG function.

    GPIO_PORTC_AHB_DEN_R |= 0xF0; // Enable the GPIO pin for digital function.

    Regards
    Amit
  • Hello Amit,
    it is corrected, but only small difference. There is still problem.

    The port initialization section I sent you before, works perfectly without no problem in TM4C1231H6PM. I can load program, debug... everything.
    If I load same code to TM4C1231D5PM, loading is ok, but after I click (Resume button F8), console displays:

    CORTEX_M4_0: GEL Output:
    Memory Map Initialization Complete
    CORTEX_M4_0: JTAG Communication Error: (Error -1170 @ 0x0) Unable to access the DAP. Reset the device, and retry the operation. If error persists, confirm configuration, power-cycle the board, and/or try more reliable JTAG settings (e.g. lower TCLK). (Emulation package 5.1.636.0)

    Jan
  • It works, because there is not used register GPIOLOCK nor GPIOCR before for unlocking storage.
    Jan
  • Hello Jan,

    Then PORT C is not the cause of the issue. Can you load your project on the device and debug the same to the point where JTAG disconnects. That would be a starting point for the debug of the function which causes the issue.

    Regards
    Amit
  • Hello Amit,
    thanks for your conversation.

    Now:
    - same code as for TM4C1231H6PM but with target config for TM4C1231D5PM
    - build
    - loaded ok
    - I am on the first line in "main" function
    - F8
    - immediatelly this message:

    *****************************************
    CORTEX_M4_0: GEL Output:
    Memory Map Initialization Complete
    CORTEX_M4_0: JTAG Communication Error: (Error -1170 @ 0x0) Unable to access the DAP. Reset the device, and retry the operation. If error persists, confirm configuration, power-cycle the board, and/or try more reliable JTAG settings (e.g. lower TCLK). (Emulation package 5.1.636.0)
    CORTEX_M4_0: Failed to remove the debug state from the target before disconnecting. There may still be breakpoint op-codes embedded in program memory. It is recommended that you reset the emulator before you connect and reload your program before you continue debugging
    *****************************************
  • Hello Jan,

    Do not use the resume button. Instead use the Step Over button to see which function execution causes the JTAG error. Do note that you may have to change optimizations to 0 (none) to ensure that the function execution and stepping over the function follow a logical flow. This is a known issue in CCS where on step execution the execution pointer seems to go to unrelated function execution out of normal flow.

    Regards
    Amit
  • Hello Amit,
    partly solved. Thanks.

    I didn't have initialized interrupt vectors in *_startup_ccs.c.

    But now, I can load program, run and debug. But only once. After terminating and then again start debugging, the problem occurs at Erasing Flash. I have to terminate and restart CCS.

    ***************************************
    CORTEX_M4_0: GEL Output:
    Memory Map Initialization Complete
    CORTEX_M4_0: JTAG Communication Error: (Error -1170 @ 0x0) Unable to access the DAP. Reset the device, and retry the operation. If error persists, confirm configuration, power-cycle the board, and/or try more reliable JTAG settings (e.g. lower TCLK). (Emulation package 5.1.636.0)
    CORTEX_M4_0: Failed to remove the debug state from the target before disconnecting. There may still be breakpoint op-codes embedded in program memory. It is recommended that you reset the emulator before you connect and reload your program before you continue debugging
    ***************************************

    After resetting CCS (not target, only CCS) loading is ok, running ok (program works) but some time (one of 6 cases) JTAG error occurs.

    Do you think, that it can be caused by code?

    Jan
  • Hello Jan,

    It could be the code. Can you share the code project so that I can run a cursory check?

    Regards
    Amit
  • No problem, please give me an email.. .or which way?
    Jan
  • Hello Jan,

    There is no startup file included in the build nor is there a cmd file for linker to place the code. Both of them are excluded from the build flow.

    Also when I compiled the code, the first thing was missing TivaWare for which it gave me a lot of errors. Fixing that I noticed next that it is giving an error for "union" declared in the header file. Are there any options that need to be added. I am using CCSv6.1 with arm 5.1.8 compiler (following is a sample of the error which you can check against the build options)

    "C:/ti/ccsv6/tools/compiler/arm_5.1.8/bin/armcl" -mv4 --code_state=32 --abi=ti_arm9_abi --include_path="C:/ti/ccsv6/tools/compiler/arm_5.1.8/include" --include_path="C:/ti/TivaWare_C_Series-2.1.0.12573" -g --display_error_number --diag_warning=225 --diag_wrap=off --preproc_with_compile --preproc_dependency="a2ButtonFunctions.pp" "../a2ButtonFunctions.c"
    "..\a2DisplayConst.h", line 28: warning #41-D: expected an identifier
    "..\a2DisplayConst.h", line 33: warning #41-D: expected an identifier
    "..\a2DisplayConst.h", line 40: warning #41-D: expected an identifier
    "..\a2DisplayConst.h", line 45: warning #41-D: expected an identifier
    "..\a2DisplayConst.h", line 103: warning #41-D: expected an identifier
    "..\a2DisplayConst.h", line 126: warning #41-D: expected an identifier
    "../a2ButtonFunctions.c", line 84: error #137: struct "<unnamed>" has no field "VarRef"
    "../a2ButtonFunctions.c", line 84: error #137: struct "<unnamed>" has no field "VarRef"
    "../a2ButtonFunctions.c", line 87: error #137: struct "<unnamed>" has no field "ScrNr"
    "../a2ButtonFunctions.c", line 91: error #137: struct "<unnamed>" has no field "VarRef"
    "../a2ButtonFunctions.c", line 94: error #137: struct "<unnamed>" has no field "VarRef"
    "../a2ButtonFunctions.c", line 98: error #137: struct "<unnamed>" has no field "VarRef"
    "../a2ButtonFunctions.c", line 98: error #137: struct "<unnamed>" has no field "VarRef"
    "../a2ButtonFunctions.c", line 98: error #137: struct "<unnamed>" has no field "VarRef"
    "../a2ButtonFunctions.c", line 102: error #137: struct "<unnamed>" has no field "VarRef"
    "../a2ButtonFunctions.c", line 102: error #137: struct "<unnamed>" has no field "VarRef"
    "../a2ButtonFunctions.c", line 102: error #137: struct "<unnamed>" has no field "VarRef"
    "../a2ButtonFunctions.c", line 106: error #137: struct "<unnamed>" has no field "VarRef"
    "../a2ButtonFunctions.c", line 109: error #137: struct "<unnamed>" has no field "VarRef"
    "../a2ButtonFunctions.c", line 167: error #137: struct "<unnamed>" has no field "Enter"
    "../a2ButtonFunctions.c", line 181: error #137: struct "<unnamed>" has no field "Enter"
    "../a2ButtonFunctions.c", line 188: error #137: struct "<unnamed>" has no field "Enter"
    "../a2ButtonFunctions.c", line 191: error #137: struct "<unnamed>" has no field "Enter"
    "../a2ButtonFunctions.c", line 198: error #137: struct "<unnamed>" has no field "EnterAction"
    "../a2ButtonFunctions.c", line 202: error #137: struct "<unnamed>" has no field "Enter"
    "../a2ButtonFunctions.c", line 206: error #137: struct "<unnamed>" has no field "Enter"
    20 errors detected in the compilation of "../a2ButtonFunctions.c".



    Regards
    Amit
  • Hello Amit,
    there is "AST2_FW00\tm4c1231d5pm_startup_ccs.c".
    In terms of the union, please set:
    Properties/Build/ARM Compiler/Advanced Options/Language Options/Language mode to "Relaxed parsing..."
    Jan
  • Hello Jan,

    More issue uncovered.

    General Device endianess is "little" and not "big". Output format must be eabi
    Build -> ARM Compiler -> Processor Options: --silicon_version must be 7M4, --code_state 16 and --float_support FPv4SPD16

    I would suggest loading a default project from TivaWare to make sure all settings are corrected first. After making corrections I could get it to execute using Step debugging. Close CCS, erase and launch.

    Regards
    Amit
  • I have it set as you describe. Everything.
    May be you have opened bad project file.

    Jan
  • Hello Jan

    I imported the project file in CCSv6.1 and that is what I saw. Also to double check I opened the zip files .cproject file in a text editor. Below lines indicate you have loaded a TMS470 class device and not a TM4C class device.

    <listOptionValue builtIn="false" value="DEVICE_CONFIGURATION_ID=com.ti.ccstudio.deviceModel.TMS470.GenericARM7Device"/>
    <listOptionValue builtIn="false" value="DEVICE_ENDIANNESS=big"/>

    Regards
    Amit
  • 8055.AST2_FW00.ZIP

    Here is a new one with settings shown in the picture.

    J an

  • Hello Jan,

    OK. So the issue was that you had Release configuration made active while it was setting Debug Configuration on my side. I do not have the same device as you have but followin snapshot shows that it works all the time for me on a TM4C123GH6PM device. I can step-run-halt-disconnect-connect without any issues.

    Regards

    Amit

  • Hello Amit,
    yes, I can do it too, but only on TM4C1231H6PM. Not on D5PM.
    Jan
  • Hello Jan,

    I have noticed that you are doing a custom clock configuration. Can you replace this with SysCtlClockSet function instead? The steps in your current configuration are not correct.

    Regards
    Amit
  • Hello Amit,
    some progress...
    Hardware problem: The inductor in power supply filter had too much resistance. After replacing, it is prety much better. However some boards have problem (UniFlash Console message):

    ****************************
    [01:29:51] FATAL >> CORTEX_M4_0: Error connecting to the target: (Error -1063 @ 0x0) Device ID is not recognized or is not supported by driver. Confirm device and emulator configuration is correct, or update device driver. (Emulation package 5.1.402.0)
    ****************************

    All bad boards have this same problem. It seems to be locked JTAG, but I do not know why, because you saw code, it was without problem.
    Any opinion?

    Thanks. Jan.
  • Hello Jan,

    I would suggest checking the Voltage on the main rails. May be it is dipping close to the BOR threshold of the device causing resets.

    Regards
    Amit