Hi Ulrich,

On 08/03/2011 10:39 AM, uprinz wrote:
> 
> Hi Wolfgang!
> 
> 
> Wolfgang Grandegger wrote:
>>
>> Hi Ulrich,
>> ...
>> You could handle the errno ENOBUFS and simply retry after some short
>> delay without printing a message.
>>
> 
> My fault, I thought it was a driver message, but it came from my sources...
> 
> 
> Wolfgang Grandegger wrote:
>>
>>> I configured the bus with 
>>>
>>>         ifconfig $1 down
>>>         echo "$1: Setting bitrate $BITRATE, restart $RESTART"
>>>         ip link set $1 type can bitrate $BITRATE triple-sampling on
>>
>> BTW, triple-sampling with 125 kb/s is pretty unusual.
>>
> 
> You're right, just forgot to remove that line in the setup script.
> 
> 
> Wolfgang Grandegger wrote:
>>
>> What does "ip -d -s link" display? What type of errors and state changes
>> do you see?
>>
> 2: can0: <NOARP,UP,LOWER_UP,ECHO> mtu 16 qdisc pfifo_fast state UNKNOWN qlen
> 10
>     link/can
>     can state ERROR-PASSIVE restart-ms 100
>     bitrate 125000 sample-point 0.875
>     tq 500 prop-seg 6 phase-seg1 7 phase-seg2 2 sjw 1
>     flexcan: tseg1 4..16 tseg2 2..8 sjw 1..4 brp 1..256 brp-inc 1
>     clock 24000000
>     re-started bus-errors arbit-lost error-warn error-pass bus-off
>     0          0          0          5          7          0
>     RX: bytes  packets  errors  dropped overrun mcast
>     9358       1360     0       0       0       0
>     TX: bytes  packets  errors  dropped carrier collsns
>     5537       795      0       0       0       0
> 
> So I see the bus is in ERROR_PASSIVE and that is my problem I think.
> The 'virtual' slave is running, but the master does not start as the slave
> filled up the buffers.

Yes, the messages do not go out because not other CAN device is
responding and therefore the TX queue of the socket is full after some
time ==> ENOBUFS.

> I did an "ip link set can0 type can loopback on" and it worked. But then I
> connected an external CAN device (debugger) and cannot see the messages from
> the slave. (The master gets them). 

> with ifconfig down, ip link set can0 type can loopback off, ifconfig up the
> messages are going in and out perfectly.
> 
> So it must run with and without having any physical slaves connected. 

You need at least *one* device on the CAN bus responding. If there are
no physical slaves, the error state will go up to "ERROR PASSIVE".
That's usually also what happens if you have no cable connected.

> Any idea of how to get that in a row?

If I have not missed anything, your behaviour looks pretty normal to me.
You could use "ip ... berr-reporting on" and use "candump
any,0:0,#FFFFFFFF" to understand a bit better what happens.

Wolfgang.


_______________________________________________
Socketcan-users mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/socketcan-users

Reply via email to