J-Link and DM368

  • J-Link and DM368

    Hello,
    there was a thread about TI DaVinci processor DM365 (segger2.com/index.php?page=Thread&threadID=768), but unfortunately it is dead now. The core is arm926ej-s, so I think it should be possible to debug it with J-Link.

    I tried suggested script for OMAP, but I got following messages:

    Can not find ICE-Pick (IDCODE mismatch). Expected 0x0B7D102F, found: 0x8B83E02F
    CPU JTAG Id mismatch, read: 0x2E0D80BC

    Source Code

    1. SEGGER J-Link Commander V4.32 ('?' for help)SEGGER J-Link Commander V4.32 ('?' for help)
    2. Compiled Jul 29 2011 18:38:14
    3. DLL version V4.32, compiled Jul 29 2011 18:37:55
    4. Firmware: J-Link ARM V8 compiled Jul 26 2011 17:31:24
    5. Hardware: V8.00
    6. S/N: 58004787
    7. ETM support, Trace buffer size: 0KB
    8. VTarget = 3.287V
    9. Info: OMAP-L138 J-Link script
    10. Info: J-Link script: Init ICEPick
    11. Info: TotalIRLen = 6, IRPrint = 0x01
    12. Info: J-Link script: Could not halt CPU, Executing Reset
    13. Info: TotalIRLen = 7, IRPrint = 0x03
    14. ****** Error: Too few devices on the JTAG bus. IRPos: 6, TotalIRLen: 7
    15. Could not find supported CPU core on JTAG chain
    16. Found 2 JTAG devices, Total IRLen = 7:
    17. ****** Error: Too few devices on the JTAG bus. IRPos: 6, TotalIRLen: 7
    18. Could not find supported CPU core on JTAG chain
    19. Found 2 JTAG devices, Total IRLen = 7:
    20. J-Link>
    Display All
    How should I please modify the script to make JLink usable with DM36x processor?
    best regards
    Jan
  • Hi Jan,

    do you have the manual of the DM365 CPU available?
    It is needed to get an idea of the ICEPick initialization. Otherwise we are just guessing what needs to be done.
    In fact it will be similar to the OMAP init but not identical.


    Best regards
    Alex
    Please read the forum rules before posting.

    Keep in mind, this is *not* a support forum.
    Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
    Should you be entitled to support you can contact us via our support system: segger.com/ticket/

    Or you can contact us via e-mail.
  • Hi Jan,

    Just for clarification: This is not a support forum, so you can not expect to get a high priority when posting such problems here.
    It is on our list to have a look at this but I can not give you a schedule yet.


    Best regards
    Alex
    Please read the forum rules before posting.

    Keep in mind, this is *not* a support forum.
    Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
    Should you be entitled to support you can contact us via our support system: segger.com/ticket/

    Or you can contact us via e-mail.
  • Hi xhpohanka,

    Please try this script which I used in DM365 system. I have no DM368 board.
    EMU0 and EMU1 should be high.


    /*********************************************************************
    *
    * _ResetViaIcePick
    *
    * Function description
    * Reset CPU core via Ice Pick.
    * This function can be used if the reset pin of the CPU is
    * not connected to the reset pin of the JTAG connector
    */
    void _ResetViaIcePick(void) {
    int v;
    int BitPos;
    //
    // Setup JTAG config to "talk" to the ICEPick, so we can use the JTAG API functions
    //
    JTAG_DRPre = 2;
    JTAG_DRPost = 0;
    JTAG_IRPre = 8;
    JTAG_IRPost = 0;
    JTAG_IRLen = 6;
    //
    // Perform reset via ICEPick system control register, by setting the SysReset bit
    //
    JTAG_StoreIR(2); // Cmd: ROUTER
    v = 0x01000000; // Read SYS_CNTL
    JTAG_StoreDR(v, 32);
    BitPos = JTAG_StoreDR(v, 32);
    v = JTAG_GetU32(BitPos);
    v &= 0x00FFFFFF;
    v |= 0x81000001; // Write SYS_CNTL and set SysReset bit
    JTAG_StoreDR(v, 32);
    v &= 0xFFFFFFFE;
    v &= 0x00FFFFFF;
    v |= 0x81000000; // Write SYS_CNTL and clear SysReset bit
    JTAG_StoreDR(v, 32);
    //
    // Setup JTAG config to "talk" to the Cortex-R4 again
    //
    JTAG_IRPre=4;
    JTAG_DRPre=1;
    JTAG_IRPost=6;
    JTAG_DRPost=1;
    JTAG_IRLen=4;
    }

    /*********************************************************************
    *
    * _WriteIceReg
    *
    * Function description
    * Writes an Ice-Breaker regsiter
    */
    void _WriteIceReg(int Reg, int v) {
    __int64 ScanData;

    JTAG_StoreIR(0x2); // Scan chain select
    JTAG_StoreClocks(1);
    JTAG_StoreDR(2, 5); // Scan chain 2 is Ice breaker
    JTAG_StoreClocks(1);
    JTAG_StoreIR(0xC); // Intest
    JTAG_StoreClocks(1);
    ScanData = v;
    ScanData |= (Reg << 32);
    ScanData |= (1 << 37);
    JTAG_StoreDR(ScanData, 38);
    JTAG_WriteClocks(100);
    }

    /*********************************************************************
    *
    * _ReadIceReg
    *
    * Function description
    * Reads an Ice-Breaker register
    */
    int _ReadIceReg(int Reg) {
    __int64 ScanData;
    int BitPos;
    int v;

    JTAG_StoreIR(0x2); // Scan chain select
    JTAG_StoreClocks(1);
    JTAG_StoreDR(2, 5); // Scan chain 2 is Ice breaker
    JTAG_StoreClocks(1);
    JTAG_StoreIR(0xC); // Intest
    JTAG_StoreClocks(1);
    ScanData = v;
    ScanData |= (Reg << 32);
    ScanData |= (0 << 37);
    JTAG_StoreDR(ScanData, 38);
    JTAG_StoreClocks(100);
    BitPos = JTAG_StoreDR(ScanData, 38);
    JTAG_WriteClocks(100);
    v = JTAG_GetU32(BitPos);
    return v;
    }

    /*********************************************************************
    *
    * _InitIcePick
    *
    * Function description
    * Writes an Ice-Breaker regsiter
    */
    void _InitIcePick(void) {
    unsigned int aDevice[3];
    int BitPos;
    int v;
    int i;

    Report("J-Link script: Init ICEPick");
    // JTAG_ResetPin = 0;
    // SYS_Sleep(50);
    // JTAG_ResetPin = 1;
    // SYS_Sleep(50);
    JTAG_Reset(); // Perform TAP reset and J-Link JTAG auto-detection
    //if (JTAG_TotalIRLen != 6) {
    // MessageBox("IRLen mismatch");
    //}
    JTAG_WriteIR(4);
    BitPos = JTAG_WriteDR(0x00000000, 32);
    v = JTAG_GetU32(BitPos);
    if (v != 0x8B83E02F) {
    MessageBox1("Can not find ICE-Pick (IDCODE mismatch). Expected 0x8B83E02F, found: ", v);
    }
    JTAG_DRPre = 0;
    JTAG_DRPost = 0;
    JTAG_IRPre = 0;
    JTAG_IRPost = 0;
    JTAG_IRLen = 6;
    JTAG_Speed = 1000;
    //
    // Put ARM core in scan chain
    //
    JTAG_WriteIR(7); // CONNECT
    JTAG_WriteDR(0x89, 8); // D7: WRITEENABLE = 1,D3-D0: Key = 0x9
    JTAG_WriteIR(2); // ROUTER
    JTAG_WriteDR(0x81000082, 32); // Write SYS_CNTL = 0x000082 D7:KEEPPOWEREDINTLR = 1, D3-D1:DEVICETYPE = 001b Emulator
    JTAG_WriteDR(0xA018206F, 32); // Write SDTAP0 = 0x18206F D20:INHIBIT SLEEP = 1,
    JTAG_WriteDR(0xA018216F, 32);
    JTAG_WriteIR(0x3F); // Bypass
    JTAG_WriteClocks(10);
    //
    // Configure JTAG chain, so J-Link knows to which devices it has to "talk"
    //
    JTAG_IRPre=0;
    JTAG_DRPre=0;
    JTAG_IRPost=6;
    JTAG_DRPost=1;
    JTAG_IRLen=4;
    CPU=ARM926EJS;
    JTAG_AllowTAPReset=0;
    }

    /*********************************************************************
    *
    * InitEMU
    */
    void InitEMU(void) {
    EMU_ETB_IsPresent = 1; // Tells the J-Link DLL that the connected device has an ETB
    EMU_ETB_UseETB = 1; // Make ETB usable in IDEs (e.g. IAR EWARM)
    }

    /*********************************************************************
    *
    * ResetTarget
    */
    void ResetTarget(void) {
    __int64 v;
    int BitPos;

    Report("J-Link script: Reset");
    //
    // Reset core via ResetPin
    //
    JTAG_ResetPin = 0;
    SYS_Sleep(50);
    JTAG_TRSTPin = 0;
    JTAG_TRSTPin = 1;
    SYS_Sleep(50);
    JTAG_ResetPin = 1;
    SYS_Sleep(50);
    _InitIcePick();
    _WriteIceReg(0,3); // Set Debug request
    _WriteIceReg(2,1); // Write vector catch register, to halt core immdeiately after reset
    // _ResetViaIcePick();
    JTAG_ResetPin = 0;
    SYS_Sleep(50);
    JTAG_ResetPin = 1;
    SYS_Sleep(50);
    }

    /*********************************************************************
    *
    * InitTarget
    */
    void InitTarget(void) {
    int v;

    Report("DM365 J-Link script"); // To avoid message box, you can alternatively use Report().
    _InitIcePick();
    //
    // Halt the CPU to verify it can be halted. If it can not, let's reset the CPU
    //
    _WriteIceReg(0,3);
    v = _ReadIceReg(1);
    if ((v & 9) != 9) {
    Report("J-Link script: Could not halt CPU, Executing Reset");
    ResetTarget(); // Reset core via ResetPin
    }
    }
  • CPU not found after reset

    Hello,
    J-link with script shared by Taoist is able to detect my dm365 arm core, unfortunately after the reset, the CPU is not detected anymore, with following log

    Source Code

    1. SEGGER J-Link Commander V4.34a ('?' for help)
    2. Compiled Aug 31 2011 11:51:44
    3. DLL version V4.34a, compiled Aug 31 2011 11:51:40
    4. Firmware: J-Link ARM V8 compiled Aug 24 2011 17:23:32
    5. Hardware: V8.00
    6. S/N: 58004787
    7. ETM support, Trace buffer size: 0KB
    8. VTarget = 3.287V
    9. Info: DM365 J-Link script: InitTarget
    10. Info: J-Link script: Init ICEPick
    11. Info: TotalIRLen = ?, IRPrint = 0x..000000000000000000000000
    12. *** J-Link V4.34a Executing script ***
    13. Can not find ICE-Pick (IDCODE mismatch). Expected 0x0B83E02F, found: 0x00000000
    14. *** J-Link V4.34a Executing script ***
    15. Info: J-Link script: Could not halt CPU, Executing Reset
    16. Info: J-Link script: Reset
    17. Info: J-Link script: Init ICEPick
    18. Info: TotalIRLen = 6, IRPrint = 0x01
    19. *** J-Link V4.34a Executing script ***
    20. Can not find ICE-Pick (IDCODE mismatch). Expected 0x0B83E02F, found: 0x00000000
    21. *** J-Link V4.34a Executing script ***
    22. Info: TotalIRLen = ?, IRPrint = 0x..000000000000000000000000
    23. WARNING: CPU core not found.
    24. ****** Error: Too few devices on the JTAG bus. IRPos: 6, TotalIRLen: 6
    25. No devices found on JTAG chain. Trying to find device on SWD.
    26. WARNING: CPU core not found.
    27. No device found on SWD.
    28. Did not find any core.
    29. Info: DM365 J-Link script: InitTarget
    30. Info: J-Link script: Init ICEPick
    31. Info: TotalIRLen = 6, IRPrint = 0x01
    32. *** J-Link V4.34a Executing script ***
    33. Can not find ICE-Pick (IDCODE mismatch). Expected 0x0B83E02F, found: 0x00000000
    34. *** J-Link V4.34a Executing script ***
    35. Info: TotalIRLen = 10, IRPrint = 0x0011
    36. Info: CP15.0.0: 0x41069265: ARM, Architecure 5TEJ
    37. Info: CP15.0.1: 0x1D112152: ICache: 16kB (4*128*32), DCache: 8kB (4*64*32)
    38. Info: Cache type: Separate, Write-back, Format C (WT supported)
    39. Found 2 JTAG devices, Total IRLen = 10:
    40. #0 Id: 0x0B83E02F
    41. #1 Id: 0x00000001
    42. Found ARM with core Id 0x0B83E02F (ARM9)
    43. ETM V1.3: 4 pairs addr.comp, 2 data comp, 8 MM decs, 2 counters, sequencer
    44. J-Link>r
    45. Reset delay: 0 ms
    46. Reset type NORMAL: Using RESET pin, halting CPU after Reset
    47. Info: DM365 J-Link script: InitTarget
    48. Info: J-Link script: Init ICEPick
    49. Info: TotalIRLen = ?, IRPrint = 0x..000000000000000000000000
    50. *** J-Link V4.34a Executing script ***
    51. Can not find ICE-Pick (IDCODE mismatch). Expected 0x0B83E02F, found: 0x00000000
    52. *** J-Link V4.34a Executing script ***
    53. Info: J-Link script: Could not halt CPU, Executing Reset
    54. Info: J-Link script: Reset
    55. Info: J-Link script: Init ICEPick
    56. Info: TotalIRLen = 6, IRPrint = 0x01
    57. *** J-Link V4.34a Executing script ***
    58. Can not find ICE-Pick (IDCODE mismatch). Expected 0x0B83E02F, found: 0x00000000
    59. *** J-Link V4.34a Executing script ***
    60. Info: TotalIRLen = ?, IRPrint = 0x..000000000000000000000000
    61. WARNING: CPU core not found.
    Display All

    Is there any possibility to alter the script to do complete reinitialization after the reset?
    regards
    Jan