Comments (7)
Interesting.
Can you share some code? Or at least your configuration
from python-udsoncan.
I was digging a bit deeper meanwhile.
Having multiple PythonIsoTpConnection open means each has a running rxthread_task(). They seem to compete for the received CAN payload. What I see is that a call to self.isotp_layer.process() discards the packet because of address mismatch. So, a thread for another ECU has fetched the FirstFrame.
Am I using this conceptually wrong? Is it meant to allow multiple active connections? In that case, the receiver socket should have a filter, or one central receiver thread has to dispatch the packets to the instances.
from python-udsoncan.
That's a very good question. I think each of your bus object should filter for the correct ID so that they do not consume the CAN message for other connections (I am assuming that this is the behaviour python-can when setting a filter).
Having a central dispatcher might be the most straight-forward option. You can use the QueueConnection for that, but I think correctly filtering is cleaner.
Maybe it would be relevant that a filter is automatically set based on the IsoTP stack parameters.
I will investigate later.
I'd be curious to hear what @christiansandberg think of this.
In any case, sharing your configuration may help.
from python-udsoncan.
I have now changed my code to create an individual bus object per ECU, with a filter set to the Rx address. This works for me.
A central dispatcher might be lighter to the CPU, but is more difficult to code. IIRC the tread has short timeouts, wakes up often. With many of those, it's a lot of polling.
from python-udsoncan.
Thanks for the feedback.
Do you think udsoncan or can-isotp should be altered in any way to better handle that use case?
from python-udsoncan.
Dunno, my case might be exotic. Maybe the documentation could tell the caveat. I was especially puzzled because IsoTPSocketConnection worked, PythonIsoTpConnection didn't.
Their setup syntax is different, however. IsoTPSocketConnection gets a bus name and can do all the socket setup by itself, vs. PythonIsoTpConnection operates somewhat lower. You can't set filters or other sockopts when the socket is already bound.
Nevermind, IMHO you may close this. Thanks a lot for the fine piece of Python!
from python-udsoncan.
PythonIsoTpConnection is pretty much a shortcut for not having to setup the socket. You can always use the SocketConnection if you want to do some fancy sockopt setting. I don't think your setup is exotic, I think it would be common to have many UDS channel on the same CAN bus.
And you are correct, the handling of message is different in the kernel module v.s. what python-can does. When using the PythonIsoTpConnection, there an instance of socket per connections and the kernel-module does the dispatching to give a copy of the CAN messagse to each socket unless there's a filter. You'd have to code a dispatching mechanism yourself to get something similar with python-can.
I'll add a warning in the documentation regarding this potential issue. I might also add an function call to get the correct mask from the address object. something like my_address.get_can_filter_mask()
Will close this issue
Thanks for the input.
from python-udsoncan.
Related Issues (20)
- cannot import name 'Literal' from 'typing' (/usr/lib/python3.7/typing.py) HOT 8
- Act as server and parse python-can messages HOT 6
- No data received: [TimeoutException] Problem HOT 12
- ReadDataByIdentifier: no codec.encode() ? HOT 6
- Security access SAPR response not correctly interpreted HOT 3
- WriteDataByIdentifier service execution returned a negative response IncorrectMessageLengthOrInvalidFormat (0x13) when data length is correct HOT 4
- Adding parameter to Communication Control Service(0x28) HOT 10
- SecurityAccess mishandes a level value of 0 HOT 3
- SocketConnection cannot be closed HOT 7
- P2 timer issue on client.transfer_data(block_number, data HOT 22
- Runtime Error: Connection is not open HOT 2
- TimeoutError: timed out HOT 3
- Problem with waiting time to response longer than 1,658 seconds HOT 2
- isotp error handler not propagated to uds connection HOT 3
- Unable to read continuous frames HOT 1
- TimeoutException and request timeout not respected? HOT 9
- Slow response on Windows for transfer data HOT 11
- udsoncan.exceptions.TimeoutException: Did not receive response in time. P2 timeout time has expired HOT 13
- Can I use multiple RX addresses ? HOT 9
- Transport layer frame capture problem HOT 6
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 python-udsoncan.