Comments (18)
Sorry, let me clarify. I put on 60ohm resistors on both segments. They are still currently installed.
from can-utils.
The txqueuelen is still vast to high. I would not exceed the value for such test to more than 100 to get an idea where the problem shows up. When your MCP251x CAN controller is simply too slow to send the desired frame rate you should be able to detect this instantly.
The MCP251x connected via SPI is not a setup with known best performance and stability. This has been improved with the CAN FD version and recent CAN/SPI driver improvements in the Linux kernel. What HW/SW are you running there? RasPi4 with Linux kernel 6.1?
You might also try to set some other controller options for the bitrate settings:
ip link set can0 up type can bitrate 125000 sjw 4 triple-sampling on
And you also might tweak the sample-point, e.g. sample-point 0.80
or sample-point 0.75
as you probably don't know the original ECU settings that are defined in the vehicle.
But PLEASE set the txqueuelen down to 100 to see what happens.
from can-utils.
I've adjusted the txqueuelen to 100 as suggested and enabled triple sampling. The problem seems to be fixed. Both busses communicate fine now. Thank you! Can I ask you if canqw rules can filter out multiple messages like candump comma separated filters? Also if cangw -A -s can0 -d can1 -e -f 322:C00007FF -m AND:D:000.0.FFFF0000FFFFFFFF
and cangw -A -s can0 -d can1
does the second rule still allow the original msg from --C-I-D 322 through to can1?
from can-utils.
With the CAN_RAW socket candump
can perform the 'join' option, which means the filters are logical "AND", so that you can define several "filter out" jobs: e.g. candump can0,123~C00007FF,333~C00007FF,j
In cangw all filters are independent from each other (logical OR). So creating two filter jobs with an inverted filter will always let something pass. Therefore I would suggest to create "positive" filters for the content you want to let pass.
E.g. use filters for ranges together with single CAN ID filters. The single CAN ID filters are very efficient.
https://www.kernel.org/doc/html/latest/networking/can.html#can-filter-usage-optimisation
"To benefit from the optimized filters for single CAN identifiers the CAN_SFF_MASK or CAN_EFF_MASK have to be set into can_filter.mask together with set CAN_EFF_FLAG and CAN_RTR_FLAG bits. A set CAN_EFF_FLAG bit in the can_filter.mask makes clear that it matters whether a SFF or EFF CAN ID is subscribed."
If you want to "overwrite" an existing cangw rule, check out the -u <uid>
feature.
from can-utils.
Thank you!
from can-utils.
Having a txqueuelen of 1000 is usually broken. That just means you run into the problems 'later' - but it doesn't help at all.
Very likely the CAN frame tx rate is lower than than the receive rate.
- Can you post the output of
cangw -L
as it shows the status of handled/dropped/deleted frames. - Do you run into similar problems without the tc stuff?
from can-utils.
the cangw -L output:
cangw -A -s can1 -d can0 # 225 handled 0 dropped 0 deleted
cangw -A -s can0 -d can1 # 8780 handled 0 dropped 0 deleted
from can-utils.
Looks good. What about question 2?
What's the status of the CAN interfaces then? (ip -det link show can0
and ip -det link show can1
)
from can-utils.
No other problem with tc. Normally do not touch it, just put in in there because another user (posted here) was having problems with candump freezing and I wanted to have all to information ready.
:~ $ ip -det link show can0
4: can0: <NO-CARRIER,NOARP,UP,ECHO> mtu 16 qdisc pfifo_fast state DOWN mode DEFAULT group default qlen 1000
link/can promiscuity 0 minmtu 0 maxmtu 0
can state BUS-OFF restart-ms 0
bitrate 125000 sample-point 0.875
tq 500 prop-seg 6 phase-seg1 7 phase-seg2 2 sjw 1
mcp251x: tseg1 3..16 tseg2 2..8 sjw 1..4 brp 1..64 brp-inc 1
clock 8000000 numtxqueues 1 numrxqueues 1 gso_max_size 65536 gso_max_segs 65535
:~ $ ip -det link show can1
5: can1: <NOARP,UP,LOWER_UP,ECHO> mtu 16 qdisc pfifo_fast state UP mode DEFAULT group default qlen 1000
link/can promiscuity 0 minmtu 0 maxmtu 0
can state ERROR-ACTIVE restart-ms 0
bitrate 125000 sample-point 0.875
tq 500 prop-seg 6 phase-seg1 7 phase-seg2 2 sjw 1
mcp251x: tseg1 3..16 tseg2 2..8 sjw 1..4 brp 1..64 brp-inc 1
clock 8000000 numtxqueues 1 numrxqueues 1 gso_max_size 65536 gso_max_segs 65535
from can-utils.
:~ $ ip -det link show can0
4: can0: <NO-CARRIER,NOARP,UP,ECHO> mtu 16 qdisc pfifo_fast state DOWN mode DEFAULT group default qlen 1000
link/can promiscuity 0 minmtu 0 maxmtu 0
can state BUS-OFF restart-ms 0
BUS-OFF means your CAN controller had problems with transmitting CAN frames and went into an error state that stops every CAN transmission.
So you likely have a CAN problem here. E.g. having two CAN controllers sending the same CAN ID to a CAN bus, or a missing node on can0 which ACKs the sent CAN frames or mismatching bitrates, missing termination, etc.
from can-utils.
i apologize. the car shut down as i was entering the command. This one is with the car running
:~ $ ip -det link show can1
5: can1: <NOARP,UP,LOWER_UP,ECHO> mtu 16 qdisc pfifo_fast state UP mode DEFAULT group default qlen 65536
link/can promiscuity 0 minmtu 0 maxmtu 0
can state ERROR-ACTIVE restart-ms 0
bitrate 125000 sample-point 0.875
tq 500 prop-seg 6 phase-seg1 7 phase-seg2 2 sjw 1
mcp251x: tseg1 3..16 tseg2 2..8 sjw 1..4 brp 1..64 brp-inc 1
clock 8000000 numtxqueues 1 numrxqueues 1 gso_max_size 65536 gso_max_segs 65535
s:~ $ ip -det link show can0
4: can0: <NOARP,UP,LOWER_UP,ECHO> mtu 16 qdisc pfifo_fast state UP mode DEFAULT group default qlen 65536
link/can promiscuity 0 minmtu 0 maxmtu 0
can state ERROR-WARNING restart-ms 0
bitrate 125000 sample-point 0.875
tq 500 prop-seg 6 phase-seg1 7 phase-seg2 2 sjw 1
mcp251x: tseg1 3..16 tseg2 2..8 sjw 1..4 brp 1..64 brp-inc 1
clock 8000000 numtxqueues 1 numrxqueues 1 gso_max_size 65536 gso_max_segs 65535
from can-utils.
ERROR-WARNING is just one step before ERROR-PASSIVE (no TX possible)
Not really sure what happens here. But it doesn't seem to be can-gw related.
Did you separate a single(!!?) ECU from the vehicle's CAN bus?
If so, you likely have a termination problem. You need to have ~60 Ohms between CAN_L and CAN_H on either can0 and can1.
from can-utils.
I did separate a single ECU. I will try that and report back, but in the mean time, if I only:
sudo cangw -A -s can0 -d can1
then it seems to be fine. If i do:
sudo cangw -A -s can1 -d can0
then:
cangw -A -s can1 -d can0 # 0 handled 0 dropped 0 deleted
seems termination is behind it. I will report back.
from can-utils.
I tried the 60ohm resistors on halves of the can bus system, it may have help (went to 20,000 msgs before error). I tried a couple other things. When sending traffic in one direction: sudo cangw -A -s can0 -d can1
OR sudo cangw -A -s can1 -d can0
then everything is okay, but you don't get bidirectional communication as expected. If I do sudo cangw -A -s can0 -d can1
& sudo cangw -A -s can1 -d vcan0
then everything works as well. Its only when try to send traffic in both directions on the actual bus that there's a problem.
from can-utils.
More testing shows that only CAN0 is halting all operation. If I send sudo ip link set can0 down
then sudo ip link set can0 up type can bitrate 125000
then both busses come back online for the same limited amount of time.
from can-utils.
Also if I physically alternate the can0 and can1 connections then the error moves over to can1.
from can-utils.
I tried the 60ohm resistors on halves of the can bus system,
What does "tried" mean? Do you still have 60 Ohms on both CAN segments or did you remove the resistors after you "tried" it?
from can-utils.
No cangw problem 8-)
from can-utils.
Related Issues (20)
- CMake build broken due to ISOBUS HOT 2
- Any write to CAN_BCM socket returns -1 with errno = 22 HOT 7
- isobusfs throws warning when compiled with recent clang HOT 1
- can-j1939 - trying to emulate an entire truck HOT 22
- Cannot clear TX Buffer of CAN. HOT 7
- unable to transmit CAN frames with ixxat USB-to-CAN v2 HOT 6
- bcmserver: build issue with AOSP14 HOT 1
- can-calc-bit-timing - with an invalid option, exit code is 0
- CAN FD, data phase bitrate is equal to arbitration phase (RPI4 + MCP2518FD) HOT 3
- Error when using dbitrate with fd on : RTNETLINK answers : Operation not supported HOT 12
- New tools: canerrsim and canerrdump HOT 3
- Too many build systems HOT 2
- isobusfs_srv_cm: stringop-overflow HOT 1
- isobusfs_cmn: format-truncation warning
- gcc complains about unknown pragma
- HELP!! HOT 1
- That was easy to help on empty problems! HOT 3
- isobusfs_cmn: Werror=format HOT 1
- How do I compile AOSP without the Android.mk file? HOT 7
- New tool: udsinterpreter HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from can-utils.