Tris Device Reset

Discussion in 'Programmer's Corner' started by chrisw1990, Apr 3, 2012.

  1. chrisw1990

    Thread Starter Active Member

    Oct 22, 2011
    543
    41
    ok here's a fun question,
    i set my tris register..
    TRISDbits.TRISD12=0;
    and it causes a device reset?
    has anyone had this before?
    iv proved its that line of code.. not sure why.. and im using pic32MX795F512L by the way
     
  2. ErnieM

    AAC Fanatic!

    Apr 24, 2011
    7,388
    1,605
    Here's one way I could imagine:

    Could Vdd be shorted to that pin? If so, making it an output connects it as a low (unless you pre-initialized with a one, then replace Vdd with Vss) and will thus take down your power supply for a few miliseconds, just long enough to look like a reset.

    Are you sure it is a real reset and not a general protection fault? PIC32's have those, ya know.
     
  3. chrisw1990

    Thread Starter Active Member

    Oct 22, 2011
    543
    41
    oo i dunno, i assumed it was a reset due to the fact mplab crashes for about 5seonds, then wakes back up after halting the debugging??
    and i havent pressed a button at that point?
     
  4. ErnieM

    AAC Fanatic!

    Apr 24, 2011
    7,388
    1,605
    I'm not completely sure what "mplab crashes for about 5seonds, then wakes back up after halting the debugging" means. Sounds more like what I call a "stall" then a crash. Crash is the end and you have to restart the program. Stalls heal themselves after a delay.

    I spend mucho time last year playing with a PIC32MX460F512L and programming and debugging using the ICD3 inside MPLAB. This was inside a lovely MikroElektronika PIC32MX4 multimedia board that had a joystick on top, and the reset button on the back. I had a series of several bad days where the thing would seemingly randomly crash, till I realized when I moved the joystick on the front the reset button on back would hit the table and, well reset the device.

    When this would happen MPLAB would just sit there and refuse to step thru or debug run any code until I told MPLAB to do the device reset. MPLAB did not crash or stall, it was always there and the GUI responsive, just the code window would not move to the next instruction.

    So from your description I'm at a loss for what is happening.

    The pin with RD12 on it has the alternate functions:

    ETXD2 Ethernet Transmit Data 2
    IC5 Capture Input 5
    PMD12 Parallel Master Port data

    Perhaps check and make sure there isn't any conflict there.
     
  5. chrisw1990

    Thread Starter Active Member

    Oct 22, 2011
    543
    41
    ah then it is a stall, my mclr reset switch is at the back, and im not touching it when it resets.. i will make sure those modules are disabled, though i think by default theyre disabled anyway, the mplab window freezes, until it halts the target and breaks from the code, not sure why but i guess checking those functions is as good as any, might be worth cutting that track and seeing if i can get it to toggle without anything connected.. give me an indication where the error is caused..
     
  6. ErnieM

    AAC Fanatic!

    Apr 24, 2011
    7,388
    1,605
    Before you cut a track try physically hitting the reset button before the danger instruction and see if you get the same stall pattern. I suspect not, so you may want to check other things before you cut. I think cutting is a drastic step, but then I have the tools to lift a single pin.

    By the way, what debugger tool are you using? PICkit 3, ICD #, or something else?
     
  7. chrisw1990

    Thread Starter Active Member

    Oct 22, 2011
    543
    41
    icd 3,
    i shall try the reset button method you suggest and report back later.
     
Loading...