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.

TMS320F280039C: Can't unlock the jtag with the correct password after enable the JTAGLOCK function

Part Number: TMS320F280039C
Other Parts Discussed in Thread: UNIFLASH

Tool/software:

Hello,

I'm having problem with the JTAGLOCK function.

The aim is to disable the JTAG access in the last station of EOL. Thus I implement this procedure by using the diagnostic service.

I've contacted the local FAE, and get the infomation which is

1. There're four registiers need to be modified, JTAGPSWDH0, JTAGPSWDH1, JTAGPSWDL0, JTAGPSWDL1 and Z1OTP_JLM_ENABLE.

2. These registers can be modified only by flash operation.

Refer to the flash example code, I tried to write some test codes.

step 1, intialize the fmc registier

Fapi_initializeAPI(F021_CPU0_BASE_ADDRESS, 100);

step 2, earase the sectors

Fapi_issueAsyncCommandWithAddress(Fapi_EraseSector, (uint32_t*)0x78006u);
while(Fapi_checkFsmForReady() != Fapi_Status_FsmReady);
Fapi_issueAsyncCommandWithAddress(Fapi_EraseSector, (uint32_t*)0x78014u);
while(Fapi_checkFsmForReady() != Fapi_Status_FsmReady);
Fapi_issueAsyncCommandWithAddress(Fapi_EraseSector, (uint32_t*)0x78016u);
while(Fapi_checkFsmForReady() != Fapi_Status_FsmReady);
Fapi_issueAsyncCommandWithAddress(Fapi_EraseSector, (uint32_t*)0x7803Cu);
while(Fapi_checkFsmForReady() != Fapi_Status_FsmReady);
Fapi_issueAsyncCommandWithAddress(Fapi_EraseSector, (uint32_t*)0x7803Eu);
while(Fapi_checkFsmForReady() != Fapi_Status_FsmReady);

Here I have a question, if these registers are designed as the internal flash, does that mean I just have to earase the whole sector once, with the head address of the sector?

step3, progarm the password registers

 Fapi_issueProgrammingCommand((uint32_t*)0x78014u, &RxDataTemp[0], 4, 0, 0, Fapi_AutoEccGeneration);
while(Fapi_checkFsmForReady() != Fapi_Status_FsmReady);
Fapi_issueProgrammingCommand((uint32_t*)0x7803Cu, &RxDataTemp[2], 4, 0, 0, Fapi_AutoEccGeneration);
while(Fapi_checkFsmForReady() != Fapi_Status_FsmReady);

step4, enable the jtaglock function

Fapi_issueProgrammingCommand((uint32_t*)0x78006u, &Jtaglock_Key, 2, 0, 0, Fapi_AutoEccGeneration);
while(Fapi_checkFsmForReady() != Fapi_Status_FsmReady);

Unfortunately, I have not found any example codes of how to implement, and all the relative documents I found only describe the function activation by using CCS' on-chip flash component, thus I don't know I'm having the correct procedure or not.

Here're the problems. 

The password registers seem to be modified successfully. And the last step should also be done, because I can't connect target any more.

 

I tried to input the password into the JLM, then connect again, nothing happend but failed.

The CCS version is 12.8.

I also did some other tests on another target borad. This time I enable the function by using on-chip flash component. But I didn't change the password because it seems can not be changed. So I just enable the JTAGLOCK, nothing else. Well, this time I got a little luck, at least the target can be connected with the default password under UniFlash.

And I found another difference between the two boards. The second board( on-chip flash dude) actually running well with the pre-downloaded firmware; the first board is totally stucked! It doesn't run the software at all, and can not be connected even under the UniFlash. So, totally mess!

Nevertheless, please help me with it, looking forward your reply. Thanks.

  • It seems I didn't input the three linkpointer registers. That cause an ECC error. Thus the first board is totally stucked.

  • Plus, it dosen't need to erase the flash/registers at first. Cause these OTP registers.

  • It seems there're at least 4 problems in my original code.

    1. The earase procedure is not necessary. Since all the OTP registers can be modified ( 1 to 0 ) only once.

    2. The linkpointer registers should be programmed.

    3. All the linkpointer and Z1OTP_JLM_ENABLE registers are NOT ECC protected. Thus the last option should NOT be Fapi_AutoEccGeneration, otherwise it may cause ECC error, just like the first target board. I think Fapi_DataOnly is better.

    4. The password registers should be programmed with the length of 64 bits.

  • Hi Xiaodi,

    Apologies for the delayed response. It seems you've figured out the root cause of all your issues. Is there anything else I can assist with?

    Thank you,

    Luke

  • Hi Luke,

    Thanks a lot for your reply.

    Indeed I've figured this issure out. I post the correct codes here, in case other guys may need them.

    static uint32 LNKPT_JLMEN[4] = { 0x00003FFFu, 0x00003FFFu, 0x00003FFFu, 0xFFFF000Eu };
    static uint32 JTAGPSWDHx[2] = { 0x4BFF0011u, 0x3FFF2233u };
    static uint32 JTAGPSWDLx[2] = { 0x44556677u, 0x2BFF8899u };
    
    Fapi_initializeAPI(F021_CPU0_BASE_ADDRESS, 100);
    
    Fapi_issueProgrammingCommand((uint32_t*)0x78014Cu, JTAGPSWDHx, 4, 0, 0, Fapi_AutoEccGeneration);
    while(Fapi_checkFsmForReady() != Fapi_Status_FsmReady);
    
    Fapi_issueProgrammingCommand((uint32_t*)0x7803Cu, JTAGPSWDLx, 4, 0, 0, Fapi_AutoEccGeneration);
    while(Fapi_checkFsmForReady() != Fapi_Status_FsmReady);
    
    while(Fapi_checkFsmForReady() == Fapi_Status_FsmBusy);
    Fapi_issueProgrammingCommand( (uint32_t *)0x78020u , LNKPT_JLMEN, 8 ,0 ,0,Fapi_DataOnly);
    while(Fapi_checkFsmForReady() != Fapi_Status_FsmReady);

    It turns out the core logic is quite easy, of course guys could add some protection tests during the precedure. I'm sure you'll get luck.

    Plus, if you want to use other linkpointer, the linkpointer value and the JTAGPSWDLx address need to be modified.

    Nevertheless, thanks for the reply @Luke anyway, have a nice day.