Re: [Question] Sending CAN error frames

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 2021-02-02 01:22, Vincent MAILHOL wrote> On Tue. 2 Feb 2021 at 00:41, Jimmy Assarsson <extja@xxxxxxxxxx> wrote:
On 2021-02-01 15:19, Vincent MAILHOL wrote:
On Mon. 1 Feb 2021 at 05:42, Jimmy Assarsson <jimmyassarsson@xxxxxxxxx> wrote:
...
There are two forms of error flags:
    - The active error flag: 6 consecutive dominant bits
    - The passive error flag: 6 consecutive recessive bits
Can it generate both or only one of these? Is it generated as
soon as the device receives the command or is it generated at a
predefined timing (e.g. beginning of the frame)?

It can only generate the active error flag.
It will generate an error frame on the bus as soon as the bus is idle.

$ sudo ip link set can4 type can bitrate 100000
$ sudo ip link set can5 type can bitrate 100000
$ sudo ip link set can4 up
$ sudo ip link set can5 up
$ ./candump -c -ta -H -d -e -x can4,#FFFFFFFF &
[1] 177884
$ ./cansend can5 20000000#
   (0000000084.786201)  can4  RX - -  20000080   [8]  00 00 00 00 00 00
00 01   ERRORFRAME
         bus-error
         error-counter-tx-rx{{0}{1}}
$ ./cansend can5 20000123#0011223344556677
   (0000000086.798898)  can4  RX - -  20000080   [8]  00 00 00 00 00 00
00 02   ERRORFRAME
         bus-error
         error-counter-tx-rx{{0}{2}}
$ ./cansend can5 20000000#
   (0000000087.385292)  can4  RX - -  20000080   [8]  00 00 00 00 00 00
00 03   ERRORFRAME
         bus-error
         error-counter-tx-rx{{0}{3}}
$ ./cansend can5 20000000#
   (0000000087.911860)  can4  RX - -  20000080   [8]  00 00 00 00 00 00
00 04   ERRORFRAME
         bus-error
         error-counter-tx-rx{{0}{4}}
$ ./cansend can5 20000000#
   (0000000088.404890)  can4  RX - -  20000080   [8]  00 00 00 00 00 00
00 05   ERRORFRAME
         bus-error
         error-counter-tx-rx{{0}{5}}
$ ./cansend can5 005#FF.12.20
   (0000000093.061655)  can4  RX - -  005   [3]  FF 12 20
$ ./cansend can5 005#FF.12.21
   (0000000094.667557)  can4  RX - -  005   [3]  FF 12 21
$ ./cansend can5 005#FF.12.22
   (0000000095.617019)  can4  RX - -  005   [3]  FF 12 22
$ ./cansend can5 20000000#
   (0000000097.883071)  can4  RX - -  20000080   [8]  00 00 00 00 00 00
00 03   ERRORFRAME
         bus-error
         error-counter-tx-rx{{0}{3}}

Thanks for the example, things are now clear.

So the error flag always increments the RX counter even if you
are the transmitter.

To be clear, the printouts (from candump) are from the interface
that is not transmitting the error frame (can4). I transmit error
frames with can5. However, the transmitting interface (can5) will
also detect and report the error frame (and increase the rx error
counter). The only difference in the above example would be that the rx
error counter wont decrement when can5 successfully transmits a CAN
frame.
Sorry for the confusion.

Regards,
jimmy



[Index of Archives]     [Automotive Discussions]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]     [CAN Bus]

  Powered by Linux