• AVR Freaks

Hot!PIC32 raising many different general exceptions

Author
megawhite
Starting Member
  • Total Posts : 45
  • Reward points : 0
  • Joined: 2011/09/06 05:00:13
  • Location: 0
  • Status: offline
2020/07/06 04:21:39 (permalink)
0

PIC32 raising many different general exceptions

Hi, does it make sense to anyone why my PIC32 appears to be raising exceptions in a fairly intermittent nature, of different causes according to general_exception_handler:
 
_excep_code = (_CP0_GET_CAUSE() & 0x0000007C) >> 2;
 
I have captured the following exception causes and addresses returned by _CP0_GET_EPC():
 
Instruction bus error 9A1C602C
Data bus error 9D015E9C
Store address error 9D007804
Reserved instruction 9D015E9C
Store address error 9D00D3FC
Reserved instruction 9D007818
Data bus error 9D010F14
 
I have looked up the code locations from disassembly and it makes no sense what so ever why an exception could be raised at those particular points.  The code was running perfectly stable until a swap of PCB with a new PIC32 and some relatively minor firmware changes that I cannot believe could cause any of this behaviour.
 
Could this weird behavour be caused by faulty hardware or power supply stability issues?
 
Thanks.
#1

8 Replies Related Threads

    boatbodger
    Senior Member
    • Total Posts : 122
    • Reward points : 0
    • Joined: 2011/03/27 15:39:07
    • Location: 0
    • Status: offline
    Re: PIC32 raising many different general exceptions 2020/07/06 05:07:51 (permalink)
    5 (2)
    I found recently with a newly-designed PCB that I had not allowed enough decoupling on VddCore - I had provided 3 x 100nF.  Scope measurements showed droop when doing lots of maths (sqrt()) that was taking this line very close to the upper limit of the brownout level - which has quite a wide tolerance - and resulting in exceptions.
    I added a 1uF across each 100nF, and the problem went away (so far...)
    #2
    RISC
    Super Member
    • Total Posts : 5776
    • Reward points : 0
    • Status: offline
    Re: PIC32 raising many different general exceptions 2020/07/06 05:22:21 (permalink)
    0
    Thanks for your feedback....
    It's true that having exceptions for such a wide range of causes would not be easy to roottrace...
    Fortunately, you questioned your HW and found most probably the real cause. Some people who have less hardware sensitivity would try to dig in their software for ages...
    With recent advances in ICs, power supplies are becoming tight and boost/buck topologies add extra burden ...and noise ;=)
    Regards 

    For support make sure to check first here : http://microchipdeveloper.com
    There are hundreds of PIC, AVR, SAM...which one do YOU use ?
    #3
    megawhite
    Starting Member
    • Total Posts : 45
    • Reward points : 0
    • Joined: 2011/09/06 05:00:13
    • Location: 0
    • Status: offline
    Re: PIC32 raising many different general exceptions 2020/07/06 05:47:33 (permalink)
    0
    Thanks for the suggestions.
     
    I was under the impression the brownout would throw a reset if the power supply became out of spec.  So it appears to be the case that noise can cause strange exception behaviour instead of a reset.  Presumably the brownout detector is only good to a power supply noise frequency limit.  I should read up on it.
    #4
    friesen
    Super Member
    • Total Posts : 2148
    • Reward points : 0
    • Joined: 2008/05/08 05:23:35
    • Location: Indiana, USA
    • Status: offline
    Re: PIC32 raising many different general exceptions 2020/07/06 07:08:42 (permalink)
    5 (1)
    I'd hazard a 95% guess that you are trashing your stack somewhere.  Probably over running a locally defined array?

    Erik Friesen
    #5
    NKurzman
    A Guy on the Net
    • Total Posts : 18858
    • Reward points : 0
    • Joined: 2008/01/16 19:33:48
    • Location: 0
    • Status: online
    Re: PIC32 raising many different general exceptions 2020/07/06 07:45:27 (permalink)
    0
    Did you Look at the Stack window in the Debugger?
    If the debugger , It will show it.feels the Stack is still good
    #6
    jdeguire
    Super Member
    • Total Posts : 583
    • Reward points : 0
    • Joined: 2012/01/13 07:48:44
    • Location: United States
    • Status: offline
    Re: PIC32 raising many different general exceptions 2020/07/06 11:42:55 (permalink)
    4 (1)
    Make sure that the interrupt level you give to the interrupt handler via the "IPLnSOFT" or "IPLnSRS" values matches what you set in the IPCx register field for that interrupt.
    #7
    megawhite
    Starting Member
    • Total Posts : 45
    • Reward points : 0
    • Joined: 2011/09/06 05:00:13
    • Location: 0
    • Status: offline
    Re: PIC32 raising many different general exceptions 2020/07/09 01:20:57 (permalink)
    5 (1)
    Thank you all for your thoughts on the bizarre symptoms I was seeing.
     
    The problem turned out to be hardware related.  The introduction of a noisy signal connection in a multi wire cable is expected to have coupled that noise onto another wire connected directly to the PIC.  I am assuming this caused some sort of electronic instability within the chip, with the consequences of raising exceptions with different causes, possibly because bus data was getting corrupted?
     
    The fix was replacing the multi core cable with twisted ribbon in order to reduce noise coupling due to twists and additional physical separation of the wires.
     
    Maybe someone can mark this post as answer, I cannot do it myself.
    post edited by megawhite - 2020/07/09 01:22:06
    #8
    ric
    Super Member
    • Total Posts : 28009
    • Reward points : 0
    • Joined: 2003/11/07 12:41:26
    • Location: Australia, Melbourne
    • Status: online
    Re: PIC32 raising many different general exceptions 2020/07/09 01:34:41 (permalink)
    0
    megawhite
    The problem turned out to be hardware related.  The introduction of a noisy signal connection in a multi wire cable is expected to have coupled that noise onto another wire connected directly to the PIC. 

    You should not have ANY pins leaving your PCB that have a direct conneciton to your PIC.
    Some sort of filtering or buffering is always advisale on the connections.
     

    Maybe someone can mark this post as answer, I cannot do it myself.

    You can edit the first post and add "SOLVED" to the title.
     

    I also post at: PicForum
    Links to useful PIC information: http://picforum.ric323.co...opic.php?f=59&t=15
    NEW USERS: Posting images, links and code - workaround for restrictions.
    To get a useful answer, always state which PIC you are using!
    #9
    Jump to:
    © 2020 APG vNext Commercial Version 4.5