• AVR Freaks

JTAG programmer for PIC32MX795F512L

Author
jwregme
Starting Member
  • Total Posts : 32
  • Reward points : 0
  • Joined: 2012/02/09 05:25:43
  • Location: 0
  • Status: offline
2012/08/29 06:03:50 (permalink)
0

JTAG programmer for PIC32MX795F512L

Hey there!
During the design stage we decided to include a JTAG connector to our final system... so now is the question how the bootloader could be programmed. I see that all the programmers intended for my chip are based on ICSP (PM3, Real ICE, ICD3, PicKit3). However, programming over JTAG should be possible as well but I can't seem to find any programmer or software to do this.
 
I've found a few 3rd party JTAG programmers like WINPIC, but they don't seem support my PIC32MX795F512L. Can anyone recommend something I could use for programming?
If there aren't any reasonable options, would it be hard to code a JTAG programmer myself?
Is there a benefit of using ICSP/ICD over JTAG?
 
This is kind of urgent... so I'd really appreciate comments and pointers regarding to my questions!
post edited by jwregme - 2012/08/29 08:43:57
#1

13 Replies Related Threads

    RISC
    Super Member
    • Total Posts : 5376
    • Reward points : 0
    • Status: offline
    Re:JTAG programmer for PIC32MX795F512L 2012/08/29 14:46:53 (permalink)
    0
    Hi,
     
    Do you realize that if you proceed to JTAG, you won't be able to use MPLAB ?
    Any specific reason for NOT using ICSP programming and benefitting from all its ecosystem (IDE, tools,...) ?
     
    Regards
    #2
    jwregme
    Starting Member
    • Total Posts : 32
    • Reward points : 0
    • Joined: 2012/02/09 05:25:43
    • Location: 0
    • Status: offline
    Re:JTAG programmer for PIC32MX795F512L 2012/08/30 00:26:45 (permalink)
    0
    Well, I think we should include ICSP as well to be on the safe side... it's better to add stuff that you might not need beforehand than having to change it in an existing system.
    I've seen that there's a project out there called OpenOCD and another one called Ejtagproxy which both support programming/debugging over JTAG. However, I'm not sure if the debugging features are as powerful as the ones from Microchip. In any case, since time is pressing I don't have the luxury to try them out. I'm very happy to hear though that there are projects out there that help adding JTAG functionality to devices that are either neglected (in case of MC) or proprietary (many companies from what I heard).
    Has someone already used OpenOCD, Ejtagproxy or other tools? Are they a proper replacement for the MC tools?
    #3
    emblocks
    Junior Member
    • Total Posts : 74
    • Reward points : 0
    • Joined: 2011/12/22 18:32:24
    • Status: offline
    Re:JTAG programmer for PIC32MX795F512L 2012/12/28 08:13:04 (permalink)
    0
    Yes, I have successfully used the pic32prog and the ejtagprxoy with a Pickit 2.  I could flash and start a debug session with EmBlocks.
     
    Right now I'm busy with connecting openOCD to a pic32mx220. I have all the signals but can't read the ID yet.
    Question: is the ejtag port always enabled during startup or do I need some sort of startup sequence?
    Can't find that information. I know there are registers which you can use to turn it off, but how if it's turned off and you try a jtag again?

    Em::Blocks free IDE with PIC18/24/30/32 support
    Download is here: www.emblocks.org
    #4
    RISC
    Super Member
    • Total Posts : 5376
    • Reward points : 0
    • Status: offline
    Re:JTAG programmer for PIC32MX795F512L 2012/12/28 10:34:01 (permalink)
    5 (1)
    Hi,
     
    For the PIC32MX220, JTAG belong to the configurations bits (see the chapter 26.0 special features). By default it is activated unless you initialize it to 0 in the configuration bits register DEFCFG0.
     
    Also some new information. I just recognized a new JTAG real-ice adapter has been released : AC244007 MPLAB Real-Ice JTAG adapter :
     
    regards
    #5
    emblocks
    Junior Member
    • Total Posts : 74
    • Reward points : 0
    • Joined: 2011/12/22 18:32:24
    • Status: offline
    Re:JTAG programmer for PIC32MX795F512L 2012/12/28 12:08:03 (permalink)
    0
    Yip, contact.
     
    At least the TDO is spitting out some stuff. I have first changed the pic32prog with an erase only command, and after erase there was activity. Have still some warnings concerning ID's but it is a start.
     
    The TDOEN bit was the problem.
     

    Em::Blocks free IDE with PIC18/24/30/32 support
    Download is here: www.emblocks.org
    #6
    emblocks
    Junior Member
    • Total Posts : 74
    • Reward points : 0
    • Joined: 2011/12/22 18:32:24
    • Status: offline
    Re:JTAG programmer for PIC32MX795F512L 2012/12/28 12:57:38 (permalink)
    0
    RISC
    For the PIC32MX220, JTAG belong to the configurations bits (see the chapter 26.0 special features). By default it is activated unless you initialize it to 0 in the configuration bits register DEFCFG0.

     
    Hi Risc, I hope that you can get me further.
     
    I have contact with the MX220 and I have changed the ID to the right number ( 0x04a04053 ).  If I make contact with OpenOCD on 3333 then I can't load the image.
     
    Info mem gives right info:
    ~"Using user-defined memory regions.\n"
    ~"Num Enb Low Addr   High Addr  Attrs \n"
    ~"0   y  \t0x00000000 0x1d000000 rw nocache \n"
    ~"1   y  \t0x1d000000 0x1d008000 flash blocksize 0x400 nocache \n"
    ~"2   y  \t0x1d008000 0x1fc00000 rw nocache \n"
    ~"3   y  \t0x1fc00000 0x1fc00c00 flash blocksize 0x400 nocache \n"
    ~"4   y  \t0x1fc00c00 0x9d000000 rw nocache \n"
    ~"5   y  \t0x9d000000 0x9d008000 flash blocksize 0x400 nocache \n"
    ~"6   y  \t0x9d008000 0x9fc00000 rw nocache \n"
    ~"7   y  \t0x9fc00000 0x9fc00c00 flash blocksize 0x400 nocache \n"
    ~"8   y  \t0x9fc00c00 0xbd000000 rw nocache \n"
    ~"9   y  \t0xbd000000 0xbd008000 flash blocksize 0x400 nocache \n"
    ~"10  y  \t0xbd008000 0xbfc00000 rw nocache \n"
    ~"11  y  \t0xbfc00000 0xbfc00c00 flash blocksize 0x400 nocache \n"
    ~"12  y  \t0xbfc00c00 0x00000000 rw nocache \n"

     
    But when I try to load I get the following error:
    > load
    &"load\n"
    ~"Loading section .app_excpt, size 0x10 lma 0x9d000180\n"
    &"Load failed\n"
    ^error,msg="Load failed"
    (gdb)

     
    Any clue?
     
    The init phase looks like this:
    > set remotetimeout 120
    (gdb)
    &"set remotetimeout 120\n"
    ^done
    > file bin/debug/osc_basic.elf
    (gdb)
    &"file bin/debug/osc_basic.elf\n"
    ~"Reading symbols from D:\\_a\\bin\\debug\\osc_basic.elf..."
    ~"done.\n"
    ^done
    > directory D:/_a/
    (gdb)
    &"directory D:/_a/\n"
    ~"Source directories searched: D:/_a;$cdir;$cwd\n"
    ^done
    > directory D:/_a/source/
    (gdb)
    &"directory D:/_a/source/\n"
    ~"Source directories searched: D:/_a/source;D:/_a;$cdir;$cwd\n"
    ^done
    > target remote localhost:3333
    (gdb)
    &"target remote localhost:3333\n"
    ~"Remote debugging using localhost:3333\n"
    =thread-group-started,id="i1",pid="42000"
    =thread-created,id="1",group-id="i1"
    ~"0xbfc000000x00000000 in _reset ()\n"
    *stopped,frame={addr="0xbfc00000",base="0x00000000",func="_reset",args=[]},thread-id="1",stopped-threads="all"
    ^done
    > monitor reset halt
    (gdb)
    &"monitor reset halt\n"
    @"JTAG tap: pic32mx.cpu tap/device found: 0x04a04053 (mfg: 0x029, part: 0x4a04, ver: 0x0)\n"
    @"target state: halted\n"
    @"target halted in MIPS32 mode due to debug-request, pc: 0xbfc00000\n"
    ^done
    > load
    (gdb)
    &"load\n"
    ~"Loading section .app_excpt, size 0x10 lma 0x9d000180\n"
    &"Load failed\n"
    ^error,msg="Load failed"
    > target-suspend
    (gdb)

     
    Regards
     

    Em::Blocks free IDE with PIC18/24/30/32 support
    Download is here: www.emblocks.org
    #7
    RISC
    Super Member
    • Total Posts : 5376
    • Reward points : 0
    • Status: offline
    Re:JTAG programmer for PIC32MX795F512L 2012/12/29 03:48:32 (permalink)
    0
    Hi,
     
    Nice progress. Unfortunately I have no experience with OpenOCD...
    I found that thread which may get you a little further if you did not see it yet.
     
    Regards
     
    #8
    emblocks
    Junior Member
    • Total Posts : 74
    • Reward points : 0
    • Joined: 2011/12/22 18:32:24
    • Status: offline
    Re:JTAG programmer for PIC32MX795F512L 2012/12/29 03:54:28 (permalink)
    0
    RISC

    Hi,

    Nice progress. Unfortunately I have no experience with OpenOCD...
    I found that thread which may get you a little further if you did not see it yet.

    Regards


     
    Ok, it seems that the virtual addressing is not handled well. I can step and run but can't retrieve information (memory reading error's) and can't write.
    The puzzle is not complete I'm afraid.
     
     

    Em::Blocks free IDE with PIC18/24/30/32 support
    Download is here: www.emblocks.org
    #9
    emblocks
    Junior Member
    • Total Posts : 74
    • Reward points : 0
    • Joined: 2011/12/22 18:32:24
    • Status: offline
    Re:JTAG programmer for PIC32MX795F512L 2012/12/29 05:15:54 (permalink)
    0
    Ok, it works.  The memory mapping provided by openOCD is not working for GDB (7.5.1 & 7.4.1 ).
    If you disable the memory mapping XML transfer in openOCD (I just commented it out), it starts with flashing and debugging.
     
    There need some things to be done for PIC32, OpenOCD and GDB, but it looks promising.
     
     

    Em::Blocks free IDE with PIC18/24/30/32 support
    Download is here: www.emblocks.org
    #10
    Muenchow
    Super Member
    • Total Posts : 282
    • Reward points : 0
    • Joined: 2012/02/20 02:25:22
    • Location: Bochum Germany
    • Status: offline
    Re:JTAG programmer for PIC32MX795F512L 2012/12/29 07:41:39 (permalink)
    0
    RISC
    Also some new information. I just recognized a new JTAG real-ice adapter has been released : AC244007 MPLAB Real-Ice JTAG adapter :

    Thanks for the info. I think, we have to wait if MPLAB is providing full functionality of this debug interface. 
     
    In my view, the main reason why PIC32MX has a JTAG debug function is to be compatible with MIPS debugging tools. As they are rather expensive, there are probably not many designers out there using it presently. Boundary scan in-circuit test capability might be another serious reason to expose the JTAG interface in a design, in production programming by industry standard tools another one.
     
    A programming interface without debugging capability is pointless for me, in so far I don't really understand the motivation of the original poster. Things would change if MPLAB support of JTAG programming and debugging can be achieved.
    Regards,
    Frank
     
    P.S.: Some more information in the datasheet
    http://ww1.microchip.com/downloads/en/DeviceDoc/52094B.pdf
    It's said therein:

    • The JTAG adaptor board is supported on MPLAB X IDE 1.60 and above.
    • The JTAG adaptor board supports all Microchip PIC32MX devices.
    • Not all debug features are available when using JTAG. View the Debug menu to see which functions are active and which are not available (grayed).

     
    Not really promising.
    post edited by Muenchow - 2012/12/29 07:57:33
    #11
    emblocks
    Junior Member
    • Total Posts : 74
    • Reward points : 0
    • Joined: 2011/12/22 18:32:24
    • Status: offline
    Re:JTAG programmer for PIC32MX795F512L 2012/12/29 12:58:08 (permalink)
    5 (1)
    Muenchow
    A programming interface without debugging capability is pointless for me, in so far I don't really understand the motivation of the original poster.

     
    The ethernet startkit is using internal the jtag port.
     
    I did today a successful  debug session with an old keil ulink (OpenUlink) connected to a pic32mx220 board. Together with the MIPS gdb (from EmBlocks) I could do everything (except breakpoint which I have to figure out). The motivation for this project is to have a faster and more stable platform than the MplabX and pickit3 setup.
    The next step is to make a real fast jtag dongle with ( cortex-m3 @ 80MHz and  optional CPLD/FPGA).
     
    Ultimate goal is to make it equal responsive as an Arm with Jlink. If this fails then the PIC32 is for me a dead parrot.
     
    I foresee only one big problem on the horizon. If I make designs with the PIC32, I won't have double debug connector spaces on the PCB most of the time  (one for ICSP and one for Jtag). If by accident the jtag port is disabled then the board is in an autistic state and not recoverable any more.  Perhaps I see this wrong (I hope so), otherwise it would be more clever if MCP is mapping the jtag and the ICSP pins at the same positions. (one connector fits all).
     

    Em::Blocks free IDE with PIC18/24/30/32 support
    Download is here: www.emblocks.org
    #12
    Muenchow
    Super Member
    • Total Posts : 282
    • Reward points : 0
    • Joined: 2012/02/20 02:25:22
    • Location: Bochum Germany
    • Status: offline
    Re:JTAG programmer for PIC32MX795F512L 2012/12/30 16:13:37 (permalink)
    0
    Thanks for mentioning EmBlocks and MIPS gdb as a debugging alternative. Being almost satisfied with native PIC32 debugging features (using classical MPLAB rather than -X), I wonder if the gdb approach can actually compete. This may be just a matter of my ignorance however.
     
    Please keep us informed.
     
    Best regards,
    Frank
    #13
    emblocks
    Junior Member
    • Total Posts : 74
    • Reward points : 0
    • Joined: 2011/12/22 18:32:24
    • Status: offline
    Re:JTAG programmer for PIC32MX795F512L 2012/12/31 02:01:57 (permalink)
    0
    Muenchow
     This may be just a matter of my ignorance however.

     
    Yes, I think so. I belief that GDB is very powerful (they are now busy with integrating reverse debugging, from the point of exception step backwards)  and that it can compete (even blow it away).
    If you have worked with different IDE's and platforms, I think that you have used GDB already without noticing it (like a lot of vendors are using GCC like MCP).
     
    But, ok I may be biased because I'm  quite familiar with it.

    Em::Blocks free IDE with PIC18/24/30/32 support
    Download is here: www.emblocks.org
    #14
    Jump to:
    © 2019 APG vNext Commercial Version 4.5