From: ajneu <ajneu1@gmail.com>
To: linux-can@vger.kernel.org
Subject: Re: Bug? -- NEVER getting controller-problem{back-to-error-active}
Date: Mon, 20 Jun 2016 09:22:49 +0000 (UTC) [thread overview]
Message-ID: <loom.20160620T112016-679@post.gmane.org> (raw)
In-Reply-To: loom.20160620T110554-742@post.gmane.org
ajneu <ajneu1 <at> gmail.com> writes:
> I'm using a PEAK USB Adapter (PCAN-USB FD) for normal CAN Frames (standard
> format), and lsmod shows peak_usb as it should.
>
> When running on a can bus and continually send out messages (one frame each
> second).
> But there is no other participant, so I will get NO ACK.
>
> So berr-counter-tx counts up until it reaches
> 96:
> -> enter state ERROR-WARNING.
>
> I then get a frame:
> Error:
> Id : 0x20000004
> Data: 0x0 0x8 0x0 0x0 0x0 0x0 0x0 0x0
> controller-problem{tx-error-warning}
> [...]
I should mention which settings I'm using (I hope the settings are ok.)
const can_err_mask_t err_mask =
( CAN_ERR_TX_TIMEOUT /* TX timeout (by netdevice driver) */
| CAN_ERR_LOSTARB /* lost arbitration / data[0] */
| CAN_ERR_CRTL /* controller problems / data[1] */
| CAN_ERR_PROT /* protocol violations / data[2..3] */
| CAN_ERR_TRX /* transceiver status / data[4] */
| CAN_ERR_ACK /* received no ACK on transmission */
| CAN_ERR_BUSOFF /* bus off */
//CAN_ERR_BUSERROR /* bus error (may flood!) */
| CAN_ERR_RESTARTED /* controller restarted */
);
ret = setsockopt(sock_fd, SOL_CAN_RAW, CAN_RAW_ERR_FILTER,
&err_mask, sizeof(err_mask));
AND
// Write should block, when socketcan's own queue is full.
// To have this behaviour (and not get error ENOBUFS) set SO_SNDBUF
to its minimum value.
// See https://rtime.felk.cvut.cz/can/socketcan-qdisc-final.pdf#page=21
const int sndbuf = 0;
if (setsockopt(sock_fd, SOL_SOCKET, SO_SNDBUF, &sndbuf,
sizeof(sndbuf)) < 0) {
std::cerr << "Error setting SO_SNDBUF in setsockopt" <<
std::strerror(errno) << std::endl;
return -1;
}
next prev parent reply other threads:[~2016-06-20 9:23 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-20 9:12 Bug? -- NEVER getting controller-problem{back-to-error-active} ajneu
2016-06-20 9:22 ` ajneu [this message]
2016-06-20 10:33 ` Wolfgang Grandegger
2016-06-20 12:41 ` ajneu
2016-06-20 13:00 ` ajneu
2016-06-20 13:31 ` Wolfgang Grandegger
2016-06-20 13:53 ` ajneu
2016-06-20 14:28 ` Wolfgang Grandegger
2016-06-21 8:29 ` Stephane Grosjean
2016-06-21 9:58 ` Wolfgang Grandegger
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=loom.20160620T112016-679@post.gmane.org \
--to=ajneu1@gmail.com \
--cc=linux-can@vger.kernel.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.