From: mkl@pengutronix.de (Marc Kleine-Budde)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v3 4/4] can: flexcan: add vf610 support for FlexCAN
Date: Mon, 04 Aug 2014 16:27:49 +0200 [thread overview]
Message-ID: <53DF9865.9060407@pengutronix.de> (raw)
In-Reply-To: <cd33e1b365502ec0cb3b5bee6dc4fb61@agner.ch>
On 08/04/2014 03:43 PM, Stefan Agner wrote:
[...]
>> Thanks for the test, so far looks promising :) With this setup the other
>> CAN node repeats the CAN frame until it's ACKed. Because there is no
>> node with a compatible bitrate, there is no ACking CAN node.
>>
>> Can you add a third CAN node to the network. The second and third node
>> should use the same bitrate, while your vf610 uses a different one. With
>> the new setup it should take more than one frame until the vf610 goes
>> into error warning and even more frames to error passive. This way we
>> can see it the error warning interrupt is connected or not. The error
>> counters should increase with each "wrong" bitrate frame it sees, you
>> can check with:
>>
>> ip -details link show can0
>>
>> The output looks like this:
>>
>>> 4: can0: <NOARP,UP,LOWER_UP,ECHO> mtu 16 qdisc pfifo_fast state UNKNOWN mode DEFAULT qlen 10
>>> link/can
>>> can state ERROR-ACTIVE (berr-counter tx 0 rx 0) restart-ms 0
>> ^^^^^^^^^^^^^^^^^^^^^^
>>> bitrate 1000000 sample-point 0.750
>>> tq 125 prop-seg 2 phase-seg1 3 phase-seg2 2 sjw 1
>>> sja1000: tseg1 1..16 tseg2 1..8 sjw 1..4 brp 1..64 brp-inc 1
>>> clock 8000000
>>
>> When one of the berr-counter crosses 96 (and stays below 128) a warning
>> interrupt should be generated.
>
> Ok, created this setup, could successfully communicate with all three
> nodes. I then set the Vybrid to half of the bitrate. When I send a frame
> from Vybrid, the berr-counter tx immediately ends up at 128 and the
> device is in ERROR-PASSIVE:
This is expected.
> root at colibri-vf:~# ip -details link show can1
> 3: can1: <NOARP,UP,LOWER_UP,ECHO> mtu 16 qdisc pfifo_fast state UNKNOWN
> mode DEFAULT group default qlen 10
> link/can promiscuity 0
> can state ERROR-ACTIVE (berr-counter tx 0 rx 0) restart-ms 0
> bitrate 124990 sample-point 0.739
> tq 347 prop-seg 8 phase-seg1 8 phase-seg2 6 sjw 1
> flexcan: tseg1 4..16 tseg2 2..8 sjw 1..4 brp 1..256 brp-inc 1
> clock 83368421
^^^^^^^^
BTW: the can core has a really weird clock rate, have a look at the
datasheet if you manage to route a 24 MHz clock (or another multiple of
8MHz) to the flexcan core. I had a quick glance at the datasheet, if I
understand it correctly the Fast OSC clock runs with 24 MHz.
> root at colibri-vf:~# cansend can1 1F334455#1122334455667788
> interface = can1, family = 29, type = 3, proto = 1
> root at colibri-vf:~# [ 818.886664] flexcan_irq, esr=00062242
> [ 818.890365] flexcan_irq, ctrl=1c3dac57
>
> root at colibri-vf:~# ip -details link show can1
> 3: can1: <NOARP,UP,LOWER_UP,ECHO> mtu 16 qdisc pfifo_fast state UNKNOWN
> mode DEFAULT group default qlen 10
> link/can promiscuity 0
> can state ERROR-PASSIVE (berr-counter tx 128 rx 0) restart-ms 0
> bitrate 124990 sample-point 0.739
> tq 347 prop-seg 8 phase-seg1 8 phase-seg2 6 sjw 1
> flexcan: tseg1 4..16 tseg2 2..8 sjw 1..4 brp 1..256 brp-inc 1
> clock 83368421
>
>
> When I send the frames from another device on the bus, I can see the rx
> count incrementing by one on each frame I send. As you expected, the
> device changes to ERROR-WARNING when crossing the 96 frame boundary:
This is correct
> root at colibri-vf:~# ip -details link show can1
> 3: can1: <NOARP,UP,LOWER_UP,ECHO> mtu 16 qdisc pfifo_fast state UNKNOWN
> mode DEFAULT group default qlen 10
> link/can promiscuity 0
> can state ERROR-ACTIVE (berr-counter tx 0 rx 92) restart-ms 0
> bitrate 124990 sample-point 0.739
> tq 347 prop-seg 8 phase-seg1 8 phase-seg2 6 sjw 1
> flexcan: tseg1 4..16 tseg2 2..8 sjw 1..4 brp 1..256 brp-inc 1
> clock 83368421
> root at colibri-vf:~# [ 448.331150] flexcan_irq, esr=0005050a
> [ 448.334851] flexcan_irq, ctrl=1c3dac57
> ip -details link show can1
> 3: can1: <NOARP,UP,LOWER_UP,ECHO> mtu 16 qdisc pfifo_fast state UNKNOWN
> mode DEFAULT group default qlen 10
> link/can promiscuity 0
> can state ERROR-WARNING (berr-counter tx 0 rx 102) restart-ms 0
> bitrate 124990 sample-point 0.739
> tq 347 prop-seg 8 phase-seg1 8 phase-seg2 6 sjw 1
> flexcan: tseg1 4..16 tseg2 2..8 sjw 1..4 brp 1..256 brp-inc 1
> clock 83368421
> However, once reaching 128, I don't get another interrupt and the device
> stays in ERROR-WARNING:
The contents of the esr reg would be interesting, especially the
FLT_CONF part.
> 3: can1: <NOARP,UP,LOWER_UP,ECHO> mtu 16 qdisc pfifo_fast state UNKNOWN
> mode DEFAULT group default qlen 10
> link/can promiscuity 0
> can state ERROR-WARNING (berr-counter tx 0 rx 128) restart-ms 0
> bitrate 124990 sample-point 0.739
> tq 347 prop-seg 8 phase-seg1 8 phase-seg2 6 sjw 1
> flexcan: tseg1 4..16 tseg2 2..8 sjw 1..4 brp 1..256 brp-inc 1
> clock 83368421
>
> Is this the expected behavior on receive?
No, it should go into error passive if one of the error counters have >
127. Maybe this is an error onthe vf610, maybe it's a general flexcan
problem.
Marc
--
Pengutronix e.K. | Marc Kleine-Budde |
Industrial Linux Solutions | Phone: +49-231-2826-924 |
Vertretung West/Dortmund | Fax: +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686 | http://www.pengutronix.de |
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 242 bytes
Desc: OpenPGP digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20140804/2e218810/attachment.sig>
next prev parent reply other threads:[~2014-08-04 14:27 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-15 12:56 [PATCH v3 0/4] ARM: vf610: add FlexCAN support Stefan Agner
2014-07-15 12:56 ` [PATCH v3 1/4] ARM: dts: vf610: add FlexCAN node Stefan Agner
2014-07-15 12:56 ` [PATCH v3 2/4] ARM: imx: clk-vf610: fix FlexCAN clock gating Stefan Agner
2014-07-15 12:56 ` [PATCH v3 3/4] can: flexcan: switch on clocks before accessing ecr register Stefan Agner
2014-07-15 13:54 ` Lothar Waßmann
2014-07-15 13:57 ` Marc Kleine-Budde
2014-07-15 12:56 ` [PATCH v3 4/4] can: flexcan: add vf610 support for FlexCAN Stefan Agner
2014-07-15 14:24 ` Marc Kleine-Budde
2014-07-16 6:43 ` Stefan Agner
2014-07-25 10:50 ` Stefan Agner
2014-07-25 13:33 ` Marc Kleine-Budde
2014-07-28 16:20 ` Stefan Agner
2014-07-28 16:28 ` Marc Kleine-Budde
2014-07-29 7:29 ` Stefan Agner
2014-07-30 11:47 ` Marc Kleine-Budde
2014-08-04 13:43 ` Stefan Agner
2014-08-04 14:27 ` Marc Kleine-Budde [this message]
2014-08-04 16:01 ` Stefan Agner
2014-08-05 9:52 ` Marc Kleine-Budde
2014-08-05 12:38 ` Stefan Agner
2014-08-14 10:38 ` Marc Kleine-Budde
2014-07-28 16:31 ` Marc Kleine-Budde
2014-07-15 13:54 ` [PATCH v3 0/4] ARM: vf610: add FlexCAN support Marc Kleine-Budde
2014-08-14 10:04 ` Marc Kleine-Budde
2014-07-16 6:11 ` Shawn Guo
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=53DF9865.9060407@pengutronix.de \
--to=mkl@pengutronix.de \
--cc=linux-arm-kernel@lists.infradead.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 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).