devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Akshay Bhat <nodeax-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: Wolfgang Grandegger <wg-5Yr1BZd7O62+XT7JhA+gdA@public.gmane.org>
Cc: Akshay Bhat <akshay.bhat-jEh4hwF5bVhBDgjK7y7TUQ@public.gmane.org>,
	mkl-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org,
	linux-can-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH v2 2/2] can: spi: hi311x: Add Holt HI-311x CAN driver
Date: Wed, 15 Mar 2017 00:44:20 -0400	[thread overview]
Message-ID: <CANiP4c8WMeT1Cr7WDXew1ne7DFR04oaA8Uch0zvyyOf5yCa37A@mail.gmail.com> (raw)
In-Reply-To: <41439729-42d0-d883-2801-2d3607f2aeab-5Yr1BZd7O62+XT7JhA+gdA@public.gmane.org>

Hi Wolfgang,

On Tue, Mar 14, 2017 at 2:08 PM, Wolfgang Grandegger <wg-5Yr1BZd7O62+XT7JhA+gdA@public.gmane.org> wrote:
...snip....
>> /////disconnect cable
>>   can0  20000088   [8]  00 00 00 19 00 00 28 00   ERRORFRAME
>>         protocol-violation{{}{acknowledge-slot}}
>>         bus-error
>>         error-counter-tx-rx{{40}{0}}
>>   can0  20000088   [8]  00 00 00 19 00 00 58 00   ERRORFRAME
>>         protocol-violation{{}{acknowledge-slot}}
>>         bus-error
>>         error-counter-tx-rx{{88}{0}}
>>   can0  20000088   [8]  00 00 00 19 00 00 80 00   ERRORFRAME
>>         protocol-violation{{}{acknowledge-slot}}
>>         bus-error
>>         error-counter-tx-rx{{128}{0}}
>
>
> TX error warning is missing.
>

This support was missing in the driver, added in V4 patch.

>>   can0  2000008C   [8]  00 20 00 19 00 00 80 00   ERRORFRAME
>>         controller-problem{tx-error-passive}
>>         protocol-violation{{}{acknowledge-slot}}
>>         bus-error
>>         error-counter-tx-rx{{128}{0}}
>
>
> Here "tx-error-passiv" is packed with a bus error. What I'm looking for are
> state change messages similar to:
>
>    can0  20000204  [8] 00 08 00 00 00 00 60 00   ERRORFRAME
>         controller-problem{tx-error-warning}
>         state-change{tx-error-warning}
>         error-counter-tx-rx{{96}{0}}
>    can0  20000204  [8] 00 30 00 00 00 00 80 00   ERRORFRAME
>         controller-problem{tx-error-passive}
>         state-change{tx-error-passive}
>         error-counter-tx-rx{{128}{0}
>
> They should always come, even with "berr-reporting off".
>

HI-3110 has only 1 bus error interrupt. There is no dedicated state
change interrupts like other controllers.

So here is my plan:
- Have the bus error interrupt always enabled
- If berr-reporting off, then have the isr checks/reports state changes
- if berr-reporting on, then have the isr checks/reports bus errors
and state changes (Does it make sense packing the error message, if
the ISR finds both bus and state changes?)

>> write: No buffer space available
>> root@imx6qrom5420b1:~# ip -s -d link show can0
>> 4: can0: <NOARP,UP,LOWER_UP,ECHO> mtu 16 qdisc pfifo_fast state UNKNOWN
>> mode DEFAULT group default qlen 10
>>     link/can  promiscuity 0
>>     can <BERR-REPORTING> state ERROR-PASSIVE (berr-counter tx 128 rx 0)
>> restart-ms 0
>>           bitrate 1000000 sample-point 0.750
>>           tq 62 prop-seg 5 phase-seg1 6 phase-seg2 4 sjw 1
>>           hi3110: tseg1 2..16 tseg2 2..8 sjw 1..4 brp 1..64 brp-inc 1
>>           clock 16000000
>>           re-started bus-errors arbit-lost error-warn error-pass bus-off
>>           0          6          0          1          1          0
>
>
> The error warning and passive counter increased , though. Also the bus error
> should come in at a rather hight rate. Looking to the code, maybe
> you need to test STATF to check for state changes (and not ERR).
>

Apologize, just realized In the above case some error packets were
lost, because I forgot to set the CPU frequency to max. Will resend
the log.

..snip...
>
> After some more messages there should be also:
>
>     can0  20000200  [8] 00 40 00 00 00 00 5F 00   ERRORFRAME
>         state-change{back-to-error-active}
>         error-counter-tx-rx{{95}{0}}
>
> For each message sent, the error counter decreases by 8.
>

The HI-3110 controller decrements the error counter by 1 for every message sent.
The error count increments by 8 when there is an error.

>
>>
>> root@imx6qrom5420b1:~# ip -s -d link show can0
>> 4: can0: <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 117 rx 0) restart-ms 0
>>           bitrate 1000000 sample-point 0.750
>>           tq 62 prop-seg 5 phase-seg1 6 phase-seg2 4 sjw 1
>>           hi3110: tseg1 2..16 tseg2 2..8 sjw 1..4 brp 1..64 brp-inc 1
>>           clock 16000000
>>           re-started bus-errors arbit-lost error-warn error-pass bus-off
>>           0          1          0          0          0          0
>
>
> Strange, some counters got lost.
>

This was a bug introduced when adding berr-reporting, have fixed in v4 patch.

>>
>> I have not been able to check the bus-off condition by (short-circuiting
>> CAN low and high). The tec error count remains at 128 when I short the
>> CAN low and high pins and the status never goes BUSOFF.
>
>
> You also need to send a message and the short-circuit should be at the
> connector of the sending host. What tranceiver is used? Do you know?
>

ADM3054 transceiver is used with HI-3111. I connected the
HI-3111/ADM3054 board to kvaser leaf and ran "cangen -i can0" and
"candump -e any,0:0,#FFFFFFF" on the board. Removed the cable and
shorted the CAN_H/L pins coming out of ADM3054. I will try your
suggestion of using a different bit-rate on the Kvaser leaf instead.

I appreciate your continued feedback, it has helped significantly
improve the error handling of the driver. Looking back I should have
based it on sja1000 or flexcan driver.

Thanks,
Akshay
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  parent reply	other threads:[~2017-03-15  4:44 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-17 19:22 [PATCH v2 1/2] can: holt_hi311x: document device tree bindings Akshay Bhat
2017-01-17 19:22 ` [PATCH v2 2/2] can: spi: hi311x: Add Holt HI-311x CAN driver Akshay Bhat
2017-03-07 15:31   ` Akshay Bhat
2017-03-09  9:59     ` Wolfgang Grandegger
     [not found]       ` <6df4a9ae-eaba-6f3f-9c23-ae269548b005-5Yr1BZd7O62+XT7JhA+gdA@public.gmane.org>
2017-03-09 12:34         ` Akshay Bhat
2017-03-09 14:45           ` Wolfgang Grandegger
2017-03-09 15:28             ` Akshay Bhat
2017-03-09 17:36   ` Wolfgang Grandegger
     [not found]     ` <234d9e75-0083-b8b4-c781-add653fdb550-5Yr1BZd7O62+XT7JhA+gdA@public.gmane.org>
2017-03-13 15:38       ` Akshay Bhat
     [not found]         ` <b3ebb569-b50c-39ad-dec5-0059fbfba8fb-jEh4hwF5bVhBDgjK7y7TUQ@public.gmane.org>
2017-03-14 12:11           ` Wolfgang Grandegger
2017-03-14 16:20             ` Akshay Bhat
2017-03-14 18:08               ` Wolfgang Grandegger
2017-03-14 21:23                 ` Wolfgang Grandegger
     [not found]                 ` <41439729-42d0-d883-2801-2d3607f2aeab-5Yr1BZd7O62+XT7JhA+gdA@public.gmane.org>
2017-03-15  4:44                   ` Akshay Bhat [this message]
2017-03-15  7:19                     ` Wolfgang Grandegger
2017-03-15  9:42                     ` Wolfgang Grandegger
     [not found]                       ` <3dba0948-ffcb-8e80-fb32-62bb0aca6627-5Yr1BZd7O62+XT7JhA+gdA@public.gmane.org>
2017-03-16 17:06                         ` Akshay Bhat
2017-03-16 20:02                           ` Wolfgang Grandegger
2017-03-16 22:29                             ` Akshay Bhat
2017-03-17  7:39                               ` Wolfgang Grandegger
2017-03-17  8:17                                 ` Wolfgang Grandegger
2017-03-17 16:00                                 ` Akshay Bhat
2017-03-17 17:04                                   ` Wolfgang Grandegger
     [not found]                                     ` <7730cff6-6e85-c98d-0315-bd3888d3aeb1-5Yr1BZd7O62+XT7JhA+gdA@public.gmane.org>
2017-03-17 18:28                                       ` Akshay Bhat
     [not found]                                         ` <ff5d44d1-3bfe-8dae-2aaa-561ab0cb989c-jEh4hwF5bVhBDgjK7y7TUQ@public.gmane.org>
2017-03-18 12:30                                           ` 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=CANiP4c8WMeT1Cr7WDXew1ne7DFR04oaA8Uch0zvyyOf5yCa37A@mail.gmail.com \
    --to=nodeax-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
    --cc=akshay.bhat-jEh4hwF5bVhBDgjK7y7TUQ@public.gmane.org \
    --cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-can-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=mkl-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org \
    --cc=netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=wg-5Yr1BZd7O62+XT7JhA+gdA@public.gmane.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).