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.

TM4C123GH6PGE: Clock Setting problem on custom board with tm4c123gh6pge

Part Number: TM4C123GH6PGE
Other Parts Discussed in Thread: UNIFLASH, LMFLASHPROGRAMMER

Hello Everyone!

We are trying to program tm4c123gh6pge on our custom board for a project which uses ADC and CAN.

At first we didn’t entered any clock setting and it runed at 16mhz with PIOSC. With this clock ADC worked but CAN did not. So we tried to run our tm4c123gh6pge at 80mhz and used the code below for this:

SysCtlClockSet(SYSCTL_SYSDIV_2_5 | SYSCTL_USE_PLL | SYSCTL_OSC_MAIN | SYSCTL_XTAL_16MHZ);


But when this code runs (we debugged it and see) tm4c123gh6pge stop responding like it is completely death.

We have already broken 4 of our boards by just adding this code and read the datasheet, searched the internet can’t figure it out why.

What can be the problem and is there a way to recover our broken boards? Any help will be appreciated.


Note: We are using tm4c 1294xl development boards to test our code so we are sure our code is good.

Note2: We use Code Composer Studio to program and debug our board via 1294 development board from tm4c123gh6pge's JTAG pins.

  • What can be the problem and is there a way to recover our broken boards?

    To recover the boards try to run the Device Unlock Sequence using LMFlashProgrammer or UNIFLASH - see ISSUE#6: JTAG connects, the program loads but on RUN JTAG connection breaks.. in Diagnosing Common Development Problems and Tips & Info for TM4C Devices

    So we tried to run our tm4c123gh6pge at 80mhz and used the code below for this:

    That code looks OK. Can you confirm there is a 16 MHz crystal connected to your custom board?

  • Hello Chester,


    I followed the steps in the article you sent to reset our custom board with LM Flash Programmer, then I power cycled the board, but when I try to erase entire flash, I get the following error:

    ERROR: Cannot find target device

    Yes I am sure that the 16MHz crystal is connected to our board. Schematic is:

  • Can you verify with a scope that you have a 16MHz clock signal on pin 93 (OSC1)?

  • Hello Bob!

    I measured the 93th pin of my MCU, and it seems there is nothing there.

    What could be the reason of this? Is there anything wrong about connections? 

  • Since this is a new board, I suspect a wrong connection. The schematic looks correct, but perhaps the footprint of the crystal was wrong, or the crystal was mounted incorrectly. I would start by checking the layout Gerber, or using an Ohm meter to check out a blank PCB.

  • Hello Bob thanks for the advice,

    The crystal oscillator is really incorrectly soldered. I fixed this first, now the signal I get from pin 93 is as follows, although I see a little ripple, there is a sinusoidal signal.

    However, I still get a no target error when I try to program the card. Same error persists in LM flash programmer.

    I wonder if I have damaged the some part of MCU because I tried to configure it without OSC?

  • What scan controller are you using (JTAG hardware) when programming the board? Is it revision 6 or revision 7 silicon? Revision 7 is less likely to lock in a state that cannot be recovered. See page 4 of the errata document to see how to tell which version you have. I would try again the "Steps for Recovering a Locked Microcontroller" suggested by Chester and detailed here:

    https://e2e.ti.com/support/microcontrollers/other-microcontrollers-group/other/f/other-microcontrollers-forum/310876/jtag-communication-failures

  • I am using TM4C129ENCDPDTI3 development board JTAG pins for programming my custom board.


    I can not see any number at the end of the third line on my MCU. it's just GH6PGEI. So I did not find out what is the silicon revision. 

    Also when I clicked the Get Current MAC Address on the LM Flash Programmer, I get this warning:

  • No number at the end of line 3 means that this is rev 6 silicon. Unfortunately that silicon is more prone to corruption when given a bad clock. It may not be able to be recovered. Now that the crystal has been corrected does the customer have another board that has not yet been programed, or can the replace the part on one of the original four boards?

  • Luckily we have cards that have not been programmed yet. First I will fix their crystals and then I will program them.
    Thanks for your help, but I would appreciate if you do not close the topic, I can write here again for a problem that may occur after programming.

  • Hello Bob.

    I fixed the crystal of one of the cards I had never used before and tried to program it, even though I did it the same way as my previous programming, I got an error like this:

    CORTEX_M4_0: GEL Output:
    Memory Map Initialization Complete
    CORTEX_M4_0: File Loader: Verification failed: Values at address 0x00000000 do not match Please verify target memory and memory map.
    CORTEX_M4_0: GEL: File: C:\Users\ABC\Desktop\abc\blinky\Debug\blinky.out: a data verification error occurred, file load failed.
    CORTEX_M4_0: Error: Debug Port error occurred.

    Any ideas as to what causes this error?

  • It is a program verification error. Can you connect with Code Composer Studio and use a Memory Browser window to look at the contents of location 0?

  • Hello!

    I can not connect with Code Composer Studio. When I click debug to use Memory Browser on CCS it gives me that same error. Is there any other way to see it? It actually make me confused, why is the some change of the crystal is blocking to connect to MCU? It's pins look like right connected.

    By the way the crystal on my custom board is: https://abracon.com/Resonators/ABM8G.pdf

    And the connection right now is:
    Crystal's 1st pin is connected to MCU's 93th pin, Crystal's 3rd pin is connected to MCU's 92th pin. And Crystal's 2nd and 4th pins are connected to the grond.

    Do I need to flip Crystal's 1st and 3rd pins?

  • No, you do not need to flip the crystal's 1st and 3rd pins. I suspect this problem is not related to the crystal. Remember, you were able to connect and program blank parts when the crystal connections were incorrect until you programmed code that tried to use the crystal. Since this is a new board, I would first suspect a different assembly error. You might want to try a different board. Unfortunately the Stellaris ICDI does not support special test modes for debugging JTAG connections. However, you might try to verify that you get TCK, TDI and TMS to the correct pins and that TDO toggles when you try to "connect" to the target. Here is some information on JTAG that might help:

    https://www.ti.com/lit/an/spma075/spma075.pdf

  • Hello,

    I measured the outputs of all JTAG pins with an oscilloscope during programming. Above are the images during successful programming (with the Crystal connected in reverse). Below are the images during the failed programming (with the crystal connected correctly).

    TCK pin:

    TMS pin:

    TDI pin:

    TDO pin:

    They all have one common difference, the last signal during programming.

    More interesting part of this case is, when I flip the Crystal to reverse again it started to programming.

    Can we get a clue as to what the problem is from here?

  • My best guess (and it is only a guess) is that the oscillator waveform is not correct. Perhaps the undershoot is affecting the level and the device is seeing a double clock edge and locking up. Without a high impedance scope probe, looking at the oscillator waveform distorts it. You might try removing the external crystal on one of the boards that no longer works and retry the unlock sequence.

    The ABRACON AABMM-16.0000MHz-10-D-1-X-T crystal is listed as simulated and confirmed to operate within the specification of the TM4C123GH6PGE. The crystal you are using is not listed, but that does not mean it will not work. 

  • Hello Bob,

    I am going to buy a crystal which you mentioned and see what is going to happen, I think there is no other option to replace it to different model.

    If you come up with a new idea, I'm open to it. 

    Thanks for helping.

  • OK, I am asking one of my colleagues to follow this thread as I am retiring after today.