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.

CORTEX_M4_0: Error connecting to the target

Other Parts Discussed in Thread: LMFLASHPROGRAMMER, TM4C123GH6PM, EK-TM4C1294XL

Everything was working fine, i was calling SysCtlClockFreqSet with different combinations.

like

1.SysCtlClockFreqSet((SYSCTL_XTAL_25MHZ | SYSCTL_OSC_MAIN | SYSCTL_USE_PLL | SYSCTL_CFG_VCO_480), 120000000);
2.sysfreq = SysCtlClockFreqSet(SYSCTL_XTAL_25MHZ |SYSCTL_OSC_MAIN | SYSCTL_USE_OSC, 120000000);
3.sysfreq = SysCtlClockFreqSet(SYSCTL_OSC_INT  | SYSCTL_USE_OSC, 120000000);
4.sysfreq = SysCtlClockFreqSet(SYSCTL_OSC_INT| SYSCTL_USE_PLL | SYSCTL_CFG_VCO_480, 120000000);

but when i did  this ==> sysfreq = SysCtlClockFreqSet(SYSCTL_OSC_EXT32, 120000000);

am not able to connect to target now it's showing "CORTEX_M4_0: Error connecting to the target "

is my board is having a serious issue now, can somebdy help me.

  • Hi shaik

    Maybe you don't have a external oscilator and that's the problem?

    Try using LM Flash Programmer and erase the entire flash: 

    http://www.ti.com/tool/lmflashprogrammer 

  • Hey Luis,

    Thanks for the prompt response.

    Now my device is not detected as ICDI, the device manager shows it as "Device Firmware Upgrade" :(

    Am Using "Tiva C Series TM4c1294 Connected Launchpad"


    I think my ICDI firmware needs upgrade; any idea on how to do this?

  • i doubt it needs a upgrade.

    Try restarting. If your using it, Windows is just a complete moron with coms...
    Or simply uninstalling the drivers and re-instaling them

  • Hi Shaik,

         Try LM Flash Programmer "Debug Port Unlock Utility".

    - kel

  • Hello Shaik,

    The PLL can be locked only from the Main Oscillator or the PIOSC for higher frequency operation. The EXT32 is not a valid clock source for the PLL.

    Also as the System Clock Source of 32K, there are two important things

    1. The JTAG clock cannot be more than 1/10 of the System Clock so you would have to scale the JTAG Clock Frequency

    2. The System Clock of 32K from the 32K HIBXOSC requires, hibernate to be activated. Without being activated you may end up with a flatline system clock.

    Kel's post is the correct way to unlock/recover the device.

    Regards

    Amit

  • Shaik,

    There are some problems with your configuration:

    a) you cannot get 120MHz without PLL; 32KHz oscillators can be used only for lower system clock. See the user manual page 231, table 5.3. More, the clock is disabled at POR - if we speak about the existing XOSC, 32 KHz - since you do not mention anything about your hardware. 

    b) if you still attempt to use this oscillator linked to hibernation module, then you must enable it also (both module and clock) as specified on pages 239-240 in user manual.

    c) take care about the JTAG settings: works only at system clock/8.

    Petrei

  • It's all fine with my board after i did the following using LM Flash Programmer:

    1. ICDI Firmware Update

    2. Debug Port Unlock in this way:

     - disconnect the USB,
     - click unlock,
     - confirm with yes
     - on next MsgBox hold reset, connect
     - click ok, while still holding reset
     - release reset
     - power cycle board (and restart Flash tool?)
     - after that the programming works

    Hurray... TI Rocks..!

    Thanks everyone.

    --Shaik

  • I had the same problem. So i tried your procedure. Initially ICDI firmware updated successfully. But it is unable to unlock, Error is "Failed to unlock connected device." And now it does not even show the device in device manager. Please help me solving this issue.
  • I had the same problem. So i tried LM Flash Programmer. Initially ICDI firmware updated successfully. But it is unable to unlock, Error is "Failed to unlock connected device." And now it does not even show the device in device manager. Please help me solving this issue.
  • Hello Rajat,

    Which LaunchPad are you using? And on connecting the power what does the device manager (snapshot) shows?

    Regards
    Amit
  • Hello Amit,

    I am using TM4C123GH6PM controller. It does not display anything in device manager about the controller. I tried on different computers and also re-installed code composer. It did not solve my issue.

  • Hello Rajat

    It seems that the ICDI driver has been corrupted. You may have to order a new LaunchPad.

    Regards
    Amit
  • Hello, 

    As suggested by Amit I bought new Launchpad. It worked fine for other examples, but like before when I burned following code, it is showing 

    Cortex_M4_0: Error connecting to the target

    Earlier I had same issue with the same program. I think there is some problem in code. Please help me out...

    The code is :

    #include <stdint.h>
    #include "inc/tm4c123gh6pm.h"


    // port B is for D0-D7
    // PC5 is rs
    // PC6 is rw
    // PC7 is en
    // PB7 is busy

    // have to initialise port B and port E
    #define ldata (*((volatile unsigned long *)0x400053FC)) // bits 7-0 of port B
    #define rs (*((volatile unsigned long *)0x40006080))
    #define rw (*((volatile unsigned long *)0x40006100))
    #define en (*((volatile unsigned long *)0x40006200))
    #define busy (*((volatile unsigned long *)0x40005200))

    unsigned char string[]={'*','*','M','O','R','Y','A','*','*',' '};

    void lcd_cmd(unsigned char value);
    void lcd_data(unsigned char value);
    void lcd_ready(void);
    void sendString(void);

    void delay(unsigned int itime)
    {
    unsigned int i,j;
    for(i=0;i<itime;i++)
    for(j=0;j<50;j++);
    }

    void sendString()
    {
    char i;
    for(i=0;i<14;i++)
    {
    lcd_data(string[i]);
    }
    }

    void lcd_cmd(unsigned char value)
    {
    //lcd_ready();
    ldata=value;
    rs=0;
    rw=0;
    en=1;
    delay(5);
    en=0;
    return;
    }
    void lcd_data(unsigned char value)
    {
    //lcd_ready();
    ldata=value;
    rs=1;
    rw=0;
    en=1;
    delay(5);
    en=0;
    return;
    }

    void lcd_ready()
    {
    busy=1;
    rs=0;
    rw=1;
    while(busy==1)
    {
    en=0;
    delay(5);
    en=1;
    }
    return;
    }

    void PortB_Init(void){ volatile unsigned long delay;
    SYSCTL_RCGC2_R |= 0x02; // 1) activate Port B
    delay = SYSCTL_RCGC2_R; // allow time for clock to stabilize
    // 2) no need to unlock PB7-0
    GPIO_PORTB_AMSEL_R &= ~0xFF; // 3) disable analog functionality on PB7-0
    GPIO_PORTB_PCTL_R = 0x00000000; // 4) configure PB7-0 as GPIO
    GPIO_PORTB_DIR_R |= 0xFF; // 5) make PB7-0 out
    GPIO_PORTB_AFSEL_R &= ~0xFF; // 6) disable alt funct on PB7-0
    GPIO_PORTB_DR8R_R |= 0xFF; // enable 8 mA drive on PB7-0
    GPIO_PORTB_DEN_R |= 0xFF; // 7) enable digital I/O on PB7-0
    }

    void PortC_Init(void){ volatile unsigned long delay;
    SYSCTL_RCGC2_R |= 0x04; // 1) activate Port C
    delay = SYSCTL_RCGC2_R; // allow time for clock to stabilize

    GPIO_PORTC_AMSEL_R &= ~0x07; // 3) disable analog function on PC1-0
    GPIO_PORTC_PCTL_R &= ~0x00000FFF;// 4) configure PC1-0 as GPIO
    GPIO_PORTC_DIR_R &= 0x07; // 5) make PC1-0 in
    GPIO_PORTC_AFSEL_R &= ~0x07; // 6) disable alt funct on PC1-0
    GPIO_PORTC_DEN_R |= 0x07; // 7) enable digital I/O on PC1-0
    }

    int main()
    {
    PortB_Init();
    PortC_Init();

    //lcd_cmd(0x3C); /* 10x5 dot matrix, 2 line dislay, 8 bit data line*/
    lcd_cmd(0x38); // 8 BIT DATA , 2LINE, 5X7 DOT MATRIX
    lcd_cmd(0x0E); // DISPLAY ON, CURSOR ON, NO BLINK
    lcd_cmd(0x01); //CLEAR DISPLAY
    sendString();
    while(1)
    {
    }
    }

  • Hello Rajat,

    The change of Port C pins 0-3 properties has caused the device to lose JTAG function. Unlock Sequence is required to revert the device to the factory condition

    Regards
    Amit
  • Hello Amit,
    what is the unlock sequence then...
    how can i reset it to factory setting?
  • Hello Rajat,

    You would need to use the LMFlashProgrammer with the ICDI to unlock it

    e2e.ti.com/.../374640

    Regards
    Amit
  • Thanku so much Amit... It worked
  • Hi Luis

    thanks you so much 

  • Hi Amit et team,
    I have an EK-TM4C1294XL launchpad and obtained the same problem which started this thread. I then used your LM Flash Programmer instructions to reset my unit to resume CCS debug & programming. After performing the procedure listed by  shaik it works in LM Flash as I can then reprogram it there fine. But in CCS still hangs!

    Summary

    • I can take the blinky.bin and use LM Flash to program this, validation by reseting the board and confirming the blink of D2.
    • I next close LM Flash and open blinky in CCS, then select Run->Debug. Now CCS just hangs, with Progress showing a state of 'Launching Blinky/Launching Debug Session:'. It hangs indefinetly here.

    Question(s)

    • Is this expected? How to get my TM4C1294XL to work in CCS again :(? Is my board bricked??
  • Hello Justin

    Your board is not bricked as you can work with LMFlashProgrammer. The issue may be in the CCS Studio workspace itself. I would suggest posting the issue on CCS Forum on searching for similar issues of CCS getting stuck during download in CCS forum
  • Thank you Amit! You gave me another nudge of emphasis, and I gave it one more shot. And this time, for some magical reason it worked!! :)!

    Thank you :)!!

    -J

  • Hello Justin,

    As in create a new workspace?
  • My solution was strange, but it worked. What I had to end up doing was

    1. Create a new project
    2. Manually reconfigure it's configuration and project preferences
    3. copy and paste the .C and .H files from the old project

    and then it works!! :)!

    Why? Heck if I know. Or care - back working now :)!