Title: slcan interface needs some time-tweaking (Possible solution provided) · Issue #1746 · hardbyte/python-can · GitHub
Open Graph Title: slcan interface needs some time-tweaking (Possible solution provided) · Issue #1746 · hardbyte/python-can
X Title: slcan interface needs some time-tweaking (Possible solution provided) · Issue #1746 · hardbyte/python-can
Description: Describe the bug Messages are truncated while using send command. Messages are truncated while using close command. To Reproduce Code as example. Requires python-can and pyserial modules. Windows PC and CANable with original firmware: ht...
Open Graph Description: Describe the bug Messages are truncated while using send command. Messages are truncated while using close command. To Reproduce Code as example. Requires python-can and pyserial modules. Windows P...
X Description: Describe the bug Messages are truncated while using send command. Messages are truncated while using close command. To Reproduce Code as example. Requires python-can and pyserial modules. Windows P...
Opengraph URL: https://github.com/hardbyte/python-can/issues/1746
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"slcan interface needs some time-tweaking (Possible solution provided)","articleBody":"### Describe the bug\r\nMessages are truncated while using send command.\r\nMessages are truncated while using close command.\r\n\r\n\r\n### To Reproduce\r\nCode as example. Requires python-can and pyserial modules.\r\nWindows PC and CANable with original firmware: https://github.com/normaldotcom/canable-fw\r\nCounter-interface: PCAN USB dongle and oscilloscoop\r\n\r\nProblem 1: When looping messages within the \"with can.Bus\", one can see on the scope that the messages are corrupted/truncated.\r\nProblem 2: When looping messages main, one can see that the last message in the \"with can.Bus\" is truncated.\r\n\r\nPossible solution:\r\nEnd the _write-function with: \"time.sleep(3.0e-5)\"\r\nBegin the close-function with: \"time.sleep(3.0e-5)\"\r\n\r\nAdditional information, experimentally obtained:\r\n10kbps: total fail (!)\r\n20kpbs: requires 5.0e-3 seconds\r\n50kpbs: requires 2.0e-3 seconds\r\n83kpbs: requires 2.0e-3 seconds\r\n100kpbs: requires 6.0e-4 seconds\r\n125kpbs: requires 6.0e-4 seconds\r\n250kpbs: requires 5.0e-5 seconds\r\n500kpbs: requires 3.0e-5 seconds\r\n750kpbs: other side (PCAN in this case) has no setting for 750, it has 800 which is not compatible\r\n1000kpbs: requires 4.0e-6 seconds or even lower\r\n\r\n### Expected behavior\r\nTruncated messages: seen on a oscilloscoop. PCAN viewer tels me stuffing errors. The error will result in resending infinite retrying messages.\r\n\r\n### Additional context\r\nOS and version: Windows 11\r\nPython version: Python 3.12\r\npython-can version: 4.3.1\r\npyserial version: 3.5\r\npython-can interface/s (if applicable): slcan\r\nHardware interface: CANable 2.0 Pro\r\nIDE: PyCharm recent version\r\nOscilloscope: Rigol DS1000-series\r\nCounter-interface: PCAN USB isolated version and PCAN-View software\r\n\r\n\u003c!-- Add any other context about the problem here. --\u003e\r\nPossible solution:\r\nEnd the _write-function with: \"time.sleep(3.0e-5)\"\r\nBegin the close-function with: \"time.sleep(3.0e-5)\"\r\n\r\n\u003cdetails\u003e\r\n\u003csummary\u003eTraceback and logs\u003c/summary\u003e\r\n\u003c!-- Has to be followed by an empty line! --\u003e\r\nNone\r\n\r\n\u003c!-- More details such as a minimal script to demonstrate the bug, relevant logs and any tracebacks go here. --\u003e\r\nSee code example.\r\n\r\n\u003c!-- Code examples can be included: --\u003e\r\n```\r\ndef send_one():\r\n with can.Bus(interface=\"slcan\", channel=\"COM7@115200\", bitrate=500000, sleep_after_open=0.0) as bus:\r\n msg = can.Message(\r\n arbitration_id=0x555, data=[0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55], is_extended_id=False\r\n )\r\n\r\n try:\r\n j = 0\r\n while j \u003c 2:\r\n bus.send(msg)\r\n j = j + 1\r\n except can.CanError:\r\n print(\"Message NOT sent\")\r\n\r\n\r\nif __name__ == \"__main__\":\r\n i = 0\r\n while i \u003c 2:\r\n send_one()\r\n i = i + 1\r\n```\r\n\r\n\u003c/details\u003e\r\n","author":{"url":"https://github.com/Dubbels17","@type":"Person","name":"Dubbels17"},"datePublished":"2024-02-22T13:14:23.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":0},"url":"https://github.com/1746/python-can/issues/1746"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:2c7ded43-4465-b92a-c8da-903da787309f |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 911E:2E8FB4:59C6ACF:77BD7EA:6A5DD3F9 |
| html-safe-nonce | f52f1e904a3e4cd71b0f1485d34c661ea3f6af8d600ce7f577135d7d9b85a9d3 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5MTFFOjJFOEZCNDo1OUM2QUNGOjc3QkQ3RUE6NkE1REQzRjkiLCJ2aXNpdG9yX2lkIjoiMTE3OTEyNTQ3OTgyMTM5OTAzMyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 3f4e0298b7d66f427bae85e34e9e154f9987cddcb1b625aa5323d96e6597c4d0 |
| hovercard-subject-tag | issue:2149052380 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/hardbyte/python-can/1746/issue_layout |
| twitter:image | https://opengraph.githubassets.com/df411432a89a8f09f8dd2b66f3a18d032c56ca5f0d6706bd8b9ece0bfa7054ea/hardbyte/python-can/issues/1746 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/df411432a89a8f09f8dd2b66f3a18d032c56ca5f0d6706bd8b9ece0bfa7054ea/hardbyte/python-can/issues/1746 |
| og:image:alt | Describe the bug Messages are truncated while using send command. Messages are truncated while using close command. To Reproduce Code as example. Requires python-can and pyserial modules. Windows P... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | Dubbels17 |
| hostname | github.com |
| expected-hostname | github.com |
| None | 5290d7e14309ad1e76106a9c4237bd1041517e83ea182c8ab756752cb0c6940b |
| turbo-cache-control | no-preview |
| go-import | github.com/hardbyte/python-can git https://github.com/hardbyte/python-can.git |
| octolytics-dimension-user_id | 855189 |
| octolytics-dimension-user_login | hardbyte |
| octolytics-dimension-repository_id | 69090889 |
| octolytics-dimension-repository_nwo | hardbyte/python-can |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 69090889 |
| octolytics-dimension-repository_network_root_nwo | hardbyte/python-can |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 9c975978430e9ad293956f2bbdaf153b1bd84a99 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width