Skip to content

Unable to start CAN-FD session #293

@franky31tlse

Description

@franky31tlse

I am not able to start a simple CAN-FD session.
I wrote some code to list all available CAN interfaces. Then try to start a CAN-FD session to log all incoming CAN-FD frames.

The start tentative always ends with a UnicodeDecodeError.
This is the exact code to reproduce the error:

import nixnet
from nixnet import system
from nixnet import constants
from nixnet import types
import time

# Get CAN interface name
can_interfaces = nixnet.system.System().intf_refs_can

can_list = []
for can_interface in can_interfaces:
    can_list.append(can_interface)

can_interface = can_list[0]
print(can_interface)

can_database = ':can_fd_brs:'
can_cluster = ''
with nixnet.FrameInStreamSession(str(can_interface), str(can_database), str(can_cluster)) as input_session:
    input_session.intf.can_term = constants.CanTerm.OFF
    input_session.intf.baud_rate = 1000000
    input_session.intf.can_fd_baud_rate = 4000000

    input_session.start()

    for i in range(0, 10):
        frames = input_session.frames.read(10000, constants.TIMEOUT_NONE)
        for frame in frames:
            print(frame)
        time.sleep(0.1)

The full traceback:

Traceback (most recent call last):
  File "D:\my_path\main.py", line 27, in <module>
    input_session.start()
  File "D:\Programs\Python\Python39\lib\site-packages\nixnet\_session\base.py", line 165, in start
    _funcs.nx_start(self._handle, scope)
  File "D:\Programs\Python\Python39\lib\site-packages\nixnet\_funcs.py", line 395, in nx_start
    _errors.check_for_error(result.value)
  File "D:\Programs\Python\Python39\lib\site-packages\nixnet\_errors.py", line 18, in check_for_error
    status = status_to_string(error_code)
  File "D:\Programs\Python\Python39\lib\site-packages\nixnet\_errors.py", line 33, in status_to_string
    status_string = buffer_ctypes.value.decode("ascii")
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe9 in position 31: ordinal not in range(128)

If I don't specify database and cluster in the FrameInStreamSession() call, I do not have error, but by default the configuration is CAN, not CAN FD + BRS.

  • OS: Windows 10
  • Python version: 3.9.12
  • NI-XNET version: 2023 Q1 (23.0.0f157)

Output from python -m pip list:

