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.

TM4C123BH6ZRB: Question on recovering a locked microcontroller

Part Number: TM4C123BH6ZRB
Other Parts Discussed in Thread: SEGGER, UNIFLASH

I have this processor working as expected and added the read-only protection for internal flash from 0x31800 to 0x33FFF by wrote 0xFFFFFF07 to FLASH_FMPPE3. The read-only protection works and saved correctly (wrote 7 to FLASH_FMA and FLASH_FMC_WRKEY | FLASH_FMC_COMT to FLASH_FMC). For some reasons, I was not able to recover by doing the mass erase sequence. Please comment.

My sequence is:

1. Assert and hold the RST signal. Apply power to the device.

2. Using Segger JLink commander to switch to SWD ("si 1") and back to JTAG ("si 0") 5 times.

3. Deaasert RST.

4. Wait for several seconds.

5. Power cycle the microcontroller.

Do you think the Segger JLink commander "si 0/1" to switch between JTAG and SWD? On paper, it should but I am not sure why the recovering is not working for me.

Thanks,

Dennis N

  • Hi Dennis,
    Your sequence seems correct according to the datasheet but just wanted to confirm one thing with you. In your step 2, you wrote "switch to SWD ("si 1") and back to JTAG ("si 0") 5 times.". I justed wanted to make sure if first switch from JTAG to SWD and then from SWD to JTAG for five times. Are you able to probe the SWDIO for the preamble 0xE79E as the command sent by the debugger to the MCU when switch from JTAG to SWD and 0xE73C when switching from SWD back to JTAG?

    Do you have other emulators that you can also try?
  • Charles,

    Yes to clarify for step 2.

    I am using this Segger JLink for both JTAG (TM4C) and SWD (Kinetis Cortex M0) processors for loading and debugging therefore I am very sure that the SWDIO commands are correct. Can we make sure that the sequence in the datasheet is correct?

    Thanks,

    Dennis
  • May I note that our firm has LONG used that same J-Link - under SWD (exclusively) for both TM4C123 and past LX4F/LM3S - with great success.

    We deploy those 2 "saved" Port C GPIO - thus we have "no need" to implement the JTAG<->SWD switch-overs.
  • Hi Dennis,

     If you have a spare TM4C123 LaunchPad board then you can use it as a debug probe for your custom board and use the LM Flash Programmer to unlock the part. If you have other emulators such as XDS100 or XDS200 then you can use them in conjunction with Uniflash to unlock your part. Please take a look starting from section 5.3 of the app note here.

      Search for 'unlock' in this diagnostic post will also provide some hints.

    Diagnosing Common Development Problems and Tips & Info for TM4C Devices - Arm-based microcontrollers...

    e2e.ti.com
    Other Parts Discussed in Thread: UNIFLASH , LMFLASHPROGRAMMER , EK-TM4C123GXL , TM4C123GH6PM Hello Forum Members, The Post intends to highlight some of the common

     

  • Dennis Nguyen - Flex said:
    Do you think the Segger JLink commander "si 0/1" to switch between JTAG and SWD?

    From looking at the J-Link documentation think the issue might be that the "si" command just selects the target interface to be used, without actually sending the switching sequence.

    There is the SWDSelect command for which the J-Link Command help text explicitly states that it outputs the JTAG -> SWD switching sequence:

    SWDSelect  Selects SWD as interface and outputs
               the JTAG -> SWD switching sequence.

    However, I can't find an equivalent command to output the SWD -> JTAG switching sequence.

    There are commands to control the individual JTAG lines, so may could bit-bang the JTAG -> SWD sequence but a bit tedious:

    ---- JTAG-Hardware ---
    c00        Create clock with TDI = TMS = 0
    c          Clock
    tck0       Clear TCK
    tck1       Set   TCK
    0          Clear TDI
    1          Set   TDI
    t0         Clear TMS
    t1         Set   TMS
    trst0      Clear TRST
    trst1      Set   TRST
    r0         Clear RESET
    r1         Set   RESET

    The J-Link script JTAG_Write function may allow a simpler generation of the required sequence to switch from SWD -> JTAG and JTAG -> SWD since JTAG_Write can write up to 64 bits per pin.

  • Thank you all for your quick inputs. With my development environment, I think my shortest route is to use J-Link script. You have a great day,

    Dennis