linux-can.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Marc Kleine-Budde <mkl@pengutronix.de>
To: Vincent MAILHOL <mailhol.vincent@wanadoo.fr>
Cc: Ayoub Kaanich <kayoub5@live.com>,
	linux-can <linux-can@vger.kernel.org>,
	Thomas Kopp <thomas.kopp@microchip.com>
Subject: mcp251xfd receiving non ACKed frames (was: Re: More flags for logging)
Date: Tue, 4 May 2021 09:48:34 +0200	[thread overview]
Message-ID: <20210504074834.tki7gzr6wz2le6o3@pengutronix.de> (raw)
In-Reply-To: <CAMZ6RqJ0t91e-e9LwzaLWTY6G9MY7mosos9-DEs=pc0mWRf86Q@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 7238 bytes --]

On 04.05.2021 06:46:17, Vincent MAILHOL wrote:
> > And even on the mcp251xfd, where I receive the CAN frame, there's no way
> > to tell if this frame has been acked or not.

The test setup is:

                    flexcan (listen only)
                             |
                             |
   PEAK PCAN-USB FD ---------+--------- mcp2518fd (listen only)
        (sender)             |
                             |
               candlelight (going to be unplugged)

pcan-usb: sending CAN frames
flexcan: receiving CAN frames - but controller in listen only mode
mcp2518fd: receiving CAN frames - but controller in listen only mode
candlelight: receiving CAN frames - first attached, then detached

> The mcp251xfd behavior is interesting. Do you also receive the ACK
> error flag?

In my tests from yesterday neither the flexcan nor the mcp2518fd had bus
error reporting enabled. So I haven't noticed any ACK errors on the
mcp2518fd nor the flexcan.

I just repeated the test with bus error reporting enabled:

On the flexcan I receive _only_ these errors (repeating) with
candlelight detached:

| (2021-05-04 09:00:30.407709)        can0  RX - -  20000088   [8]  00 00 08 00 00 00 00 00   ERRORFRAME
|        protocol-violation{{tx-dominant-bit-error}{}}
|        bus-error


On the mcp2518fd I see these errors:

| (2021-05-04 09:05:00.594321)  mcp251xfd0  RX - -  222   [8]  4A 00 00 00 00 00 00 00
| (2021-05-04 09:05:01.094418)  mcp251xfd0  RX - -  222   [8]  4B 00 00 00 00 00 00 00
| (2021-05-04 09:05:01.594577)  mcp251xfd0  RX - -  222   [8]  4C 00 00 00 00 00 00 00
...unplug candlelight here...
| (2021-05-04 09:05:02.094878)  mcp251xfd0  RX - -  20000088   [8]  00 00 02 00 00 00 00 00   ERRORFRAME
|        protocol-violation{{frame-format-error}{}}
|        bus-error
| (2021-05-04 09:05:02.095589)  mcp251xfd0  RX - -  20000088   [8]  00 00 02 00 00 00 00 00   ERRORFRAME
|        protocol-violation{{frame-format-error}{}}
|        bus-error
| (2021-05-04 09:05:02.096263)  mcp251xfd0  RX - -  20000088   [8]  00 00 02 00 00 00 00 00   ERRORFRAME
|        protocol-violation{{frame-format-error}{}}
|        bus-error
| (2021-05-04 09:05:02.096934)  mcp251xfd0  RX - -  20000088   [8]  00 00 02 00 00 00 00 00   ERRORFRAME
|        protocol-violation{{frame-format-error}{}}
|        bus-error
| (2021-05-04 09:05:02.097596)  mcp251xfd0  RX - -  20000088   [8]  00 00 02 00 00 00 00 00   ERRORFRAME
|        protocol-violation{{frame-format-error}{}}
|        bus-error
| (2021-05-04 09:05:02.098261)  mcp251xfd0  RX - -  20000088   [8]  00 00 02 00 00 00 00 00   ERRORFRAME
|        protocol-violation{{frame-format-error}{}}
|        bus-error
| (2021-05-04 09:05:02.099035)  mcp251xfd0  RX - -  222   [8]  4D 00 00 00 00 00 00 00
| (2021-05-04 09:05:02.099054)  mcp251xfd0  RX - -  222   [8]  4D 00 00 00 00 00 00 00
| (2021-05-04 09:05:02.099603)  mcp251xfd0  RX - -  20000088   [8]  00 00 00 00 00 00 00 00   ERRORFRAME
|        protocol-violation{{}{}}
|        bus-error

from here now only RX frames, no error frames

| (2021-05-04 09:05:02.100540)  mcp251xfd0  RX - -  222   [8]  4D 00 00 00 00 00 00 00
| (2021-05-04 09:05:02.100570)  mcp251xfd0  RX - -  222   [8]  4D 00 00 00 00 00 00 00
| (2021-05-04 09:05:02.100583)  mcp251xfd0  RX - -  222   [8]  4D 00 00 00 00 00 00 00
| (2021-05-04 09:05:02.100593)  mcp251xfd0  RX - -  222   [8]  4D 00 00 00 00 00 00 00
| (2021-05-04 09:05:02.101326)  mcp251xfd0  RX - -  222   [8]  4D 00 00 00 00 00 00 00

... and repeating.


Here a short dump of the mcp2518fd registers:

| INT: intf(0x01c)=0xbf1a0806
|                 IE      IF      IE & IF
|         IVMI    x                       Invalid Message Interrupt
|         WAKI                            Bus Wake Up Interrupt
|         CERRI   x                       CAN Bus Error Interrupt
|         SERRI   x                       System Error Interrupt
|         RXOVI   x       x       x       Receive FIFO Overflow Interrupt
|         TXATI   x                       Transmit Attempt Interrupt
|         SPICRCI x                       SPI CRC Error Interrupt
|         ECCI    x                       ECC Error Interrupt
|         TEFI    x                       Transmit Event FIFO Interrupt
|         MODI    x                       Mode Change Interrupt
|         TBCI            x               Time Base Counter Interrupt
|         RXI     x       x       x       Receive FIFO Interrupt
|         TXI                             Transmit FIFO Interrupt

Note: there is no invalid message interrupt pending

| TREC: trec(0x034)=0x00000000
|             TXBO                Transmitter in Bus Off State
|             TXBP                Transmitter in Error Passive State
|             RXBP                Receiver in Error Passive State
|           TXWARN                Transmitter in Error Warning State
|           RXWARN                Receiver in Error Warning State
|            EWARN                Transmitter or Receiver is in Error Warning State
|              TEC =   0          Transmit Error Counter
|              REC =   0          Receive Error Counter
| 
| BDIAG0: bdiag0(0x038)=0x00000010
|         DTERRCNT =   0          Data Bit Rate Transmit Error Counter
|         DRERRCNT =   0          Data Bit Rate Receive Error Counter
|         NTERRCNT =   0          Nominal Bit Rate Transmit Error Counter
|         NRERRCNT =  16          Nominal Bit Rate Receive Error Counter
| 
| BDIAG1: bdiag1(0x03c)=0x0000dd4b
|            DLCMM                DLC Mismatch
|              ESI                ESI flag of a received CAN FD message was set
|          DCRCERR                Data CRC Error
|         DSTUFERR                Data Bit Stuffing Error
|         DFORMERR                Data Format Error
|         DBIT1ERR                Data BIT1 Error
|         DBIT0ERR                Data BIT0 Error
|          TXBOERR                Device went to bus-off (and auto-recovered)
|          NCRCERR                CRC Error
|         NSTUFERR                Bit Stuffing Error
|         NFORMERR                Format Error
|          NACKERR                Transmitted message was not acknowledged
|         NBIT1ERR                Bit1 Error
|         NBIT0ERR                Bit0 Error
|         EFMSGCNT = 56651                Error Free Message Counter

> Does the controller retry to send the frame until it gets
> acknowledged?

Yes - as it should.

> Are you still able to send frames and receive the echo if there is a
> single node on the network?

No - But the peak driver/hw has some limitations:

The peak driver doesn't have TX complete signaling, it send the echo
after sending the TX CAN frame via USB. And the peak controller seems to
buffer quite a lot TX CAN frames, so it looks for the first ~72 frames
like the bus is still working.

Marc

--
Pengutronix e.K.                 | Marc Kleine-Budde           |
Embedded Linux                   | https://www.pengutronix.de  |
Vertretung West/Dortmund         | Phone: +49-231-2826-924     |
Amtsgericht Hildesheim, HRA 2686 | Fax:   +49-5121-206917-5555 |

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

  parent reply	other threads:[~2021-05-04  7:48 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-03 10:02 More flags for logging Marc Kleine-Budde
2021-05-03 10:08 ` Marc Kleine-Budde
2021-05-03 15:02   ` Vincent MAILHOL
2021-05-03 15:43     ` Marc Kleine-Budde
     [not found]     ` <DBBPR03MB70828377F51A1747B4E9E6529D5B9@DBBPR03MB7082.eurprd03.prod.outlook.com>
2021-05-03 15:47       ` Marc Kleine-Budde
     [not found]         ` <DBBPR03MB7082F029173018680E5D869C9D5B9@DBBPR03MB7082.eurprd03.prod.outlook.com>
2021-05-03 21:46           ` Vincent MAILHOL
2021-05-04  5:40             ` Patrick Menschel
2021-05-04  7:48             ` Marc Kleine-Budde [this message]
2021-05-04 12:22               ` mcp251xfd receiving non ACKed frames (was: Re: More flags for logging) Vincent MAILHOL
2021-05-04 12:53                 ` Thomas.Kopp
2021-05-04 14:26                   ` Vincent MAILHOL
2021-05-04 17:44                 ` Vincent MAILHOL
2021-05-04 10:10         ` More flags for logging Kurt Van Dijck
2021-05-04 10:07     ` Kurt Van Dijck
2021-05-04  8:49   ` Oliver Hartkopp
     [not found]     ` <DBBPR03MB7082C7E8FD22D0CA8C2DA99D9D5A9@DBBPR03MB7082.eurprd03.prod.outlook.com>
     [not found]       ` <AM8PR08MB5698886555F8531B6CF65982B75A9@AM8PR08MB5698.eurprd08.prod.outlook.com>
2021-05-04  9:49         ` Ayoub Kaanich
2021-05-04 10:13           ` Oliver Hartkopp
2021-05-04 13:58             ` Ayoub Kaanich
2021-05-04 14:38               ` Oliver Hartkopp
     [not found]     ` <DBBPR03MB70824BB82F7BB335928BE36A9D2F9@DBBPR03MB7082.eurprd03.prod.outlook.com>
2021-05-17  7:29       ` Oliver Hartkopp

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210504074834.tki7gzr6wz2le6o3@pengutronix.de \
    --to=mkl@pengutronix.de \
    --cc=kayoub5@live.com \
    --cc=linux-can@vger.kernel.org \
    --cc=mailhol.vincent@wanadoo.fr \
    --cc=thomas.kopp@microchip.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).