[Package                       Version
----------------------------- -----------
aiohttp                       3.8.1
aiosignal                     1.2.0
alabaster                     0.7.12
altgraph                      0.17.3
apptools                      5.2.0
arrow                         1.2.3
astroid                       2.12.10
asttokens                     2.0.8
async-timeout                 4.0.2
atomicwrites                  1.4.1
attrs                         22.1.0
auto-py-to-exe                2.26.1
autopep8                      1.6.0
Babel                         2.10.3
backcall                      0.2.0
bcrypt                        4.0.0
beautifulsoup4                4.11.1
binaryornot                   0.4.4
black                         22.8.0
bleach                        5.0.1
bottle                        0.12.23
bottle-websocket              0.2.9
Brotli                        1.0.9
certifi                       2022.9.14
cffi                          1.15.1
chardet                       5.0.0
charset-normalizer            2.1.1
click                         8.1.3
cloudpickle                   2.2.0
colorama                      0.4.5
configobj                     5.0.6
contourpy                     1.0.5
cookiecutter                  2.1.1
crcengine                     0.3.3
cryptography                  38.0.1
cycler                        0.11.0
dash                          2.6.2
dash-core-components          2.0.0
dash-html-components          2.0.0
dash-table                    5.0.0
debugpy                       1.6.3
decorator                     5.1.1
defusedxml                    0.7.1
diff-match-patch              20200713
dill                          0.3.5.1
docutils                      0.19
Eel                           0.14.0
entrypoints                   0.4
envisage                      6.1.0
executing                     1.0.0
fastjsonschema                2.16.1
flake8                        4.0.1
Flask                         2.2.2
Flask-Compress                1.13
fonttools                     4.37.2
frozenlist                    1.3.1
ft4222                        1.8.0
future                        0.18.2
gevent                        22.10.2
gevent-websocket              0.10.1
greenlet                      2.0.1
idna                          3.4
imagesize                     1.4.1
importlib-metadata            4.12.0
inflection                    0.5.1
intervaltree                  3.1.0
ipykernel                     6.15.3
ipython                       7.34.0
ipython-genutils              0.2.0
isort                         5.10.1
itsdangerous                  2.1.2
jaraco.classes                3.2.2
jedi                          0.18.1
jellyfish                     0.9.0
Jinja2                        3.1.2
jinja2-time                   0.2.0
jsonschema                    4.16.0
jupyter_client                7.3.5
jupyter-core                  4.11.1
jupyterlab-pygments           0.2.2
kaleido                       0.2.1
keyring                       23.9.3
kiwisolver                    1.4.4
lazy-object-proxy             1.7.1
lxml                          4.9.1
Mako                          1.2.2
Markdown                      3.4.1
MarkupSafe                    2.1.1
matplotlib                    3.6.0
matplotlib-inline             0.1.6
mccabe                        0.6.1
mistune                       2.0.4
more-itertools                8.14.0
multidict                     6.0.2
mypy-extensions               0.4.3
nbclient                      0.6.8
nbconvert                     7.0.0
nbformat                      5.5.0
nest-asyncio                  1.5.5
nidaqmx                       0.6.4
nixnet                        0.3.2
npTDMS                        1.6.0
numpy                         1.23.3
numpydoc                      1.4.0
packaging                     21.3
pandas                        1.4.4
pandocfilters                 1.5.0
paramiko                      2.11.0
parso                         0.8.3
pathspec                      0.10.1
pdoc3                         0.10.0
pefile                        2022.5.30
pexpect                       4.8.0
pickleshare                   0.7.5
Pillow                        9.2.0
pip                           23.0.1
pip-review                    1.2.0
platformdirs                  2.5.2
plotly                        5.10.0
pluggy                        1.0.0
poyo                          0.5.0
prompt-toolkit                3.0.31
psutil                        5.9.2
ptyprocess                    0.7.0
pure-eval                     0.2.2
pycodestyle                   2.8.0
pycparser                     2.21
pydocstyle                    6.1.1
pyface                        7.4.2
pyflakes                      2.4.0
Pygments                      2.13.0
pyinstaller                   5.7.0
pyinstaller-hooks-contrib     2022.14
pylint                        2.15.3
pyls-spyder                   0.4.0
PyNaCl                        1.5.0
pyparsing                     3.0.9
PyQt5                         5.12.3
PyQt5-Qt5                     5.15.2
PyQt5-sip                     12.11.0
PyQtWebEngine                 5.12.1
PyQtWebEngine-Qt5             5.15.2
pyrsistent                    0.18.1
PySide6                       6.3.2
PySide6-Addons                6.3.2
PySide6-Essentials            6.3.2
python-can                    4.1.0
python-dateutil               2.8.2
python-lsp-black              1.1.0
python-lsp-jsonrpc            1.0.0
python-lsp-server             1.3.3
python-slugify                6.1.2
pytoolconfig                  1.2.2
pytz                          2022.2.1
pywin32                       304
pywin32-ctypes                0.2.0
PyYAML                        6.0
pyzmq                         24.0.0
QDarkStyle                    3.0.2
qstylizer                     0.2.2
QtAwesome                     1.1.1
qtconsole                     5.2.2
QtPy                          2.2.0
requests                      2.28.1
rope                          1.3.0
Rtree                         1.0.0
scipy                         1.9.1
setuptools                    65.3.0
shiboken2                     5.15.2.1
shiboken6                     6.3.2
six                           1.16.0
snowballstemmer               2.2.0
sortedcontainers              2.4.0
soupsieve                     2.3.2.post1
Sphinx                        5.1.1
sphinxcontrib-applehelp       1.0.2
sphinxcontrib-devhelp         1.0.2
sphinxcontrib-htmlhelp        2.0.0
sphinxcontrib-jsmath          1.0.1
sphinxcontrib-qthelp          1.0.3
sphinxcontrib-serializinghtml 1.1.5
spyder                        5.2.2
spyder-kernels                2.2.1
stack-data                    0.5.0
tenacity                      8.1.0
testpath                      0.6.0
text-unidecode                1.3
textdistance                  4.5.0
three-merge                   0.1.1
tinycss2                      1.1.1
toml                          0.10.2
tomli                         2.0.1
tomlkit                       0.11.4
tornado                       6.2
traitlets                     5.4.0
traits                        6.4.1
traitsui                      7.4.0
typing_extensions             4.3.0
ujson                         5.5.0
urllib3                       1.26.12
vtk                           9.1.0
watchdog                      2.1.9
wcwidth                       0.2.5
webencodings                  0.5.1
Werkzeug                      2.2.2
whatthepatch                  1.0.2
whichcraft                    0.6.1
wrapt                         1.14.1
wslink                        1.8.2
yapf                          0.32.0
yarl                          1.8.1
zipp                          3.8.1
zope.event                    4.6
zope.interface                5.5.2](url)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions