Re: [PATCH v2 1/1] can: ucan: add driver for Theobroma Systems UCAN devices

From: Wolfgang Grandegger
Date: Wed Mar 14 2018 - 06:05:05 EST


Hello Jakob,

Am 14.03.2018 um 10:48 schrieb Jakob Unterwurzacher:
> On 14.03.18 10:25, Wolfgang Grandegger wrote:
>>> Counting the state changes is one thing but you should also generate
>>> error messages for them.
>>
>> The usual test here is:
>>
>> $ candump -td -e any,0:0,#FFFFFFFF
>>
>> should report proper state changes, if you send messages with
>>
>> 1. no cable connected
>> 2. CAN high and low short-circuited
>>
>> Also downwards if the hardware error is gone and you continue to send
>> messages.
> Yes, we do, the hardware does it. Testcases:
>
> (1) no cable connected
>
>> root@rk3399-q7:~# candump -td -e any,0:0,#FFFFFFFF | head -n 1000
>> Â(000.000000)Â can0Â 178ÂÂ [0]
>> Â(000.000410)Â can0Â 20000030ÂÂ [8]Â 00 00 00 00 00 00 08 00ÂÂ ERRORFRAME
>> ÂÂÂÂtransceiver-status
>> ÂÂÂÂno-acknowledgement-on-tx
>> ÂÂÂÂerror-counter-tx-rx{{8}{0}}
>> Â(000.000445)Â can0Â 20000030ÂÂ [8]Â 00 00 00 00 00 00 10 00ÂÂ ERRORFRAME
>> ÂÂÂÂtransceiver-status
>> ÂÂÂÂno-acknowledgement-on-tx
>> ÂÂÂÂerror-counter-tx-rx{{16}{0}}
>> Â(000.000425)Â can0Â 20000030ÂÂ [8]Â 00 00 00 00 00 00 18 00ÂÂ ERRORFRAME
>> ÂÂÂÂtransceiver-status
>> ÂÂÂÂno-acknowledgement-on-tx
>> ÂÂÂÂerror-counter-tx-rx{{24}{0}}
>> Â(000.000451)Â can0Â 20000030ÂÂ [8]Â 00 00 00 00 00 00 20 00ÂÂ ERRORFRAME
>> ÂÂÂÂtransceiver-status
>> ÂÂÂÂno-acknowledgement-on-tx
>> ÂÂÂÂerror-counter-tx-rx{{32}{0}}
>> Â(000.000429)Â can0Â 20000030ÂÂ [8]Â 00 00 00 00 00 00 28 00ÂÂ ERRORFRAME
>> ÂÂÂÂtransceiver-status
>> ÂÂÂÂno-acknowledgement-on-tx
>> ÂÂÂÂerror-counter-tx-rx{{40}{0}}
>> Â(000.000448)Â can0Â 20000030ÂÂ [8]Â 00 00 00 00 00 00 30 00ÂÂ ERRORFRAME
>> ÂÂÂÂtransceiver-status
>> ÂÂÂÂno-acknowledgement-on-tx
>> ÂÂÂÂerror-counter-tx-rx{{48}{0}}
>> Â(000.000433)Â can0Â 20000030ÂÂ [8]Â 00 00 00 00 00 00 38 00ÂÂ ERRORFRAME
>> ÂÂÂÂtransceiver-status
>> ÂÂÂÂno-acknowledgement-on-tx
>> ÂÂÂÂerror-counter-tx-rx{{56}{0}}
>> Â(000.000437)Â can0Â 20000030ÂÂ [8]Â 00 00 00 00 00 00 40 00ÂÂ ERRORFRAME
>> ÂÂÂÂtransceiver-status
>> ÂÂÂÂno-acknowledgement-on-tx
>> ÂÂÂÂerror-counter-tx-rx{{64}{0}}
>> Â(000.000443)Â can0Â 20000030ÂÂ [8]Â 00 00 00 00 00 00 48 00ÂÂ ERRORFRAME
>> ÂÂÂÂtransceiver-status
>> ÂÂÂÂno-acknowledgement-on-tx
>> ÂÂÂÂerror-counter-tx-rx{{72}{0}}
>> Â(000.000437)Â can0Â 20000030ÂÂ [8]Â 00 00 00 00 00 00 50 00ÂÂ ERRORFRAME
>> ÂÂÂÂtransceiver-status
>> ÂÂÂÂno-acknowledgement-on-tx
>> ÂÂÂÂerror-counter-tx-rx{{80}{0}}
>> Â(000.000498)Â can0Â 20000030ÂÂ [8]Â 00 00 00 00 00 00 58 00ÂÂ ERRORFRAME
>> ÂÂÂÂtransceiver-status
>> ÂÂÂÂno-acknowledgement-on-tx
>> ÂÂÂÂerror-counter-tx-rx{{88}{0}}
>> Â(000.000394)Â can0Â 20000034ÂÂ [8]Â 00 0C 00 00 00 00 60 00ÂÂ ERRORFRAME
>> ÂÂÂÂcontroller-problem{rx-error-warning,tx-error-warning}
>> ÂÂÂÂtransceiver-status
>> ÂÂÂÂno-acknowledgement-on-tx
>> ÂÂÂÂerror-counter-tx-rx{{96}{0}}
>> Â(000.000433)Â can0Â 20000034ÂÂ [8]Â 00 0C 00 00 00 00 68 00ÂÂ ERRORFRAME
>> ÂÂÂÂcontroller-problem{rx-error-warning,tx-error-warning}
>> ÂÂÂÂtransceiver-status
>> ÂÂÂÂno-acknowledgement-on-tx
>> ÂÂÂÂerror-counter-tx-rx{{104}{0}}
>> Â(000.000437)Â can0Â 20000034ÂÂ [8]Â 00 0C 00 00 00 00 70 00ÂÂ ERRORFRAME
>> ÂÂÂÂcontroller-problem{rx-error-warning,tx-error-warning}
>> ÂÂÂÂtransceiver-status
>> ÂÂÂÂno-acknowledgement-on-tx
>> ÂÂÂÂerror-counter-tx-rx{{112}{0}}
>> Â(000.000443)Â can0Â 20000034ÂÂ [8]Â 00 0C 00 00 00 00 78 00ÂÂ ERRORFRAME
>> ÂÂÂÂcontroller-problem{rx-error-warning,tx-error-warning}
>> ÂÂÂÂtransceiver-status
>> ÂÂÂÂno-acknowledgement-on-tx
>> ÂÂÂÂerror-counter-tx-rx{{120}{0}}
>> Â(000.000444)Â can0Â 20000034ÂÂ [8]Â 00 3C 00 00 00 00 80 00ÂÂ ERRORFRAME
>> ÂÂÂÂcontroller-problem{rx-error-warning,tx-error-warning,rx-error-passive,tx-error-passive}

Just,

controller-problem{rx-error-passive,tx-error-passive}

>>
>> ÂÂÂÂtransceiver-status
>> ÂÂÂÂno-acknowledgement-on-tx
>> ÂÂÂÂerror-counter-tx-rx{{128}{0}}
>> Â(000.000495)Â can0Â 20000024ÂÂ [8]Â 00 3C 00 00 00 00 80 00ÂÂ ERRORFRAME
>> ÂÂÂÂcontroller-problem{rx-error-warning,tx-error-warning,rx-error-passive,tx-error-passive}
>>
>> ÂÂÂÂno-acknowledgement-on-tx
>> ÂÂÂÂerror-counter-tx-rx{{128}{0}}
>
> Repeats ad infinitum...

Good! And without "berr-reporting" just the state changes should show up.

>
>
> (1b) cable gets connected:
>
>> Â(000.000883)Â can0Â 20000034ÂÂ [8]Â 00 3C 00 00 00 00 80 00ÂÂ ERRORFRAME
>> ÂÂÂÂcontroller-problem{rx-error-warning,tx-error-warning,rx-error-passive,tx-error-passive}
>>
>> ÂÂÂÂtransceiver-status
>> ÂÂÂÂno-acknowledgement-on-tx
>> ÂÂÂÂerror-counter-tx-rx{{128}{0}}
>> Â(000.000996)Â can0Â 20000004ÂÂ [8]Â 00 0C 00 00 00 00 7F 00ÂÂ ERRORFRAME
>> ÂÂÂÂcontroller-problem{rx-error-warning,tx-error-warning}
>> ÂÂÂÂerror-counter-tx-rx{{127}{0}}

Back to error active is missing!? Have a look to:

https://elixir.bootlin.com/linux/latest/source/drivers/net/can/dev.c#L364

Wolfgang.