• AVR Freaks

Hot!Difference between IRXIF and ERRIF at PIR3 register on PIC18F4580

Author
f3ynman
New Member
  • Total Posts : 7
  • Reward points : 0
  • Joined: 2018/08/15 00:33:38
  • Location: 0
  • Status: offline
2019/04/06 10:15:35 (permalink)
0

Difference between IRXIF and ERRIF at PIR3 register on PIC18F4580

Hi everybody,I'm trying to handle errors on my CAN project and there is some blurry distinction between those two IFs.Because of that i can't decide to what kind of a error handling algorithm should i design for autobaud detection etc. If you explain distinction between these two flags or how you are using those flags i would be really appreciated.And i would like to hear if you have any advices on autobaud detection and automotive implementation with CAN too.
post edited by f3ynman - 2019/04/08 02:43:39
#1

6 Replies Related Threads

    Aussie Susan
    Super Member
    • Total Posts : 3532
    • Reward points : 0
    • Joined: 2008/08/18 22:20:40
    • Location: Melbourne, Australia
    • Status: offline
    Re: Difference between IRXIF and ERRIF at PIR3 register on PIC18F 2019/04/07 19:27:13 (permalink)
    +1 (1)
    Which PIC18F? There are a lot of them and they all have differing capabilities, registers etc..
    Have you looked at the data sheet? Every bit of every register is documented. I realise that some of the documentation can be a little confusing to read at first but the information is in there.
    Anything ending in xxxIF is an Interrupt Flag and will be set by the hardware when the specific condition (given in the rest of the name) occurs. (Whether an ISR is called depends in the corresponding xxxIE - Interrupt Enable - flag.)
    Susan
    #2
    f3ynman
    New Member
    • Total Posts : 7
    • Reward points : 0
    • Joined: 2018/08/15 00:33:38
    • Location: 0
    • Status: offline
    Re: Difference between IRXIF and ERRIF at PIR3 register on PIC18F 2019/04/07 21:57:39 (permalink)
    0
    Oh sorry about that I was talking about PIC18F4580
    #3
    Aussie Susan
    Super Member
    • Total Posts : 3532
    • Reward points : 0
    • Joined: 2008/08/18 22:20:40
    • Location: Melbourne, Australia
    • Status: offline
    Re: Difference between IRXIF and ERRIF at PIR3 register on PIC18F 2019/04/08 19:39:43 (permalink)
    +1 (1)
    I don't know much about CAN but have you checked out Sections 24.15.4 and 24.15.6?
    To my uneducated eye, ERRIF shows an error in general whereas IRXIF indicates an error in the data stream.
    Susan
    #4
    f3ynman
    New Member
    • Total Posts : 7
    • Reward points : 0
    • Joined: 2018/08/15 00:33:38
    • Location: 0
    • Status: offline
    Re: Difference between IRXIF and ERRIF at PIR3 register on PIC18F 2019/04/09 02:36:24 (permalink)
    0
    Well what is a general error and what is a data error? yeah I checked but I will check it again now.
    #5
    Aussie Susan
    Super Member
    • Total Posts : 3532
    • Reward points : 0
    • Joined: 2008/08/18 22:20:40
    • Location: Melbourne, Australia
    • Status: offline
    Re: Difference between IRXIF and ERRIF at PIR3 register on PIC18F 2019/04/09 19:47:41 (permalink)
    0
    At a guess a general error is when the module detects that something is wrong (data value too long or short etc) whereas a data error might be an unexpected response, CRC error etc..
    Take this with a pinch of salt as I'm not familiar with the CAN protocol and how much is done in the module and how much in the app layers above that.
    Susan
    #6
    tam07
    New Member
    • Total Posts : 25
    • Reward points : 0
    • Joined: 2016/04/04 18:39:11
    • Location: 0
    • Status: offline
    Re: Difference between IRXIF and ERRIF at PIR3 register on PIC18F 2019/04/10 04:36:35 (permalink)
    +1 (1)
    I haven't used the PIC18F4580, but if you look into the datasheet of newer devices with CAN (i.e. PIC18F66K80 and PIC18F26K83), ERRIF is defined as:
     
    ERRIF: Error Interrupt Flag bit (Multiple sources in COMSTAT register)
    1 = An error has occurred in the CAN module (multiple sources)
    0 = No CAN Module errors
     
    This means that ERRIF is set when any of the COMSTAT error bits is set (provided that the ERRIE bit is enabled).
     
    On the other hand,
     
    IRXIF: CAN Bus Error Message Received Interrupt Flag bit
    1 = An invalid message has occurred on the CAN bus
    0 = No invalid message on the CAN bus
     
    The IRXIF will only be set whenever an invalid message is detected during transmit or receive (provided that IRXIE bit is enabled). This is different with ERRIF which is set whenever an overflow, bus-off, bus passive, or a warning condition occurs (refer to COMSTAT).
     
    Hope this helps. :)
     
    Regards,
    Tam
    post edited by tam07 - 2019/04/10 04:44:24
    #7
    Jump to:
    © 2019 APG vNext Commercial Version 4.5