hardbyte / hardbyte/python-can
Broadcast Manager fails for large sets of messages
- 主要语言
- Python
- 星标
- 1.6k
- 派生
- 697
- PR 合并指标
- 30 天内没有已合并 PR
描述
### Describe the bug
I am attempting to use Broadcast Manager with a PEAK USB CAN adapter on a Raspberry Pi (running the standard Pi OS distro). I am creating a fairly large List containing over 10000 can.Message instances, and would like to use the Broadcast Manager to send this list of messages (same arbitration ID, same DLC on all messages, just different data) in a one-shot manner at a specific time interval.
When I attempt to run my program, I get the following exception:
```bash
can.exceptions.CanOperationError: Couldn't send CAN BCM frame due to OS Error: Invalid argument You are probably referring to a non-existing frame. [Error Code 22]
```
However, if I reduce the size of my message List to something in the 100-200 CAN Frames range, the exact same code works just fine and I see the expected behavior from the device I am interacting with over CAN.
### To Reproduce
- Construct an empty list, and append more than 256 CAN frames
- Attempt to send this list of messages using Broadcast Manager send_periodic() task (my interval is in the range of a few milliseconds)
- To reliably reproduce this issue, make the list above 257 frames in length. It appears this is the boundary condition for this issue (at least in my experience... i.e. 256 frames can be handled by the BCM just fine but 257 frames cause the error mentioned above.)
Due to IP issues I would prefer not to share source. However, if the above is insufficient to reproduce the issue I am happy to write a self-contained code listing.
### Expected behavior
Transmission of all CAN frames placed in list at the specified interval
### Additional context
OS and version: Raspberry Pi OS (Kernel 5.15.61-v7 armv7l)
Python version: 3.9.2
python-can version: 4.0.0 (installed via Pip)
python-can interface/s (if applicable): SocketCAN (via PEAK PCAN-USB)
Traceback and logs
```bash
File "/usr/local/lib/python3.9/dist-packages/can/bus.py", line 235, in send_periodic
self._send_periodic_internal(msgs, period, duration),
File "/usr/local/lib/python3.9/dist-packages/can/interfaces/socketcan/socketcan.py", line 827, in _send_periodic_internal
task = CyclicSendTask(bcm_socket, task_id, msgs, period, duration)
File "/usr/local/lib/python3.9/dist-packages/can/interfaces/socketcan/socketcan.py", line 350, in __init__
self._tx_setup(self.messages)
File "/usr/local/lib/python3.9/dist-packages/can/interfaces/socketcan/socketcan.py", line 374, in _tx_setup
send_bcm(self.bcm_socket, header + body)
File "/usr/local/lib/python3.9/dist-packages/can/interfaces/socketcan/socketcan.py", line 293, in send_bcm
raise can.CanOperationError(base + specific_message, error.errno) from error
can.exceptions.CanOperationError: Couldn't send CAN BCM frame due to OS Error: Invalid argument You are probably referring to a non-existing frame. [Error Code 2```
贡献指南
评估
这个 Issue 还没有评估数据。