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.

tm4c123gh6pm connection failed when tried to use high speed internal clock

Other Parts Discussed in Thread: TM4C123GH6PM

Hi All,

I have my board with tm4c123gh6pm TI processor.

With default clock settings I was able to connect to board using XDS100v2-ARM.

I wanted to get higher clock speed so tried to set PLL with following values.

SysCtlClockSet(SYSCTL_SYSDIV_64 | SYSCTL_USE_PLL | SYSCTL_OSC_MAIN | SYSCTL_XTAL_16MHZ);

After this my board stop connecting and it is giving below error.

CORTEX_M4_0: Error connecting to the target: (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 6.0.222.0)

Anyone has any information about how to recover.

  • I'm aware of similar issues with other Cortex M4 devices, but miss specific experience with the TM4C.

    But I would debug into the SysCtlClockSet() function. Does it succeed ? Often (in implementations I know), the PLL setting operation is followed by a "while (PLL_FLAG != TRUE)" loop, which you will not pass on error.

    A second common mistake - the Flash interface must be configured properly beforehand, especially the number of wait states required for the core clock frequency. Else, the core will soon drift into the wild ...

    Losing the JTAG connection might point to the latter case.

  • Yes, Indeed connection lost.
    1. I was not checking PLL_FLAG
    2. I would have just debuged, but I loaded code which is wrong step.
    3. Now I lost connection, checking how to recover from it.
  • 1. I was not checking PLL_FLAG

    I'm sure you don't need to.

    In CMSIS-compliant environments, the clock setup is done in the SystemInit() function before calling main - with the source code available and part of the project. I'm pretty sure the TivaWare/ROM function SysCtlClockSet() does check for this flag.

    Are you sure your parameters are correct ? A wrong XTAL frequency, clock source, divider or PLL multiplicator can throw you off, too. Not sure how SysCtlClockSet() handles this.

    3. Now I lost connection, checking how to recover from it.

    Usually by erasing/downloading an updated application, or re-run within the IDE/debugger.

    Make sure to stop execution in the debugger at the reset vector. Depending on the toolchain, this is usually called "Break at reset" (need to be enabled) or "Run to main" (must be disabled).

  •   

    Thank you for help.

    I can see that there is option 

    Auto Run option -> Run to symbol -> main

    on program load or restart

    On a reset

    As I dont have crystal oscillator connected and I have configured it to. So CPU must be looking for external clock. so somehow I need to break that use internal clock or default clock.

    Will on a reset help.

  • All the TivaWare examples (I know of) call ROM_SysCtlClockSet() from within main(), so "run to main" would not do any harm in your case.

    As said, the CMSIS default behavior is different ...

    As I dont have crystal oscillator connected and I have configured it to.

    You better consult the documentation/source, but the name "SYSCTL_XTAL_16MHZ" suggests a quartz (external clock source) of 16MHz.This would not be correct in your case.

  • Thank you.

    I checked documentation, It doesnt help much info for this function. Next step which I can try is connect external oscillator this may recover board.
  • I checked documentation, It doesnt help much info for this function.

    Here are several TM4C experts around, hopefully one can give you definitive advice ...

    Next step which I can try is connect external oscillator this may recover board.

    That shouldn't be necessary. Connection gets lost once the incorrect clock setup is executed. Any debugger that can break/stop execution before that should do (might require NRST to be wired).

  • sachin gole said:

    I wanted to get higher clock speed so tried to set PLL with following values.

    SysCtlClockSet(SYSCTL_SYSDIV_64 | SYSCTL_USE_PLL | SYSCTL_OSC_MAIN | SYSCTL_XTAL_16MHZ);

    So - by "raising the divisor" (to 64) you chased, "Higher clock speed?"   That's incorrect - is it not?

    If divide by 4 yields 50MHz - divide by 64 yields 1/16th of that frequency - does it not?

    And - as a result - your JTAG clock is FAR TOO FAST - for your "Turtle Speed, throttled back" MCU.

    You must clear or recover the MCU (via the Utility tab) to restore it to operation.   Normally done via LM Flash Programmer utility program.

    Reducing the value of "SYSDIV" - not raising - is the method to achieve higher System Clock Speed...

  • Hello Sachin

    sachin gole said:
    SysCtlClockSet(SYSCTL_SYSDIV_64 | SYSCTL_USE_PLL | SYSCTL_OSC_MAIN | SYSCTL_XTAL_16MHZ);

    I see two fundamental problems

    1. There is no main oscillator. The PLL is going to go crazy trying to lock

    2. The system clock is 6.25 MHz which is lower than the 1/10 requirement of the JTAG clock if the JTAG clock is set to 1MHz

  • 1. There is no main oscillator. The PLL is going to go crazy trying to lock

    [Sachin] Ok Understood, Its mistake. Lets think on How to recover.

    2. The system clock is 6.25 MHz which is lower than the 1/10 requirement of the JTAG clock if the JTAG clock is set to 1MHz

    Ok I can see that "CCS" Dubug configuration -> Target -> Flash settings -> Crystal frequence 8 MHz 

    Q1 If I reduce this value. Will I able to connect to My board. ?

    Q2. If above answer is Yes then what is better value to connect to my board "Dubug configuration -> Target -> Flash settings -> Crystal frequence " -> ????

    Q3.  Guru says : - "You must clear or recover the MCU (via the Utility tab) to restore it to operation.   Normally done via LM Flash Programmer utility program.

    As per datasheet  page 9. LM flash doesnt support XDS100v2.

    • I have developed board which doesn't have crystal connected.
    • I have XDS 100v2 debug JTAG
    • Somehow I set lower clock freq than JTAG clock freq. 

    How to recover to get board connected.