From: Marc Kleine-Budde <mkl@pengutronix.de>
To: David Boles <me@davidbol.es>
Cc: linux-can@vger.kernel.org,
Stephane Grosjean <s.grosjean@peak-system.com>
Subject: Re: PCAN and SocketCAN Questions
Date: Wed, 10 Aug 2022 09:45:30 +0200 [thread overview]
Message-ID: <20220810074530.or6oecnm7obmm7rh@pengutronix.de> (raw)
In-Reply-To: <CAMgOUGpGEUQgLgAQmYbn-UdWXCkC7kRqdhW-mfg=e2gq9QfqRQ@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 3070 bytes --]
On 09.08.2022 19:35:09, David Boles wrote:
> Hello everyone, I'm new to both SocketCAN and mailing lists so please
> let me know if I'm making any faux pas or haven't correctly RTFMed! I
> heard this was the correct place to ask questions and I have a few
> that I haven't been able to find answers to.
>
> All my testing so far has been done on Ubuntu 20.04 with
> 5.15.0-43-generic and PCAN-USB( Pro) dongles and PCAN-PCI Express
> cards.
>
> Question 1: I've noticed that frames can get silently lost if my
> application doesn't read from the socket frequently enough. This also
> happens if I'm simultaneously dumping frames with candump (the "lost"
> frames do show up in candump's output). Increasing the socket receive
> buffer size with SO_RCVBUF allows more frames to be stored before new
> ones start getting lost. Is there a recommended way to detect this
> happening so that my program can fail noisily?
See candump's "-d" command line option.
| -d (monitor dropped CAN frames)
> Question 2: I'd like to be able to send frames without other receivers
> on the bus to acknowledge them. The one-shot option seems to allow me
> to do this with my USB dongles. What's the difference between the
> one-shot and presume-ack options?
In one shot mode the controller only sends the frame once, there's no
automatic retransmission in case of an error, i.e. missing ACK. This
means in the error case the error counters are incremented as usual and
if enabled and supported by the driver you receive a CAN error frame on
the socket.
Refer to the m_can user manual
(https://github.com/hartkopp/M_CAN-User-Manual-History):
| Disabled Automatic Retransmission
|
| According to the CAN Specification (see ISO 11898-1:2015, 8.3.4 Recovery
| Management), the M_CAN provides means for automatic retransmission of
| frames that have lost arbitration or that have been disturbed by errors
| during transmission. By default automatic retransmission is enabled. To
| support time-triggered communication as described in ISO 11898-1:2015,
| chapter 9.2, the automatic retransmission may be disabled via CCCR.DAR.
Presume ACK, tells the hardware to presume the CAN frame was ACKed, this
results in no error and thus no retransmission.
> Question 3: I'd like to have as little latency as possible and I'm
> assuming using PCIe cards would be beneficial over USB.
ACK
> Unfortunately
> my PCAN-PCI Express card doesn't seem to support either one-shot or
> presume-ack; is that a hardware limitation or a driver limitation?
Maybe Stephane (Cc'ed) can answer this.
> If
> it's a hardware limitation, would anyone be able to recommend a
> low-latency, full-featured option for CAN on traditional x86/64
> desktops?
regards,
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 --]
next prev parent reply other threads:[~2022-08-10 7:45 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-10 2:35 PCAN and SocketCAN Questions David Boles
2022-08-10 7:45 ` Marc Kleine-Budde [this message]
2022-08-11 20:17 ` David Boles
2022-08-12 12:37 ` Marc Kleine-Budde
2022-08-12 13:00 ` Oliver Hartkopp
2022-08-12 19:00 ` David Boles
2022-08-12 18:49 ` David Boles
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=20220810074530.or6oecnm7obmm7rh@pengutronix.de \
--to=mkl@pengutronix.de \
--cc=linux-can@vger.kernel.org \
--cc=me@davidbol.es \
--cc=s.grosjean@peak-system.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